#include <bits/stdc++.h>
using namespace std;
int grow(int k, int b, int n, int cnt) {
  if (n) {
    cnt = cnt * k + b;
    return grow(k, b, n - 1, cnt);
  }
  return cnt;
}
void time(int k, int b, int t, int tmp, int cnt) {
  if (t < tmp) {
    t = t * k + b;
    return time(k, b, t, tmp, cnt + 1);
  }
  printf("%d", cnt);
  return;
}
int main(void) {
  int k, b, n, t, tmp;
  scanf("%d%d%d%d", &k, &b, &n, &t);
  tmp = grow(k, b, n, 1);
  time(k, b, t, tmp, 0);
  return 0;
}
