• [deleted]
    + 0 comments

    if((m+s-1)%n)

    return (m+s-1)%n;

    else

    return n;

    this works fine!if you wish you can apply this logic