/* ID: m1590291 PROG: ride LANG: C++ */ #include <iostream> #include <fstream> using namespace std; int main() { string s1,s2; int sum1=1,sum2=1,i; ifstream fin ("ride.in"); ofstream fout ("ride.out"); fin>>s1>>s2; for(i=0;i<s1.size();i++) sum1*=s1[i]-64; for(i=0;i<s2.size();i++) sum2*=s2[i]-64; if((sum1%47)==(sum2%47)) fout<<"GO"<<endl; else fout<<"STAY"<<endl; fin.close(); fout.close(); return 0; }