#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int main() {
  double k, b, n, t, res = 1;
  scanf("%lf%lf%lf%lf", &k, &b, &n, &t);
  int i;
  for (i = n; i >= 0; i--) {
    res = res * k + b;
    if (res > t) break;
  }
  if (i < 0) i = 0;
  cout << i;
  return 0;
}
