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