#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long gcdf(long long a, long long b) {
  while (a != 0 && b != 0) {
    if (a > b) {
      a %= b;
    } else {
      b %= a;
    }
  }
  return max(a, b);
}
long long power(long long a, long long b, long long m) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans;
}
void boost() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  boost();
  long long test = 1, i, j;
  while (test--) {
    long long xo, yo, ax, ay, bx, by;
    cin >> xo >> yo >> ax >> ay >> bx >> by;
    long long x, y, t;
    cin >> x >> y >> t;
    long long ma = 10000000000000000;
    vector<pair<long long, long long>> vv;
    vv.push_back(make_pair(xo, yo));
    while (vv[vv.size() - 1].first < ma && vv[vv.size() - 1].second < ma) {
      vv.push_back(make_pair(vv[vv.size() - 1].first * ax + bx,
                             vv[vv.size() - 1].second * ay + by));
    }
    long long ans = 0;
    for (i = 0; i < vv.size(); i++) {
      for (j = 0; j < vv.size(); j++) {
        long long l1 =
            abs(vv[i].first - vv[j].first) + abs(vv[i].second - vv[j].second);
        long long l2 =
            abs(vv[i].first - vv[j].first) + abs(vv[i].second - vv[j].second);
        l1 += abs(vv[i].first - x) + abs(vv[i].second - y);
        l2 += abs(vv[j].first - x) + abs(vv[j].second - y);
        if (l1 <= t || l2 <= t) {
          ans = max(ans, abs(i - j) + 1);
        }
      }
    }
    cout << ans << endl;
  }
}
