#include <bits/stdc++.h>
using namespace std;
int x0, y0, ax, ay, bx, by, sx, sy, t, ans;
int main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> x0 >> y0 >> ax >> ay >> bx >> by >> sx >> sy >> t;
t = max(t, 0);
int xi = x0, yi = y0, nt = t, nx = sx, ny = sy;
while(xi <= sx and yi <= sy) {
if(xi == xi * ax + bx and yi == yi * ay + by)
break;
if(abs(xi - sx) + abs(yi - sy) <= t) {
cout << xi << " " << yi << endl;
ans++;
if(nt == t) {
nt -= abs(xi - sx) + abs(yi - sy);
nx = xi;
ny = yi;
}
}
xi = xi * ax + bx;
yi = yi * ay + by;
}
t = nt;
sx = nx;
sy = ny;
while(abs(xi - sx) + abs(yi - sy) <= t) {
cout << xi << " " << yi << endl;
ans++;
xi = xi * ax + bx;
yi = yi * ay + by;
}
cout << ans << endl;
return 0;
}
Wrong Answer.wrong answer 1st numbers differ - expected: '1', found: '0'