#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
const double PI = acos(-1.0);
const long long EPS = (1e-10);
const long long N = 1e5 * 2 + 10;
const long long inf = 1e9 * 2 + 10;
const ll INF = 1e18 * 2 + 10;
const long long MOD = 1e9 + 7;
long long nxt() {
  long long x;
  cin >> x;
  return x;
}
long long fcmp(double a, double b) {
  return (fabs(a - b) < EPS ? 0 : a > b ? 1 : -1);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long k, b, n, t;
  cin >> k >> b >> n >> t;
  long long z = 1, res = n;
  while (k * z + b <= t) {
    z = k * z + b;
    res--;
  }
  cout << (res > 0 ? (res) : (0));
  return 0;
}
