#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, b, n, t;
  cin >> k >> b >> n >> t;
  int i = 0;
  int x = b;
  while (x <= t) {
    i++;
    x += b * pow(double(k), double(i));
  }
  cout << n - i << endl;
  return 0;
}
