#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
const int maxn = 1e6 + 11;
const long long INF = 2e18;
long long curx0, cury0;
long long ax, ay;
long long bx, by;
long long xs, ys;
long long t;
int n;
vector<pair<long long, long long>> coords;
long long dist(pair<long long, long long> p1, pair<long long, long long> p2) {
  return abs(p1.first - p2.first) + abs(p1.second - p2.second);
}
long long compute(long long i, long long a, long long b) {
  if (i >= (INF - b) / a) return -1;
  return (i * a + b);
}
void create() {
  long long curx = curx0;
  long long cury = cury0;
  coords.push_back({curx, cury});
  while (true) {
    long long newx = compute(curx, ax, bx);
    long long newy = compute(cury, ay, by);
    if (newx == -1 || newy == -1) break;
    coords.push_back({newx, newy});
    curx = newx;
    cury = newy;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> curx0 >> cury0;
  cin >> ax >> ay;
  cin >> bx >> by;
  cin >> xs >> ys >> t;
  create();
  n = coords.size();
  int ans = 0;
  for (int i = 0; i < n; i++) {
    pair<long long, long long> cur = {xs, ys};
    long long timeLeft = t;
    long long d = dist(cur, coords[i]);
    if (d > timeLeft) continue;
    int cnt = 1;
    timeLeft -= d;
    cur = coords[i];
    for (int j = i - 1; j >= 0; j--) {
      long long d = dist(cur, coords[j]);
      if (d > timeLeft) {
        break;
      } else {
        cnt++;
        timeLeft -= d;
        cur = coords[j];
      }
    }
    for (int j = i + 1; j < n; j++) {
      long long d = dist(cur, coords[j]);
      if (d > timeLeft) {
        break;
      } else {
        cnt++;
        timeLeft -= d;
        cur = coords[j];
      }
    }
    ans = max(ans, cnt);
  }
  out(ans);
  return 0;
}
