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