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