import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long[] dp=new long[1000001]; static void fill() { dp[1]=1; for(int i=2;i<1000001;i++){ long max=Long.MIN_VALUE; for(int j=1;j*j<=i;j++){ if(i%j==0){ if((dp[j]*(i/j))+1>max){ max=dp[j]*(i/j)+1; } int val=i/j; if((dp[val]*(i/val))+1>max){ max=dp[val]*(i/val)+1; } } dp[i]=max; } } } static long longestSequence(int[] a) { long sum=0; for(int i=0;i