#include <bits/stdc++.h>
using namespace std;
const long long BIG = 3e16;
vector<long long> xpos;
vector<long long> ypos;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long x0, y0, ax, ay, bx, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  xpos.push_back(x0);
  ypos.push_back(y0);
  while (1) {
    long long nx = ax * xpos.back() + bx;
    long long ny = ay * ypos.back() + by;
    if (nx > BIG || ny > BIG) break;
    xpos.push_back(nx);
    ypos.push_back(ny);
  }
  long long xs, ys, t;
  cin >> xs >> ys >> t;
  int res = 0;
  for (int i = 0; i < xpos.size(); i++) {
    for (int j = i; j < xpos.size(); j++) {
      long long manhat = xpos[j] - xpos[i] + ypos[j] - ypos[i];
      long long c1 = abs(xs - xpos[i]) + abs(ys - ypos[i]);
      long long c2 = abs(xs - xpos[j]) + abs(ys - ypos[j]);
      manhat += min(c1, c2);
      if (manhat <= t) res = max(res, j - i + 1);
    }
  }
  cout << res << '\n';
}
