#include <iostream>
#include <fstream>
using namespace std;
ofstream g("cmmdcmc.out");
int cmmdc(int a,int b)
{
if(!b)
return a;
else
return cmmdc(b,a%b);
}
int main()
{
int b,CMMDC,CMMMC,P=1;
cin>>CMMDC>>b;
P=P*CMMDC*b;
if(CMMDC==-5 || b==-5)
{
cout<<"Nu se poate face cmmdc si cmmmc celor 2 numere";
return 0;
}
do
{
CMMDC=cmmdc(CMMDC,b);
cin>>b;
if(b!=-5)
P=P*b;
}while(b!=-5);
g<<CMMDC<<endl;
CMMMC=P/CMMDC;
g<<CMMMC<<endl;
return 0;
}