#include <iostream>
// #include <cmath>
#include <iomanip>
using namespace std;
int main(){
int t,cs=1;
cin>>t;
while(t--){
cout<<"Case "<<cs++<<": ";
int n;
cin>>n;
double tm=0,po=0;
while(n--){
int a;
double p;
cin>>a>>p;
if(a>0)
tm+=a*p,po+=p;
else
tm-=a*p;
}
if(po>0)
cout<<fixed<<setprecision(2)<<tm/po<<endl;
else
cout<<"God! Save me"<<endl;
}
}
// #include <cmath>
#include <iomanip>
using namespace std;
int main(){
int t,cs=1;
cin>>t;
while(t--){
cout<<"Case "<<cs++<<": ";
int n;
cin>>n;
double tm=0,po=0;
while(n--){
int a;
double p;
cin>>a>>p;
if(a>0)
tm+=a*p,po+=p;
else
tm-=a*p;
}
if(po>0)
cout<<fixed<<setprecision(2)<<tm/po<<endl;
else
cout<<"God! Save me"<<endl;
}
}
Comments
Post a Comment