#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long sx, sy, x_0, y_0, ax, ay, bx, by, t;
long long x[100005], y[100005];
int main() {
  cin >> x_0 >> y_0 >> ax >> ay >> bx >> by >> sx >> sy >> t;
  int n = 0;
  x[0] = x_0;
  y[0] = y_0;
  for (int i = 1;; i++) {
    long long tmp = 1;
    for (int j = 0; j < i; j++) {
      tmp *= ax;
    }
    tmp *= x[0];
    x[i] += tmp;
    long long tmpp = 0;
    tmp = 1;
    for (int j = 0; j < i; j++) {
      tmpp += tmp;
      tmp *= ax;
    }
    tmpp *= bx;
    x[i] += tmpp;
    tmp = 1;
    for (int j = 0; j < i; j++) {
      tmp *= ay;
    }
    tmp *= y[0];
    y[i] += tmp;
    tmpp = 0;
    tmp = 1;
    for (int j = 0; j < i; j++) {
      tmpp += tmp;
      tmp *= ay;
    }
    tmpp *= by;
    y[i] += tmpp;
    if (x[i] > 3e16 || y[i] > 3e16) break;
    n++;
  }
  long long maxx = 0;
  for (int i = 0; i <= n; i++) {
    long long tmp = 0, cnt = 0;
    if (abs(x[i] - sx) + abs(y[i] - sy) <= t) {
      cnt++;
      tmp += abs(x[i] - sx) + abs(y[i] - sy);
    } else
      continue;
    for (int j = i - 1; j >= 0; j--) {
      if (tmp + abs(y[j + 1] - y[j]) + abs(x[j + 1] - x[j]) <= t) {
        cnt++;
        tmp += abs(y[j + 1] - y[j]) + abs(x[j + 1] - x[j]);
      } else
        break;
    }
    maxx = max(maxx, cnt);
    cnt = 1;
    tmp = abs(x[i] - sx) + abs(y[i] - sy);
    for (int j = i + 1; j <= n; j++) {
      if (tmp + abs(y[j - 1] - y[j]) + abs(x[j - 1] - x[j]) <= t) {
        cnt++;
        tmp += abs(y[j - 1] - y[j]) + abs(x[j - 1] - x[j]);
      } else
        break;
    }
    maxx = max(maxx, cnt);
  }
  cout << maxx;
  return 0;
}
