#include <bits/stdc++.h>
using namespace std;
const int maxn = 500050;
struct qer {
  long long x, y;
} num[maxn];
int main() {
  long long x0, y0, ax, ay, bx, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  num[0].x = x0, num[0].y = y0;
  long long xs, ys, t;
  cin >> xs >> ys >> t;
  int tot = 0;
  while (1) {
    tot++;
    num[tot].x = num[tot - 1].x * ax + bx;
    num[tot].y = num[tot - 1].y * ay + by;
    if (num[tot].x > 5e16 || num[tot].x > 5e16) break;
  }
  int ans = 0;
  for (int i = 0; i <= tot; i++) {
    if (abs(num[i].x - xs) + abs(num[i].y - ys) > t) continue;
    long long lssum = 0, dis = abs(num[i].x - xs) + abs(num[i].y - ys);
    int cnt = 1;
    for (int j = i - 1; j >= 0; j--) {
      if (dis + abs(num[j + 1].x - num[j].x) + abs(num[j + 1].y - num[j].y) > t)
        break;
      cnt++;
      dis += abs(num[j + 1].x - num[j].x) + abs(num[j + 1].y - num[j].y);
    }
    ans = max(ans, cnt);
    cnt = 1, dis = abs(num[i].x - xs) + abs(num[i].y - ys);
    for (int j = i + 1; j <= tot; j++) {
      if (dis + abs(num[j - 1].x - num[j].x) + abs(num[j - 1].y - num[j].y) > t)
        break;
      cnt++;
      dis += abs(num[j - 1].x - num[j].x) + abs(num[j - 1].y - num[j].y);
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}
