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