unittest
{
	assert( [ "3", "2 3 4" ].parse.expand.solve == 13 );
	assert( [ "5", "12 12 12 12 12" ].parse.expand.solve == 5 );
	assert( [ "3", "1000000 999999 999998" ].parse.expand.solve == 996989508 );
}



import std.algorithm;
import std.conv;
import std.numeric;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	auto ans = 0L;
	
	// asの最小公倍数を計算
	auto m = 1L;
	foreach( a; as )
	{
		m = lcm( m, a );
	}
	
	// bsを計算
	auto bs = new long[ as.length ];
	foreach( ref b, a; lockstep( bs, as ) )
	{
		b = m / a;
	}
	return bs.reduce!addMod;
}

// 最小公倍数
auto lcm( long x, long y )
{
	return x * y / x.gcd( y );
}

// 足し算
auto addMod( long MOD = 10L ^^ 9 + 7 )( long x, long y )
{
	return ( x + y ) % MOD;
}
