#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, i, b, n, t, secNum = 0;
  long long z, sum = 0, pre;
  cin >> k;
  cin >> b;
  cin >> n;
  cin >> t;
  z = 1;
  pre = 1;
  for (i = 1; i <= n; i++) {
    z = (k * pre) + b;
    pre = (k * pre) + b;
  }
  sum = t;
  pre = t;
  while (sum < z) {
    secNum++;
    sum = pre * k + b;
    pre = pre * k + b;
  }
  cout << secNum << endl;
  return 0;
}
