public static void main(String[] args) {
		ArrayList<Integer> primes = new ArrayList<Integer>();
		for (int i = 0; i < isPrime.length; i++)
			if (isPrime[i])
				primes.add(i);

		int first = 0, second = 0, third = 0;
		for (int i = 0; i < primes.size(); i++)
			for (int j = i + 1; j < primes.size(); j++){
				int k = 2 * primes.get(j) - primes.get(i);
				if (k < 10000 && isPrime[k] && checkPermutation(primes.get(i), primes.get(j), k)){
					first = primes.get(i);
					second = primes.get(j);
					third = k;
					if (first != 1487)
						i = primes.size();
					break;
				}
			}
		System.out.println(first + "" + second + "" + third);
		// Solution: 296962999629
	}