#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7fffffff;
const int maxn = 1e5 + 5;
const long long in = 1ll << 54;
long long X[65], Y[65];
int main() {
  ios::sync_with_stdio(0);
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  X[0] = x0;
  Y[0] = y0;
  int tot = 0;
  for (int i = 1;; i++) {
    if (X[i - 1] > in) break;
    if (Y[i - 1] > in) break;
    X[i] = X[i - 1] * ax + bx;
    Y[i] = Y[i - 1] * ay + by;
    tot++;
  }
  int ans = 0;
  for (int i = 0; i <= tot; i++) {
    int cnt = 0;
    long long tmp = t;
    if (abs(X[i] - xs) + abs(Y[i] - ys) <= tmp) {
      cnt++;
      tmp -= (abs(X[i] - xs) + abs(Y[i] - ys));
      for (int j = i + 1; j <= tot; j++) {
        if (abs(X[j] - X[j - 1]) + abs(Y[j] - Y[j - 1]) <= tmp) {
          cnt++;
          tmp -= (abs(X[j] - X[j - 1]) + abs(Y[j] - Y[j - 1]));
        } else
          break;
      }
      ans = max(ans, cnt);
    }
    cnt = 0;
    tmp = t;
    if (abs(X[i] - xs) + abs(Y[i] - ys) <= tmp) {
      cnt++;
      tmp -= (abs(X[i] - xs) + abs(Y[i] - ys));
      for (int j = i - 1; j >= 0; j--) {
        if (abs(X[j] - X[j + 1]) + abs(Y[j] - Y[j + 1]) <= tmp) {
          cnt++;
          tmp -= (abs(X[j] - X[j + 1]) + abs(Y[j] - Y[j + 1]));
        } else
          break;
      }
      ans = max(ans, cnt);
    }
  }
  cout << ans << endl;
  return 0;
}
