#include<iostream> #include<cmath> #include<vector> #include<algorithm> #define maxn 200010 #define INF 1000000000 #define ll long long usingnamespacestd;
constint p = 1000000007;
ll pow_mod(ll x, ll n){ ll s = 1; for (; n; n >>= 1, x = x * x % p) if (n & 1) s = s * x % p; return s; }
intgcd(int a, int b){ return b == 0 ? a : gcd(b, a % b); }
int n, m, sx, sy, tx, ty, pro;
voidwork(){ cin >> n >> m >> sx >> sy >> tx >> ty >> pro; pro = pro * pow_mod(100, p - 2) % p; vector<int> vec; ll lcm = 2ll * (n - 1) * (m - 1) / gcd(n - 1, m - 1) % p; for (int i = 0, x = sx, y = sy, dx = x == n ? -1 : 1, dy = y == m ? -1 : 1; i < lcm; ++i) { if (x == tx || y == ty) vec.push_back(i); x += dx; y += dy; if (x == n || x == 1) dx *= -1; if (y == m || y == 1) dy *= -1; } ll tans = 0, q = pow_mod(1 - pro, vec.size()); for (int i = 0; i < vec.size(); ++i) tans = (tans + pow_mod(1 - pro, i) * pro % p * vec[i]) % p; ll ans = (tans * pow_mod(1 - q, p - 2) + lcm * (1 - q) % p * q % p * pow_mod((1 - q) * (1 - q) % p, p - 2)) % p; cout << (ans + p) % p << "\n"; }