#include <bits/stdc++.h>
using namespace std;
int i, j, k, m, n, l;
int main() {
  {
    int b, t;
    cin >> k >> b >> n >> t;
    if (k != 1) {
      double x = b / (double)(k - 1);
      cout << max(0, n + (int)ceil(log((1 + x) / (t + x)) / log(k))) << endl;
    } else {
      cout << max(0, n + (int)ceil((1 - t) / (double)b)) << endl;
    }
  }
  return 0;
}
