import java.math.BigInteger; import java.util.Arrays; import java.util.Scanner; public class Main { void run() { Scanner sc=new Scanner(System.in); int n=sc.nextInt(); String[] a=new String[n]; for (int i=0;iLong.valueOf(v.toString())) continue; if (new BigInteger(v.toString()).isProbablePrime(10)) ans=Math.max(ans, Long.valueOf(v.toString())); } while (nextPermutation(ord)); System.out.println(ans); } boolean nextPermutation(int[] a) { int n=a.length; int p=n-1; while (p>0 && a[p-1]>a[p]) --p; if (p==0) return false; int q=p; while (q+1