#include <bits/stdc++.h>
using namespace std;
int main() {
  int k;
  int b;
  int n;
  int t;
  scanf("%d %d %d %d", &k, &b, &n, &t);
  unsigned long long int x = 1;
  for (int i = 0; i < n; i++) x = k * x + b;
  int cont = 0;
  unsigned long long int y = t;
  while (y < x) {
    y = k * y + b;
    cont++;
  }
  cout << cont << endl;
  return 0;
}
