#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int k, b, n, t;
  cin >> k >> b >> n >> t;
  int have = t;
  int moves = 0;
  while ((have - b) / k > 0) {
    have = (have - b) / k;
    moves++;
  }
  cout << max(0, n - moves);
  return 0;
}
