// #pragma GCC optimize("O3,unroll-loops") #include // #include using namespace std; #if __cplusplus >= 202002L using namespace numbers; #endif int main(){ cin.tie(0)->sync_with_stdio(0); cin.exceptions(ios::badbit | ios::failbit); auto __solve_tc = [&](auto __tc_num)->int{ long long cap, init; int fin, fout, q, r; cin >> cap >> init >> fout >> fin >> q >> r; long long delta = 1LL * r * fin - 1LL * q * fout; if(init + 1LL * r * (fin - fout) > cap){ cout << "Overflow\n"; } else if(init + delta <= 0){ cout << "Zero\n"; } else if(delta > 0){ cout << "Overflow\n"; } else if(delta < 0){ cout << "Zero\n"; } else{ cout << "Safe\n"; } return 0; }; int __tc_cnt; cin >> __tc_cnt; for(auto __tc_num = 0; __tc_num < __tc_cnt; ++ __tc_num){ __solve_tc(__tc_num); } return 0; } /* delta * t + init r * (fin - fout) */