#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, b, n, t;
  scanf("%d %d %d %d", &k, &b, &n, &t);
  unsigned long long x = k + b;
  int p = 0;
  while (x <= t && p < n) {
    x = k * x + b;
    p++;
  }
  printf("%d\n", n - p);
}
