#include <bits/stdc++.h>
using namespace std;
template <typename T, typename TT>
ostream &operator<<(ostream &s, pair<T, TT> t) {
  return s << "(" << t.first << "," << t.second << ")";
}
template <typename T>
ostream &operator<<(ostream &s, vector<T> t) {
  s << "{";
  for (int i = 0; i < t.size(); i++)
    s << t[i] << (i == t.size() - 1 ? "" : ",");
  return s << "}" << endl;
}
long long di(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() {
  ios_base::sync_with_stdio(0);
  long long inf = 1e16 + 10;
  long long x0, y0;
  cin >> x0 >> y0;
  long long ax, ay, bx, by;
  cin >> ax >> ay >> bx >> by;
  long long xs, ys, t;
  cin >> xs >> ys >> t;
  vector<pair<long long, long long>> p;
  p.push_back({x0, y0});
  while (1) {
    if (p.back().first > inf || p.back().second > inf) break;
    long long X = p.back().first, Y = p.back().second;
    pair<long long, long long> u = make_pair(X * ax + bx, Y * ay + by);
    p.push_back(u);
  }
  int be = 0;
  for (int s = 0; s <= (int)(p).size() - 1; s++) {
    for (int l = 0; l <= s; l++)
      for (int r = s; r <= (int)(p).size() - 1; r++) {
        vector<int> v;
        v.push_back(s);
        while (v.back() > l) {
          v.push_back(v.back() - 1);
        }
        while (v.back() < r) {
          v.push_back(v.back() + 1);
        }
        long long dis = 0;
        vector<int> odw((int)(p).size(), 0);
        int vis = 0;
        pair<long long, long long> w(xs, ys);
        for (int k = 0; k < (int)(v).size(); k++) {
          if (dis + di(w, p[v[k]]) <= t) {
            vis += 1 - odw[v[k]];
            odw[v[k]] = 1;
            dis += di(w, p[v[k]]);
            w = p[v[k]];
          } else
            break;
        }
        be = max(be, vis);
      }
    for (int l = 0; l <= s; l++)
      for (int r = s; r <= (int)(p).size() - 1; r++) {
        vector<int> v;
        v.push_back(s);
        while (v.back() < r) {
          v.push_back(v.back() + 1);
        }
        while (v.back() > l) {
          v.push_back(v.back() - 1);
        }
        long long dis = 0;
        vector<int> odw((int)(p).size(), 0);
        int vis = 0;
        pair<long long, long long> w(xs, ys);
        for (int k = 0; k < (int)(v).size(); k++) {
          if (dis + di(w, p[v[k]]) <= t) {
            vis += 1 - odw[v[k]];
            odw[v[k]] = 1;
            dis += di(w, p[v[k]]);
            w = p[v[k]];
          } else
            break;
        }
        be = max(be, vis);
      }
  }
  cout << be;
  return 0;
}
