#include <bits/stdc++.h>
using namespace std;
long long N = 10000000000000000;
int points = 0;
int main() {
  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 X[100], Y[100];
  X[0] = xo, Y[0] = yo;
  for (int i = 1; i < 55; i++) {
    X[i] = ax * X[i - 1] + bx;
    Y[i] = ay * Y[i - 1] + by;
    points++;
    if (X[i] >= N || Y[i] >= N) break;
  }
  long long maxi = 0;
  for (int i = 0; i <= points; i++) {
    for (int j = 0; j <= points; j++) {
      long long tmpx = X[i], tmpy = Y[i], tt = t, ans = 0;
      tt -= abs(X[i] - x) + abs(y - Y[i]);
      if (tt >= 0) ans = 1;
      int k = i + 1;
      if (i > j) k = i - 1;
      for (;;) {
        if ((k > i && k > j) || (k < i && k < j)) break;
        long long curx = X[k], cury = Y[k];
        tt -= abs(tmpx - curx) + abs(tmpy - cury);
        tmpx = curx, tmpy = cury;
        if (tt < 0) break;
        ans++;
        if (i <= j)
          k++;
        else
          k--;
      }
      maxi = max(maxi, ans);
    }
  }
  cout << maxi << endl;
}
