#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int N = 2 * (1e5);
const long long int maxo = 1e14;
const long long int inf = 1e17;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int x0, y0, ax, ay, bx, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  long long int xs, ys, t;
  cin >> xs >> ys >> t;
  vector<pair<long long int, long long int> > v;
  v.push_back({x0, y0});
  for (long long int i = 0; i < 100; i++) {
    if (v.back().first > (inf - bx) / (ax)) break;
    if (v.back().second > (inf - by) / ay) break;
    long long int x1 = v.back().first * ax + bx;
    long long int y1 = v.back().second * ay + by;
    v.push_back({x1, y1});
  }
  long long int n = v.size();
  long long int ans = 0;
  for (long long int l = 0; l < n; l++) {
    for (long long int r = l; r < n; r++) {
      long long int d1 = abs(xs - v[l].first) + abs(ys - v[l].second);
      long long int d2 = abs(xs - v[r].first) + abs(v[r].second - ys);
      long long int len =
          abs(v[l].first - v[r].first) + abs(v[l].second - v[r].second);
      if (d1 + len <= t) {
        ans = max(ans, r - l + 1);
      }
      if (d2 + len <= t) {
        ans = max(ans, r - l + 1);
      }
    }
  }
  cout << ans << endl;
}
