#include <bits/stdc++.h>
using namespace std;
const int N = 1e6;
const long long inf = 1e17;
long long overFlow(long long a, long long b) {
  if ((inf / a) < b) return 1;
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long x0, y0, ax, ay, bx, by;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  long long xs, ys, t;
  cin >> xs >> ys >> t;
  vector<pair<long long, long long> > v;
  v.push_back({x0, y0});
  while (true) {
    if (overFlow(x0, ax) || overFlow(y0, ay)) break;
    x0 = ax * x0 + bx, y0 = ay * y0 + by;
    v.push_back({x0, y0});
  }
  if (v.size() > 100) assert(0);
  int ans = 0;
  for (int i = 0; i < v.size(); i++) {
    int cnt = 0;
    long long ds = abs(v[i].first - xs) + abs(v[i].second - ys);
    if (ds > t) continue;
    cnt++;
    for (int j = i - 1; j >= 0; j--) {
      ds += v[j + 1].first - v[j].first + v[j + 1].second - v[j].second;
      if (ds > t) break;
      cnt++;
    }
    if (ds > t) {
      ans = max(ans, cnt);
      continue;
    }
    int pr = 0;
    for (int j = i + 1; j < v.size(); j++) {
      ds += v[j].first - v[pr].first + v[j].second - v[pr].second;
      if (ds > t) break;
      cnt++;
      pr = j;
    }
    ans = max(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}
