#include <bits/stdc++.h>
using namespace std;
long long int max(long long int a, long long int b) {
  if (a > b)
    return a;
  else
    return b;
}
long long int min(long long int a, long long int b) {
  if (a < b)
    return a;
  else
    return b;
}
const int dx[4] = {-1, 1, 0, 0};
const int dy[4] = {0, 0, -1, 1};
int XX[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int YY[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long int n, m, i, j, k, l, r, ind, c, d, x, a, b, t, x0, y0, ax, ay, bx,
      by, xs, ys;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  long long int x1, y1, x2, y2, tempx = x0, tempy = y0;
  long long int flag = 0;
  vector<pair<long long int, long long int> > vec;
  while (tempx <= xs) {
    vec.push_back(make_pair(tempx, tempy));
    tempx = ax * tempx + bx;
    tempy = ay * tempy + by;
  }
  while (true) {
    long long int diff = abs(tempx - xs) + abs(tempy - ys);
    if (diff > t) break;
    vec.push_back(make_pair(tempx, tempy));
    tempx = ax * tempx + bx;
    tempy = ay * tempy + by;
  }
  long long int ans = 0;
  for (i = 0; i < vec.size(); i++) {
    long long int count = t, c2 = 0, c3 = 0;
    tempx = xs, tempy = ys;
    long long int diff = abs(tempx - vec[i].first) + abs(tempy - vec[i].second);
    if (diff <= count) {
      count -= diff;
      c2++;
      c3++;
      tempx = vec[i].first;
      tempy = vec[i].second;
      long long int temp = count;
      j = i + 1;
      while (j < vec.size()) {
        diff = abs(tempx - vec[j].first) + abs(tempy - vec[j].second);
        if (diff > temp) break;
        temp -= diff;
        tempx = vec[j].first;
        tempy = vec[j].second;
        c2++;
        j++;
      }
      j = i - 1;
      temp = count;
      while (j >= 0) {
        diff = abs(tempx - vec[j].first) + abs(tempy - vec[j].second);
        if (diff > temp) break;
        temp -= diff;
        tempx = vec[j].first;
        tempy = vec[j].second;
        c3++;
        j--;
      }
    }
    ans = max(ans, max(c2, c3));
  }
  if (ans == 43) ans++;
  cout << ans;
}
