#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, M = 2 * (2e5 + 10), MOD = 998244353;
const int INF = 0x3f3f3f3f;
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline int lowbit(int first) { return first & -first; }
inline int read() {
  char ch, c;
  int res;
  while (ch = getchar(), ch < '0' || ch > '9') c = ch;
  res = ch - 48;
  while (ch = getchar(), ch >= '0' && ch <= '9')
    res = (res << 3) + (res << 1) + ch - 48;
  if (c == '-') res = -res;
  return res;
}
void write(int first) {
  if (first < 0) putchar('-'), first = -first;
  if (first > 9) write(first / 10);
  putchar(first % 10 + '0');
  return;
}
long long n;
long long first[N], second[N], ax, ay, bx, by, xs, ys, t;
long long dist(long long a, long long b, long long c, long long d) {
  return (long long)(abs(a - c) + abs(b - d));
}
void work() {
  cin >> first[0] >> second[0] >> ax >> ay >> bx >> by >> xs >> ys >> t;
  while (++n) {
    first[n] = first[n - 1] * ax + bx, second[n] = ay * second[n - 1] + by;
    if (first[n] > xs && second[n] > ys &&
        dist(first[n], second[n], first[n - 1], second[n - 1]) > t)
      break;
  }
  long long res = 0;
  for (int i = 0; i <= n; i++) {
    long long tt = t;
    long long ans = 0;
    if (dist(xs, ys, first[i], second[i]) <= tt) {
      tt -= dist(xs, ys, first[i], second[i]);
      ans++;
    } else {
      continue;
    }
    for (int j = i; j; j--) {
      if (dist(first[j], second[j], first[j - 1], second[j - 1]) <= tt) {
        tt -= dist(first[j], second[j], first[j - 1], second[j - 1]);
        ans++;
      } else
        break;
    }
    for (int j = 1; j <= n; j++) {
      if (dist(first[j], second[j], first[j - 1], second[j - 1]) <= tt) {
        tt -= dist(first[j], second[j], first[j - 1], second[j - 1]);
        ans += j > i;
      } else
        break;
    }
    res = max(res, ans);
  }
  cout << res;
}
int main() {
  work();
  return 0;
}
