#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long k, b, n, t, x = 1;
  cin >> k >> b >> n >> t;
  long long cnt = 0;
  while (k * x + b <= t) {
    cnt++;
    x = k * x + b;
  }
  cout << ((n - cnt > 0) ? n - cnt : 0) << "\n";
  return 0;
}
