#include <bits/stdc++.h>
using namespace std;
long long k, b, n, t;
int main() {
  cin >> k >> b >> n >> t;
  int res = 0;
  long long cur = 1;
  while (cur < t && res < n) {
    cur = k * cur + b;
    res++;
  }
  if (cur > t) res--;
  cout << n - res;
  return 0;
}
