rt,
#include <iostream> using namespace std; int main() { int n,l,r; cin>>n>>l>>r; if((l%n+r-l)>=n)printf("%d",n-1); else printf("%d",r%n); }