#include <bits/stdc++.h>
using namespace std;
map<int, pair<long long, long long> > mmp;
long long mul(long long x, long long y) {
  long long ret = 0;
  while (y) {
    if (y & 1) ret += x;
    x = x << 1;
    y = y >> 1;
    if (ret > 2e16 + 5) return -1;
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long x0, y0, ax, ay, bx, by, sx, sy, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> sx >> sy >> t;
  int cnt = 0;
  if (abs(x0 - sx) + abs(y0 - sy) <= t) mmp[cnt++] = {x0, y0};
  long long prex = x0, prey = y0;
  while (true) {
    if (mul(prex, ax) == -1 || mul(prey, ay) == -1) break;
    prex = ax * prex + bx, prey = prey * ay + by;
    if (abs(prex - sx) + abs(prey - sy) <= t) mmp[cnt++] = {prex, prey};
    if (prex > sx + t && prey > sy + t) break;
  }
  int ans = 0;
  for (int i = 0; i < cnt; ++i) {
    long long tempt = t;
    int tempans = 0;
    prex = sx, prey = sy;
    for (int j = i; j < cnt; ++j) {
      long long x = mmp[j].first, y = mmp[j].second;
      if (abs(x - prex) + abs(y - prey) <= tempt)
        ++tempans, tempt -= abs(x - prex) + abs(y - prey);
      else
        break;
      prex = x, prey = y;
    }
    ans = max(ans, tempans);
    tempans = 0;
    tempt = t;
    prex = sx, prey = sy;
    for (int j = i; j >= 0; --j) {
      long long x = mmp[j].first, y = mmp[j].second;
      if (abs(x - prex) + abs(y - prey) <= tempt)
        ++tempans, tempt -= abs(x - prex) + abs(y - prey);
      else
        break;
      prex = x, prey = y;
    }
    ans = max(ans, tempans);
  }
  cout << ans << endl;
}
