#include <bits/stdc++.h>
using namespace std;
long long n, k, l, mod;
struct Matrix {
  long long m[2][2];
  Matrix() { memset(m, 0, sizeof m); }
  Matrix operator*(const Matrix &oth) {
    Matrix ret;
    for (long long i = 0; i < 2; i++) {
      for (long long j = 0; j < 2; j++) {
        for (long long k = 0; k < 2; k++) {
          ret.m[i][j] = (ret.m[i][j] + m[i][k] * oth.m[k][j] % mod) % mod;
        }
      }
    }
    return ret;
  }
} unit, base;
Matrix bp(Matrix a, long long n) {
  Matrix ret = unit;
  while (n) {
    if (n & 1LL) ret = ret * a;
    a = a * a;
    n >>= 1LL;
  }
  return ret;
}
long long fibonacci(long long n) {
  Matrix tmp;
  tmp.m[0][0] = 0, tmp.m[0][1] = 1;
  tmp = tmp * bp(base, n - 1);
  return tmp.m[0][1];
}
long long pow2(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1LL) ret = (ret * a) % mod;
    a = (a * a) % mod;
    b >>= 1LL;
  }
  return ret;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  for (long long i = 0; i < 2; i++) {
    unit.m[i][i] = 1;
  }
  cin >> n >> k >> l >> mod;
  if (mod == 1 || (l < 63 && (1LL << l) <= k)) {
    cout << 0;
    return 0;
  }
  if (l == 0) {
    if (k == 0) {
      cout << 1;
      return 0;
    } else {
      cout << 0;
      return 0;
    }
  }
  base.m[0][0] = 0;
  base.m[0][1] = 1;
  base.m[1][0] = 1;
  base.m[1][1] = 1;
  long long fib = fibonacci(n + 2);
  long long mu = pow2(2, n);
  long long ans = 1;
  for (long long i = 0; i < l; i++) {
    if (((k >> i) & 1LL) == 0)
      ans = (ans * fib) % mod;
    else
      ans = ans * (mu - fib + mod) % mod;
  }
  cout << ans;
  return 0;
}
