#include <bits/stdc++.h>
using namespace std;
vector<pair<long long, long long>> nds;
long long xc0, yc0, ax, bx, ay, by, xs, ys, t;
int check(int i) {
  long long xi = nds[i].first;
  long long yi = nds[i].second;
  long long tleft = t - abs(xi - xs) - abs(yi - ys);
  int ret = 1;
  while (tleft > 0) {
    for (int j = i - 1; j >= 0; j--) {
      if (tleft >= abs(xi - nds[j].first) + abs(yi - nds[j].second)) {
        ret++;
        tleft -= abs(xi - nds[j].first) + abs(yi - nds[j].second);
        xi = nds[j].first;
        yi = nds[j].second;
      }
    }
    int j = i + 1;
    while (j < nds.size()) {
      if (tleft >= abs(xi - nds[j].first) + abs(yi - nds[j].second)) {
        ret++;
        tleft -= abs(xi - nds[j].first) + abs(yi - nds[j].second);
        xi = nds[j].first;
        yi = nds[j].second;
      } else
        break;
      j++;
    }
    break;
  }
  return ret;
}
int main() {
  cin >> xc0 >> yc0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  long long cnt = 0;
  long long x = xc0;
  long long y = yc0;
  long long difx, dify;
  long long b = 1e16;
  while (cnt < 64) {
    if (x > b + xs + 1) break;
    if (y > b + ys + 1) break;
    difx = abs(x - xs);
    dify = abs(y - ys);
    if (difx + dify <= t) {
      nds.push_back(make_pair(x, y));
    }
    x = x * ax + bx;
    y = y * ay + by;
    cnt++;
  }
  int ans = 0;
  for (int i = 0; i < nds.size(); i++) {
    ans = max(ans, check(i));
  }
  cout << ans << "\n";
}
