#include using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(0); cin.tie(0); ll total = 0; while (!cin.eof()) { int ax, ay, bx, by; ll px, py; cin.ignore(12); cin >> ax; cin.ignore(4); cin >> ay; cin.ignore(13); cin >> bx; cin.ignore(4); cin >> by; cin.ignore(10); cin >> px; cin.ignore(4); cin >> py; cin.ignore(2); px += 10000000000000; py += 10000000000000; ll bd = bx * ay - by * ax; ll pd = px * ay - py * ax; if (pd % bd != 0) { continue; } ll b = pd / bd; ll a = (px - bx * b) / ax; total += a * 3 + b; } cout << total << '\n'; }