#include <bits/stdc++.h>
using namespace std;
const int M = 1e5 + 5;
vector<pair<long long, long long>> v;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long x, y, bx, by, xs, ys, t, temp1, temp2, temp;
  long long ax, ay;
  int ans = 0;
  cin >> x >> y >> ax >> ay >> bx >> by >> xs >> ys >> t;
  while (x <= 5e16 && y <= 5e16) {
    v.push_back({x, y});
    x = ax * x + bx;
    y = ay * y + by;
  }
  for (int i = 0; i < v.size(); i++) {
    for (int j = i; j < v.size(); j++) {
      temp = abs(v[i].first - v[j].first) + abs(v[i].second - v[j].second);
      temp1 = abs(v[i].first - xs) + abs(v[i].second - ys);
      temp2 = abs(xs - v[j].first) + abs(ys - v[j].second);
      if (temp + temp1 <= t) {
        ans = max(ans, j - i + 1);
      }
      if (temp + temp2 <= t) {
        ans = max(ans, j - i + 1);
      }
    }
  }
  cout << ans << '\n';
  return 0;
}
