#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long i, c, k, b, n, t;
  cin >> k >> b >> n >> t;
  long long z = k * n + b * n;
  c = k + b;
  while (c <= t) {
    c = c * k + b;
    n--;
  }
  cout << max(0ll, n);
  return 0;
}
