#include using namespace std; //repetition #define FOR(i,a,b) for(ll i=(a);i<(b);++i) #define rep(i, n) for(ll i = 0; i < (ll)(n); i++) //container util #define all(x) (x).begin(),(x).end() //typedef typedef long long ll; typedef vector VI; typedef vector VVI; typedef vector VLL; typedef vector VVLL; typedef vector VS; typedef pair PII; typedef pair PLL; //const value //const ll MOD = 1e9 + 7; //const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1}; //const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1}; //conversion inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;} inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;} template inline string toString(T x) {ostringstream sout;sout<> inp >> outq >> a; if(inp > outq){ // easy ll ok_easy = 0; // in ga ok ll ng_easy = 1e9+1; // in ga ng while(abs(ok_easy - ng_easy ) > 1){ ll mid = (ok_easy + ng_easy) / 2; if(check_easy(mid)) ok_easy = mid; else ng_easy = mid; } // hard ll ok_hard = 0; // in ga ok ll ng_hard = 1e9+1; // in ga ng while(abs(ok_hard - ng_hard ) > 1){ ll mid = (ok_hard + ng_hard) / 2; if(check_hard(mid)) ok_hard = mid; else ng_hard = mid; } ll ans = ok_hard; FOR(i, ok_hard+1, ok_easy){ if(i < 1) continue; if(check(i)) ans++; } cout << ans << endl; }else if(inp == outq){ if(a > 0) cout << (ll)1e9 << endl; else cout << 0 << endl; }else{ cout << (ll) 1e9 << endl; } return 0; }