#include<bits/stdc++.h> using namespace std; //#define int long long #define f(i,a,b) for(int i=a;i<b;i++) #define r(i,a,b) for(int i=a;i<=b;i++) #define pb push_back #define mp make_pair typedef long long ll; void solve(){ int n,m,a; cin>>n>>m>>a; int i,j; //cout<<7/3<<'\n';//d i=1+a/m; j=a%m; //cout<<i<<' '<<j<<"\n";//d cout<<(i+j-1)<<' '<<((n-i)>0?(j+n-i):0)<<'\n'; } signed main(){ int T=1; //cin>>T; while(T--)solve(); return 0; }