#include <bits/stdc++.h>
using namespace std;
const long long modulo = 1073741824;
int main() {
  long long n, k, b, t;
  cin >> k >> b >> n >> t;
  if (k == 1) {
    int diff = (n - (t - 1) / b);
    cout << (diff < 0 ? 0 : diff);
  } else {
    double right = (b + t * (k - 1)) / (b + k - 1);
    double s = n - (log(right) / log(double(k)));
    int ss = ceil(s);
    cout << (ss < 0 ? 0 : ss);
  }
  return 0;
}
