#include <bits/stdc++.h>
using namespace std;
void hehe() {
  long long int k, b, n, t;
  cin >> k >> b >> n >> t;
  long long int ans = n;
  long long int i = k + b;
  while (i <= t) {
    i = i * k + b;
    ans--;
  }
  cout << max(ans, 0ll);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  while (t--) {
    hehe();
  }
  return 0;
}
