#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll=long long; template using V = vector; template using P = pair; using vll = V; using vvll = V; #define rep(i, k, n) for (ll i=k; i<(ll)n; ++i) #define REP(i, n) rep(i, 0, n) #define ALL(v) v.begin(),v.end() template inline bool chmax(T& a, T b) {if (a inline bool chmin(T& a, T b) {if (a>b) {a=b; return true;} return false;} const ll MOD = 1000000007; const ll HIGHINF = (ll)1e18; ll pow2(ll i) { if (i==0) return 1; else { ll tmp = pow2(i/2); if (i&1) return ((tmp*tmp)%MOD)*2%MOD; else return tmp*tmp%MOD; } } int main() { cin.tie(0); ios::sync_with_stdio(false); ll d, l, r, k; cin >> d >> l >> r >> k; ll dl=0, dr=0; while ((l>>=1)!=0) dl++; while ((r>>=1)!=0) dr++; ll lca; if (dl+dr < k || (k-(dr-dl))%2==1) { cout << 0 << '\n'; return 0; } else { lca = (k-(dr-dl))/2; } // cerr << dl << ' ' << dr << ' ' << lca << '\n'; vll fac((1<