#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long tt = 1;
  while (tt--) {
    long long x[101], y[101], ax, ay, bx, by;
    cin >> x[0] >> y[0] >> ax >> ay >> bx >> by;
    long long xs, ys, t;
    cin >> xs >> ys >> t;
    long long sz = 0;
    for (long long i = 1; i < 65; i++) {
      x[i] = ax * x[i - 1] + bx;
      y[i] = ay * y[i - 1] + by;
      if (x[i] > 2e16 || y[i] > 2e16) break;
      sz++;
    }
    long long ans = 0;
    long long x0, y0, cnt, p;
    for (long long i = 0; i <= sz; i++) {
      x0 = xs, y0 = ys, cnt = 0, p = t;
      for (long long j = i; j >= 0; j--) {
        long long d = abs(x0 - x[j]) + abs(y0 - y[j]);
        if (d <= p) {
          cnt++;
          x0 = x[j];
          y0 = y[j];
          p -= d;
        } else
          break;
      }
      ans = max(ans, cnt);
      x0 = xs, y0 = ys, cnt = 0, p = t;
      for (long long j = i; j <= sz; j++) {
        long long d = abs(x0 - x[j]) + abs(y0 - y[j]);
        if (d <= p) {
          cnt++;
          x0 = x[j];
          y0 = y[j];
          p -= d;
        } else
          break;
      }
      ans = max(ans, cnt);
    }
    cout << ans << '\n';
  }
  return 0;
}
