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