/* -*- coding: utf-8 -*- * * 2622.cc: No.2622 Dam - yukicoder */ #include #include using namespace std; /* constant */ /* typedef */ typedef long long ll; /* global variables */ /* subroutines */ /* main */ int main() { int tn; scanf("%d", &tn); while (tn--) { ll v, x; int fo, fi, q, r; scanf("%lld%lld%d%d%d%d", &v, &x, &fo, &fi, &q, &r); ll s = x; s += (ll)(fi - fo) * r; if (s > v) { puts("Overflow"); continue; } s -= (ll)fo * (q - r); if (s <= 0) { puts("Zero"); continue; } if (s > x) puts("Overflow"); else if (s < x) puts("Zero"); else puts("Safe"); } return 0; }