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