#include <bits/stdc++.h>
using namespace std;
int main() {
  long long k, b, n, t;
  cin >> k >> b >> n >> t;
  int ans = n;
  long long bacteries = k + b;
  while (t >= bacteries && ans > 0) {
    bacteries = k * bacteries + b;
    ans -= 1;
  }
  cout << ans << "\n";
  return 0;
}
