#include #define int long long using namespace std; signed main() { int N,M; cin>>N; std::vector A(N); for(int i=0;i>A[i]; cin>>M; std::vector B(M); for(int i=0;i>B[i]; int k1,k2; k1=A[0]; k2=1; for(int i=1;i0)&&(k2<0))mi=-1; if((k1<0)&&(k2>0))mi=-1; k1=abs(k1); k2=abs(k2); for(int i=2;i*i<=min(k1,k2);i++){ if(k1%i==0&&k2%i==0){ k1/=i; k2/=i; i=1; } } if(mi==-1)cout<<"-"; cout<