#include <bits/stdc++.h>
using namespace std;
const long long N = 10e5 + 5;
const long long NN = 105;
const double pi = 3.14159;
const long long MAX = 2e5 + 123;
const long long MOD = 1e9 + 7;
const long long INF = 1000000000000000000;
const long long pw = 31;
void speed() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long x, y, ax, bx, ay, by, xs, ys, t, mx;
void hajime() {
  scanf("%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d", &x, &y, &ax, &ay, &bx,
        &by, &xs, &ys, &t);
  vector<pair<long long, long long> > xy;
  xy.push_back({x, y});
  while (xy[xy.size() - 1].first <= 3e16 && xy[xy.size() - 1].second <= 3e16) {
    xy.push_back({xy[xy.size() - 1].first * ax + bx,
                  xy[xy.size() - 1].second * ay + by});
  }
  for (long long i = 0; i < xy.size(); i++) {
    for (long long j = i; j < xy.size(); j++) {
      long long sz = xy[j].first - xy[i].first + xy[j].second - xy[i].second,
                l = abs(xs - xy[i].first) + abs(ys - xy[i].second),
                r = abs(xs - xy[j].first) + abs(ys - xy[j].second);
      if (sz <= t - l || sz <= t - r) mx = max(mx, j - i + 1);
    }
  }
  printf("%I64d", mx);
}
int main() {
  long long miyagi = 1;
  while (miyagi--) hajime();
}
