Language: Java

 class Main {
	 static int mod =  (int) (Math.pow(10,9)+7);
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
    public static void main(String[] args) {
    
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        
        int[][] ap= new int[N][1000];
        
        
        
        long[] a = new long[(int)N];
        long[] s = new long[(int)N];
        for (int i=0 ; i<N; i++) {
            a[i] = sc.nextLong();
        }
        Arrays.sort(a);
        for (int i=0 ; i<N; i++) {
            s[i] = modinv(a[i]);
        }
        
        boolean[] m = new boolean[1000];
        int[] p = new int[1000];
        int k=0;
        for(int i=2;i<1000;i++) {
        	if(m[i]==false) {
        		p[k]=i;
        		k++;
        		for(int j=i;j<1000;j=j+i) {
        			m[j]=true;
        		}
        	}
        }
        
        long tmp=0;
        long lcm=1;
        for(int i=0;i<N;i++) {
        	tmp=a[i];
    		for(int j=0;j<k;j++) {
    			if(tmp%p[j]==0) {
    				while(tmp%p[j]==0) {
    					tmp=tmp/p[j];
            			ap[i][j]++;
    				}
    			}
        	}
    		if(tmp!=1&&(i==0||a[i-1]!=a[i])) {
    			lcm=lcm*tmp%mod;
    		}
        }
        
        int[] max= new int[1000000];
        for(int i=0;i<k;i++) {
        	for(int j=0;j<N;j++) {
        		max[i]=Math.max(max[i], ap[j][i]);
        	}
        	lcm=(long) (lcm*(Math.pow(p[i],max[i]))%mod);
        }
        
        
        long sum=0;
        long b=0;
        for(int i=0;i<N;i++) {
        	b=(lcm*s[i])%mod;
        	sum=(sum+b)%mod;
        }
        
        System.out.println(sum);  	
               		
    }
	public static long pow(long a,long n) {
	    long res=1;
	    while (n>0) {
	        if ((n-n/2*2)==1) {
	            res=(res*a)%mod;
	        }
	        a=(a*a)%mod;
	        n>>=1;
	    }
	    return res;
	}
 
	public static long modinv(long n) {
		return pow(n, mod-2);
	}
    
}

Compiler output:
Main.java:3: error: cannot find symbol
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
	        ^
  symbol:   class List
  location: class Main
Main.java:3: error: cannot find symbol
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
	             ^
  symbol:   class ArrayList
  location: class Main
Main.java:3: error: cannot find symbol
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
	                                             ^
  symbol:   class ArrayList
  location: class Main
Main.java:3: error: cannot find symbol
	 static List<ArrayList<Integer>>  list = new ArrayList<ArrayList<Integer>>();
	                                                       ^
  symbol:   class ArrayList
  location: class Main
Main.java:6: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
        ^
  symbol:   class Scanner
  location: class Main
Main.java:6: error: cannot find symbol
        Scanner sc = new Scanner(System.in);
                         ^
  symbol:   class Scanner
  location: class Main
Main.java:18: error: cannot find symbol
        Arrays.sort(a);
        ^
  symbol:   variable Arrays
  location: class Main
7 errors