#include <bits/stdc++.h>
using namespace std;
long long MOD;
vector<long long> mult(vector<long long> a, vector<long long> b) {
  vector<long long> temp;
  long long t = ((a[0] * b[0]) % MOD + (a[1] * b[2]) % MOD) % MOD;
  temp.push_back((t + MOD) % MOD);
  t = ((a[0] * b[1]) % MOD + (a[1] * b[3]) % MOD) % MOD;
  temp.push_back((t + MOD) % MOD);
  t = ((a[2] * b[0]) % MOD + (a[3] * b[2]) % MOD) % MOD;
  temp.push_back((t + MOD) % MOD);
  t = ((a[2] * b[1]) % MOD + (a[3] * b[3]) % MOD) % MOD;
  temp.push_back((t + MOD) % MOD);
  return temp;
}
vector<long long> power(vector<long long> a, long long b) {
  vector<long long> pow_a = a, res;
  res.push_back(1);
  res.push_back(0);
  res.push_back(0);
  res.push_back(1);
  while (b > 0) {
    if (b & 1) res = mult(res, pow_a);
    b /= 2;
    pow_a = mult(pow_a, pow_a);
  }
  return res;
}
long long power(long long a, long long b) {
  long long pow_a = a % MOD, res = 1;
  while (b > 0) {
    if (b & 1) res = (res * pow_a) % MOD;
    b /= 2;
    pow_a = (pow_a * pow_a) % MOD;
  }
  res = (res + MOD) % MOD;
  return res;
}
int main() {
  long long n, k, l;
  cin >> n >> k >> l >> MOD;
  long long tem = k, c = 0;
  while (tem > 0) {
    tem /= 2;
    c++;
  }
  if (c > l) {
    cout << "0" << endl;
    return 0;
  }
  vector<long long> temp = vector<long long>(4, 1);
  temp[0] = 0;
  temp = power(temp, n - 1);
  long long fn = (temp[2] + 2 * temp[3]) % MOD;
  fn = (fn + MOD) % MOD;
  long long fn2 = (power(2, n) - fn + MOD) % MOD;
  fn2 = (fn2 + MOD) % MOD;
  long long ans = 1;
  for (__typeof(l) i = (0); i != (l); i++) {
    if (k % 2 == 0)
      ans = (ans * fn) % MOD;
    else
      ans = (ans * fn2) % MOD;
    k /= 2;
  }
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
