#include <bits/stdc++.h>
using namespace std;
double k, b;
int n, t;
long long sum1, sum2;
int main() {
  scanf("%lf%lf%d%d", &k, &b, &n, &t);
  long long s = 1;
  int sum = 0;
  while (s <= t) {
    s = s * k + b;
    sum++;
  }
  printf("%d", max(0, n - sum + 1));
  return 0;
}
