#include <bits/stdc++.h>
using namespace std;
long long n, k;
int l, MOD;
map<long long, int> mp;
int fib(long long n) {
  if (mp.count(n)) return mp[n];
  if (n & 1)
    return mp[n] = 1LL * fib(n / 2) * (fib(n / 2 - 1) + fib(n / 2 + 1)) % MOD;
  return mp[n] = (1LL * fib(n / 2) * fib(n / 2) +
                  1LL * fib(n / 2 - 1) * fib(n / 2 - 1)) %
                 MOD;
}
int bpow(int a, long long b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % MOD;
    b >>= 1;
    a = 1LL * a * a % MOD;
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> k >> l >> MOD;
  if (k >= (1LL << min(l, 62))) {
    cout << "0\n";
    return 0;
  }
  mp[0] = 1 % MOD;
  mp[1] = 1 % MOD;
  int zero = fib(n + 1);
  int one = (bpow(2, n) - zero + MOD) % MOD;
  int ans = 1 % MOD;
  for (int i = 0; i < min(l, 62); i++)
    if ((1LL << i) & k)
      ans = 1LL * ans * one % MOD;
    else
      ans = 1LL * ans * zero % MOD;
  for (int i = 62; i < l; i++) ans = 1LL * ans * zero % MOD;
  cout << ans << endl;
  return 0;
}
