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