#include <bits/stdc++.h>
using namespace std;
void IOS() {
  ios::sync_with_stdio(false);
  cout.precision(10);
  cout << fixed;
}
const long long MOD = 1e9 + 7;
const long long mx = 1e5 + 5;
long long i, j, k;
int32_t main() {
  IOS();
  long long k, b, n, t;
  cin >> k >> b >> n >> t;
  long long ans = n;
  long long cur = k + b;
  while (cur <= t) {
    cur = cur * k + b;
    ans--;
  }
  if (ans < 0) ans = 0;
  cout << ans << "\n";
  return 0;
}
