#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, b, n, t;
  cin >> k >> b >> n >> t;
  int ans = n;
  long long val = k + b;
  for (; ans > 0 && val <= t; val = val * k + b, ans--)
    ;
  cout << ans << '\n';
  return 0;
}
