#include<iostream> using namespace std; int n,l,r; int main(){ cin>>n>>l>>r; if ((r/n)*n>=l+1)cout<<((r/n)*n-1)%n; else cout<<r%n; return 0; }