#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const int N = 50;
int main() {
  int k, b, n, t;
  scanf("%d%d%d%d", &k, &b, &n, &t);
  if (k > 1) {
    double x = b * 1.0 / (k - 1);
    int ans = (int)ceil(log((1 + x) / (t + x)) / log(k * 1.0)) + n;
    printf("%d\n", max(ans, 0));
  } else {
    int ans = (int)ceil(1.0 * (1 - t) / b) + n;
    printf("%d\n", max(ans, 0));
  }
  return 0;
}
