#include <bits/stdc++.h>
using namespace std;
int p(int n, int f) {
  int f1 = 1;
  for (; n > 0; n--) f1 *= f;
  return f;
}
int main() {
  int a, b, c, d, i, j, n, m, k, t;
  cin >> k >> b >> n >> t;
  if (t == 1)
    cout << n << endl;
  else {
    i = 1;
    a = 0;
    bool tr = 0;
    while (i <= n) {
      a += (p(i - 1, k) * b);
      if (a > t) {
        cout << (n - i) + 1 << endl;
        tr = 1;
        break;
      } else if (a == t) {
        cout << n - i << endl;
        tr = 1;
        break;
      }
      i++;
    }
    if (!tr) cout << 0 << endl;
  }
  return 0;
}
