#include <bits/stdc++.h>
using namespace std;
int mult(int x, int y) {
  long long int ans, x1 = (long long int)x, y1 = (long long int)y;
  ans = (x1 * y1) % 1000000007;
  return (int)ans;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }
long long int pow1(long long int a, long long int b, long long int m) {
  long long int ans = 1;
  while (b > 0) {
    if (b & 1) ans = (ans * a) % m;
    a = (a * a) % m;
    b >>= 1;
  }
  return ans;
}
long long int m;
int mina(int arr[], int n) {
  int x = arr[0], i, pos = 0;
  for (i = 1; i < n; i++) {
    if (arr[i] < x) {
      x = arr[i];
      pos = i;
    }
  }
  return x;
}
int maxa(int arr[], int n) {
  int x = arr[0], i, pos = 0;
  for (i = 1; i < n; i++) {
    if (arr[i] > x) {
      x = arr[i];
      pos = i;
    }
  }
  return x;
}
void multiply(long long int F[2][2], long long int M[2][2]);
void power(long long int F[2][2], long long int n);
long long int fib(long long int n) {
  long long int F[2][2] = {{1, 1}, {1, 0}};
  if (n == 0) return 0;
  power(F, n - 1);
  return F[0][0] % m;
}
void power(long long int F[2][2], long long int n) {
  if (n == 0 || n == 1) return;
  long long int M[2][2] = {{1, 1}, {1, 0}};
  power(F, n / 2);
  multiply(F, F);
  if (n % 2 != 0) multiply(F, M);
}
void multiply(long long int F[2][2], long long int M[2][2]) {
  long long int x = (F[0][0] * M[0][0]) % m + (F[0][1] * M[1][0]) % m;
  long long int y = (F[0][0] * M[0][1]) % m + (F[0][1] * M[1][1]) % m;
  long long int z = (F[1][0] * M[0][0]) % m + (F[1][1] * M[1][0]) % m;
  long long int w = (F[1][0] * M[0][1]) % m + (F[1][1] * M[1][1]) % m;
  F[0][0] = x;
  F[0][1] = y;
  F[1][0] = z;
  F[1][1] = w;
}
int a[66];
int main() {
  long long int n, k, i, j, l;
  scanf("%lld", &n);
  scanf("%lld", &k);
  scanf("%lld", &l);
  scanf("%lld", &m);
  for (i = 0; i < 64; i++) {
    a[i] = ((k >> (63 - i)) & 1);
  }
  if (m == 1 || (k >= (long long int)((long long int)1 << l) && l < 63)) {
    cout << "0" << endl;
    return 0;
  }
  long long int ans = 1, x1 = fib(n + 2), y1 = (m + pow1(2, n, m) - x1) % m;
  for (i = 0; i < l; i++) {
    if (a[63 - i])
      ans = (ans * y1) % m;
    else
      ans = (ans * x1) % m;
  }
  printf("%lld\n", ans);
  return 0;
}
