#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10;
const double eps = 1e-8;
vector<long long> a, b;
int main() {
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  b.push_back(0);
  while (true) {
    long long t_dis1 = abs(x0 - xs) + abs(y0 - ys);
    a.push_back(t_dis1);
    long long tx = ax * x0 + bx, ty = ay * y0 + by;
    long long t_dis2 = abs(x0 - tx) + abs(y0 - ty);
    if (tx - xs > t || ty - ys > t) break;
    b.push_back(t_dis2);
    x0 = tx, y0 = ty;
  }
  long long ans = 0;
  for (int i = 0; i < a.size(); ++i) {
    if (a[i] < 0 || (i > 0 && b[i] < b[i - 1])) break;
    long long left = t - a[i];
    if (left < 0) continue;
    long long t_ans = 1;
    for (int j = i; j > 0; --j)
      if (left >= b[j])
        left -= b[j], t_ans++;
      else
        break;
    if (t_ans > ans) ans = t_ans;
    left = t - a[i], t_ans = 1;
    for (int j = i + 1; j < a.size(); ++j)
      if (left >= b[j])
        left -= b[j], t_ans++;
      else
        break;
    if (t_ans > ans) ans = t_ans;
  }
  printf("%lld\n", ans);
  return 0;
}
