#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int k, b, n, t, ans = 0;
  cin >> k >> b >> n >> t;
  if (k == 1) {
    long long sum = 1, get = t, ans = 0;
    for (int i = 0; i < n; ++i) sum += b;
    while (get < sum) {
      get += b;
      ans++;
    }
    cout << ans << endl;
  } else {
    for (int i = 0; i <= n; ++i) {
      long double ans =
          (log((long double)(k - 1) * t + b) - log((long double)(k + b - 1))) /
          log((long double)k);
      if (ans + 1e-9 >= n - i) {
        cout << i << endl;
        break;
      }
    }
  }
  return 0;
}
