#include <bits/stdc++.h>
using namespace std;
long long x[100], y[100], ax, ay, bx, by;
long long xs, ys, t;
const long long inf = 1e17;
int main() {
  scanf("%lld%lld%lld%lld%lld%lld", &x[0], &y[0], &ax, &ay, &bx, &by);
  scanf("%lld%lld%lld", &xs, &ys, &t);
  int s = 0;
  while (1) {
    if (x[s] > (inf - bx) / ax) break;
    if (y[s] > (inf - by) / ay) break;
    x[s + 1] = ax * x[s] + bx;
    y[s + 1] = ay * y[s] + by;
    s++;
  }
  int Max = 0;
  for (int i = 0; i <= s; i++)
    for (int j = i; j <= s; j++) {
      if (abs(xs - x[i]) + abs(ys - y[i]) + abs(x[i] - x[j]) +
              abs(y[i] - y[j]) <=
          t)
        Max = max(Max, j - i + 1);
      if (abs(xs - x[j]) + abs(ys - y[j]) + abs(x[i] - x[j]) +
              abs(y[i] - y[j]) <=
          t)
        Max = max(Max, j - i + 1);
    }
  cout << Max << endl;
  return 0;
}
