import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { //final static long k = 1000000000000; //static long T[]= new long[k]; static long findMax(long a,long b){ return (a>b)?a:b; } static long findSeq(long num){ long T[] = new long[(int)num+1]; if(num==1){ return 1; } if(num==2){ return 3; } if(num==3){ return 4; } if(num>3){ T[0] = 0; T[1] = 1; T[2] = 3; T[3] = 4; for(int i=4;i<=num;i++){ long m = Integer.MIN_VALUE; for(int j=2;j<=(i/2);j++){ if(i % j == 0){ m = findMax(m,((i/j) * T[j])+1); } } if(m == Integer.MIN_VALUE){ m = i + 1; } T[i] = m; } } return T[(int)num]; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. // Solution.T[1] = 1; // Solution.T[2] = 3; // Solution.T[3] = 4; long sum = 0; for(int i=0;i