import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long moves(long k){ if (k==1) return 1; long moves = k+1; int counter = 0; while (k>1 && counter < 2){ long j = 2; counter++; while(j<=Math.sqrt(k)) { if(k%j == 0){ moves = moves + k/j; k = k/j; counter = 0; break; } j++; } } return moves; } static long longestSequence(long[] a) { // Return the length of the longest possible sequence of moves. long sum = 0; for (int i=0; i