#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<long long int, long long int>> v;
  long long int x, y, a1, a2, b1, b2;
  cin >> x >> y >> a1 >> a2 >> b1 >> b2;
  long long int sx, sy, t;
  cin >> sx >> sy >> t;
  while (x <= 3 * pow(10, 16) && y <= 3 * pow(10, 16)) {
    v.push_back(make_pair(x, y));
    x = a1 * x + b1;
    y = a2 * y + b2;
  }
  int n = v.size();
  int maxi = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      long long int t2 = abs(sx - v[i].first) + abs(sy - v[i].second) +
                         v[j].first + v[j].second - v[i].first - v[i].second;
      long long int t3 = abs(sx - v[j].first) + abs(sy - v[j].second) +
                         v[j].first + v[j].second - v[i].first - v[i].second;
      long long int t4 = min(t2, t3);
      if (t4 <= t) {
        maxi = max(maxi, j - i + 1);
      }
    }
  }
  cout << maxi;
  return 0;
}
