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