#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, b, n, t;
  while (cin >> k >> b >> n >> t) {
    long long temp = 1;
    long long res = 0;
    for (long long i = 0; i <= n; i++) {
      if (temp <= t)
        temp = temp * k + b;
      else {
        res = n - i + 1;
        break;
      }
    }
    cout << res << "\n";
  }
}
