#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, b, x, z, t, n, n2;
  cin >> k >> b >> n >> t;
  x = k + b;
  n2 = n;
  while (x <= t) {
    x = k * x + b;
    n--;
  }
  cout << (n > 0 ? n : 0) << endl;
  return 0;
}
