#include <bits/stdc++.h>
using namespace std;
long long k, b, n, t, ans, cur;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> k >> b >> n >> t;
  ans = n;
  cur = k + b;
  while (cur <= t) {
    cur = cur * k + b;
    --ans;
  }
  if (ans < 0) ans = 0;
  cout << ans << endl;
  cin.get();
  cin.get();
  return 0;
}
