#include <bits/stdc++.h>
using namespace std;
const long long MAX = 1e6 + 8;
const long long sz = 1e5 + 5;
void f_io() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
}
map<long long, long long> F;
long long n, k, l, m;
long long f(long long x) {
  if (F.count(x)) return F[x];
  return F[x] =
             (f((x + 1) / 2) * f(x / 2) + f((x - 1) / 2) * f((x - 2) / 2)) % m;
}
long long power(long long a, long long b) {
  if (b == 0) return 1;
  if (b == 1) return a;
  if (b % 2 == 1) return (power(a, b - 1) * a) % m;
  long long q = power(a, b / 2);
  return (q * q) % m;
}
int32_t main() {
  f_io();
  long long t = 1;
  while (t--) {
    F[0] = F[1] = 1;
    cin >> n >> k >> l >> m;
    long long ans = 1 % m;
    long long p = power(2, n);
    if (l <= 60 && k >= (1ll << l)) return cout << "0\n", 0;
    for (long long i = 0; i < l; i++) {
      if (k & (1ll << i))
        ans = (ans * (p - f(n + 1) + m)) % m;
      else
        ans = ans * f(n + 1) % m;
    }
    cout << ans << "\n";
  }
}
