#include <bits/stdc++.h>
using namespace std;
__int128 read() {
  __int128 s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + ch - '0', ch = getchar();
  return f * s;
}
struct node {
  __int128 x, y;
} a[200];
int n;
__int128 abs(__int128 a) { return a > 0 ? a : -a; }
int main() {
  a[0].x = read(), a[0].y = read();
  __int128 ax = read(), ay = read(), bx = read(), by = read();
  for (; a[n].x + a[n].y <= 1e18; n++)
    a[n + 1].x = a[n].x * ax + bx, a[n + 1].y = a[n].y * ay + by;
  __int128 xs = read(), ys = read(), t = read();
  int ans = 0;
  for (int s = 0, i; s <= n; s++) {
    __int128 d = 0, x = xs, y = ys;
    for (i = s; ~i && d <= t; i--) {
      d += abs(x - a[i].x) + abs(y - a[i].y), x = a[i].x, y = a[i].y;
    }
    ans = max(ans, d <= t ? s - i : s - i - 1);
    d = 0, x = xs, y = ys;
    for (i = s; i <= n && d <= t; i++) {
      d += abs(x - a[i].x) + abs(y - a[i].y), x = a[i].x, y = a[i].y;
    }
    ans = max(ans, d <= t ? i - s : i - s - 1);
  }
  printf("%d\n", ans);
  return 0;
}
