public static void main(String[] args)
	{
		boolean[] primes = new boolean[2000000];
		for (int i = 2; i < primes.length; i++)
			primes[i] = true;
		for (int i = 2; i < primes.length; i++)
			if (primes[i])
				for (int j = 2; i*j < primes.length; j++)
					primes[i*j] = false;
		ArrayList<Integer> primeList = new ArrayList<Integer>();
		for (int i = 5; i <= 1000000; i++)
			if (primes[i])
				primeList.add(i);
		int a = 1000000;
		while (true)
		{
			a++;
			if (primes[a])
			{
				primeList.add(a);
				break;
			}
		}
		
		long sum = 0L;
		for (int i = 0; i < primeList.size()-1; i++)
			sum += lowestMultiple(primeList.get(i),primeList.get(i+1));
		System.out.println(sum);
	}