#include <bits/stdc++.h>
using namespace std;
double solve(double k, double b, double t) {
  double ans = b / (k - 1);
  return t + ans;
}
int main() {
  int k, b, n, t;
  cin >> k >> b >> n >> t;
  if (n == 0)
    cout << 0 << endl;
  else {
    if (k == 1) {
      int ans = n * b;
      if (ans % t == 0)
        cout << ans / t << endl;
      else
        cout << ans / t + 1 << endl;
    } else {
      double k4 = solve(k, b, 1);
      double k1 = solve(k, b, t);
      double k2 = k4 / k1;
      double k3 = log(k2) / log(k);
      k3 += n;
      cout << ceil(k3) << endl;
    }
  }
  return 0;
}
