#include <bits/stdc++.h>
using namespace std;
long long myabs(long long a) {
  if (a > 0)
    return a;
  else
    return -a;
}
int main() {
  const long long max_dim = 20000000000000000;
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  long long points[64][2];
  int pointNO = 0;
  long long curX, curY;
  curX = x0;
  curY = y0;
  while (curX <= max_dim && curY <= max_dim) {
    points[pointNO][0] = curX;
    points[pointNO][1] = curY;
    pointNO++;
    curX = curX * ax + bx;
    curY = curY * ay + by;
  }
  int bestPathNodes = 0;
  for (int i = 0; i < pointNO; i++) {
    long long timeLeft1 = t;
    timeLeft1 =
        timeLeft1 - (myabs(xs - points[i][0]) + myabs(ys - points[i][1]));
    if (timeLeft1 >= 0)
      bestPathNodes = max(1, bestPathNodes);
    else
      continue;
    curX = points[i][0];
    curY = points[i][1];
    for (int j = 0; j < pointNO; j++) {
      long long timeLeft2 = timeLeft1;
      timeLeft2 =
          timeLeft2 - (myabs(curX - points[j][0]) + myabs(curY - points[j][1]));
      if (timeLeft2 >= 0) {
        bestPathNodes = max(bestPathNodes, 1 + (int)myabs(i - j));
      }
    }
  }
  cout << bestPathNodes << endl;
}
