#include <bits/stdc++.h>
using namespace std;
double num[1000010], u[1000010];
int main() {
  int k, b, n, t;
  while (cin >> k >> b >> n >> t) {
    num[0] = 0.0;
    u[0] = 1.0;
    for (int i = 1; i <= n; i++) {
      u[i] = u[i - 1] * k;
      num[i] = num[i - 1] + u[i] * b;
    }
    double sum;
    for (int i = 0;; i++) {
      sum = u[i] * t;
      if (sum >= num[n] - num[i]) {
        cout << i << endl;
        break;
      }
    }
  }
  return 0;
}
