#include <bits/stdc++.h>
using namespace std;
inline long long Abs(long long x) { return x < 0 ? -x : x; }
long long ax, ay, bx, by;
struct Point {
  long long x, y;
  Point() { x = y = 0; }
  inline void read() { scanf("%lld%lld", &x, &y); }
  inline void makeit() { x = ax * x + bx, y = ay * y + by; }
  inline void print() { printf("(%lld,%lld)\n", x, y); }
} a[100], s;
inline long long dis(Point a, Point b) {
  return Abs(a.x - b.x) + Abs(a.y - b.y);
}
int tot;
long long t;
int ans = 0;
inline long long cal(int l, int r, int mid) {
  long long res = dis(a[mid], s);
  for (int i = mid - 1; i >= l; i--) res += dis(a[i], a[i + 1]);
  if (mid != r) res += dis(a[l], a[mid + 1]);
  if (mid != r)
    for (int i = mid + 2; i <= r; i++) res += dis(a[i], a[i - 1]);
  return res;
}
int main() {
  a[0].read();
  scanf("%lld%lld%lld%lld", &ax, &ay, &bx, &by);
  s.read();
  scanf("%lld", &t);
  while (a[tot].x + a[tot].y <= 5e16) {
    tot++;
    a[tot] = a[tot - 1];
    a[tot].makeit();
  }
  for (int l = 0; l <= tot; l++)
    for (int r = l; r <= tot; r++)
      for (int mid = l; mid <= r; mid++) {
        if (cal(l, r, mid) <= t) ans = max(ans, r - l + 1);
      }
  cout << ans << endl;
}
