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