#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int sz = 1e5 + 10;
int main() {
  ll k, b, n, t, z, ans, zz;
  while (cin >> k >> b >> n >> t) {
    z = 1;
    ans = n;
    for (int i = 0; i < n && z < t; i++) {
      z = z * k + b;
      ans--;
    }
    if (z > t) ans++;
    cout << ans << "\n";
  }
  return 0;
}
