#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, b, n, t;
  double aa, tmp, bb;
  scanf("%d%d%d%d", &k, &b, &n, &t);
  int sum;
  aa = (1 + (b * 1.0) / (k - 1));
  bb = (t + (b * 1.0) / (k - 1));
  tmp = bb / aa;
  int ans = 0;
  if (t == 1) {
    printf("%d\n", n);
    return 0;
  }
  if (k == 1) {
    while (t >= 1) {
      t -= b;
      ans++;
    }
    ans--;
  } else {
    while (tmp >= 1.00000000000000000) {
      tmp /= k;
      ans++;
    }
    ans--;
  }
  printf("%d\n", ans > n ? 0 : (n - ans));
}
