S001-AC.cc 514 Bytes
#include <iostream>

using namespace std;


long int gcd(long  a, long  b)
{
	long  res;
	while(b)
	{
		res = b;
		b = a % b;
		a = res;
	}
	return res;
}
long  mcm(long  a, long  b)
{
	return (a / gcd(a, b))*b;
}

int main()
{
	int n;
	long  a;
	long  b;
	while(1)
	{
		cin >> n;
		if(n)
		{
			if(n == 1)
			{
				cin >> a;
				cout << a << endl;
				continue;
			}
			cin >> a;
			for(int i = 0; i < n-1; i++)
			{
				cin >> b;
				a = mcm(a,b);
			}
			cout << a << endl;
		}
		else
		{
			return 0;
		}
	}
}