#include <bits/stdc++.h>
using namespace std;
unsigned long long N, K, L, mo;
unsigned long long dp[101010][2], sp0, sp1;
map<unsigned long long, unsigned long long> D;
const int MAT = 2;
unsigned long long G[MAT][MAT], G2[MAT][MAT];
void powmat(unsigned long long p, int n, unsigned long long a[MAT][MAT],
            unsigned long long r[MAT][MAT]) {
  int i, x, y, z;
  unsigned long long a2[MAT][MAT];
  for (x = 0; x < n; x++)
    for (y = 0; y < n; y++) a2[x][y] = a[x][y];
  for (x = 0; x < n; x++)
    for (y = 0; y < n; y++) r[x][y] = 0;
  for (i = 0; i < n; i++) r[i][i] = 1;
  while (p) {
    unsigned long long h[MAT][MAT];
    if (p % 2) {
      for (x = 0; x < n; x++)
        for (y = 0; y < n; y++) h[x][y] = 0;
      for (x = 0; x < n; x++)
        for (z = 0; z < n; z++)
          for (y = 0; y < n; y++) h[x][y] += (r[x][z] * a2[z][y]) % mo;
      for (x = 0; x < n; x++)
        for (y = 0; y < n; y++) r[x][y] = h[x][y] % mo;
    }
    for (x = 0; x < n; x++)
      for (y = 0; y < n; y++) h[x][y] = 0;
    for (x = 0; x < n; x++)
      for (z = 0; z < n; z++)
        for (y = 0; y < n; y++) h[x][y] += (a2[x][z] * a2[z][y]) % mo;
    for (x = 0; x < n; x++)
      for (y = 0; y < n; y++) a2[x][y] = h[x][y] % mo;
    p >>= 1;
  }
}
unsigned long long modpow(unsigned long long a, unsigned long long n) {
  unsigned long long r = 1;
  while (n) r = r * ((n % 2) ? a : 1) % mo, a = a * a % mo, n >>= 1;
  return r;
}
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N >> K >> L >> mo;
  if (L != 64 && K >= (1ULL << L)) return (void)printf("0\n");
  vector<unsigned long long> T;
  G[0][0] = G[0][1] = G[1][0] = 1;
  powmat(N, 2, G, G2);
  sp0 = (G2[0][0] + G2[0][1]) % mo;
  sp1 = (mo + modpow(2, N) - sp0) % mo;
  unsigned long long pat = modpow(sp1, __builtin_popcountll(K)) *
                           modpow(sp0, L - __builtin_popcountll(K)) % mo;
  cout << pat << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false);
  for (i = 0; i < argc - 1; i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < s.size(); i++) ungetc(s[s.size() - 1 - i], stdin);
  solve();
  return 0;
}
