#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAXN = 100010;
struct Point {
  long long x, y;
  Point(ll X, ll Y) { x = X, y = Y; }
  Point() {}
};
long long Abs(long long x) { return x < 0 ? -x : x; }
Point st[100005];
int ln = 0;
int main() {
  ll x0, y0;
  ll ax, ay, bx, by;
  scanf("%lld%lld%lld%lld%lld%lld", &x0, &y0, &ax, &ay, &bx, &by);
  ll sx, sy, t;
  scanf("%lld%lld%lld", &sx, &sy, &t);
  st[++ln] = (Point(x0, y0));
  for (int i = 1; i <= 60; i++) {
    Point &last = st[ln];
    Point n(ax * last.x + bx, ay * last.y + by);
    if (abs(n.x) > abs(sx) && abs(n.y) > abs(sy))
      if (abs(n.x - sx) + abs(n.y - sy) > t) break;
    st[++ln] = n;
  }
  int real = 0;
  for (int i = 1; i <= ln; i++) {
    long long cx = sx, cy = sy;
    int ptr = i;
    long long wage = t;
    int ans = 0;
    while (ptr) {
      Point &point = st[ptr];
      long long cost = Abs(cx - point.x) + Abs(cy - point.y);
      if (wage < cost) break;
      wage -= cost;
      ans++;
      cx = point.x;
      cy = point.y;
      ptr--;
    }
    ptr = i + 1;
    while (ptr <= ln) {
      Point &point = st[ptr];
      long long cost = Abs(cx - point.x) + Abs(cy - point.y);
      if (wage < cost) break;
      wage -= cost;
      ans++;
      cx = point.x;
      cy = point.y;
      ptr++;
    }
    real = max(real, ans);
  }
  printf("%d\n", real);
  return 0;
}
