#include <bits/stdc++.h>
using namespace std;
long long m;
long long fib(long long n) {
  long long a = 0, b = 1, c = 1, d = 1;
  long long aa = 1, bb = 0, cc = 0, dd = 1;
  while (n) {
    if (n & 1) {
      long long aaa = aa * a + bb * c;
      long long bbb = aa * b + bb * d;
      long long ccc = cc * a + dd * c;
      long long ddd = cc * b + dd * d;
      aa = aaa % m;
      bb = bbb % m;
      cc = ccc % m;
      dd = ddd % m;
    }
    long long aaa = a * a + b * c;
    long long bbb = a * b + b * d;
    long long ccc = c * a + d * c;
    long long ddd = c * b + d * d;
    a = aaa % m;
    b = bbb % m;
    c = ccc % m;
    d = ddd % m;
    n >>= 1;
  }
  return bb;
}
long long modpow(long long a, long long b) {
  long long c = 1;
  while (b) {
    if (b & 1) c = c * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return c;
}
long long n, k, l;
long long ans = 1;
int main() {
  cin >> n >> k >> l >> m;
  if (l < 64 && k >> l) {
    cout << 0 << '\n';
    return 0;
  }
  long long f = fib(n + 2);
  long long p = modpow(2, n);
  for (int i = 0; i < l; i++) {
    if ((k >> i) & 1)
      ans *= (p - f + m) % m;
    else
      ans *= f;
    ans %= m;
  }
  cout << ans % m << '\n';
}
