#include <bits/stdc++.h>
using namespace std;
long long dis(pair<long long, long long> a, pair<long long, long long> b) {
  return abs(a.first - b.first) + abs(a.second - b.second);
}
int main() {
  long long X, Y, t;
  long long x0, y0, ax, ay, bx, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> X >> Y >> t;
  vector<long long> x, y;
  x.emplace_back(x0), y.emplace_back(y0);
  while (true) {
    long long px = x.back(), py = y.back();
    double nx = double(px) * ax + bx, ny = double(py) * ay + by;
    if (nx > 1e18 || ny > 1e18) break;
    long long xx = px * ax + bx, yy = py * ay + by;
    x.emplace_back(xx), y.emplace_back(yy);
  }
  assert(x.size() < 100);
  int ans = 0, n = x.size();
  for (int(i) = (0); (i) <= ((n)-1); (i)++) {
    if (dis(make_pair(x[i], y[i]), make_pair(X, Y)) > t) continue;
    int now = 1;
    long long rem = t - dis(make_pair(x[i], y[i]), make_pair(X, Y));
    for (int(j) = (i - 1); (j) >= (0); (j)--) {
      if (rem < dis(make_pair(x[j + 1], y[j + 1]), make_pair(x[j], y[j])))
        break;
      rem -= dis(make_pair(x[j + 1], y[j + 1]), make_pair(x[j], y[j]));
      now++;
    }
    ans = max(ans, now);
    now = 1;
    rem = t - dis(make_pair(x[i], y[i]), make_pair(X, Y));
    for (int(j) = (i + 1); (j) <= (n - 1); (j)++) {
      if (rem < dis(make_pair(x[j], y[j]), make_pair(x[j - 1], y[j - 1])))
        break;
      rem -= dis(make_pair(x[j], y[j]), make_pair(x[j - 1], y[j - 1]));
      now++;
    }
    ans = max(ans, now);
  }
  printf("%d", ans);
}
