import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long count = 0; static void breakIntoPieces(long n){ count += n; if(n==1) return; for(int i=2;i<(n/2);i++){ if(n%i==0){ breakIntoPieces(n/i); return ; } } } static long getMoves(long pieces){ long moves = 0L; if(pieces==1) moves++; else if(pieces == 2) moves+=3; else if((pieces%2)!=0) moves = moves + pieces + 1; else if((pieces%2)==0){ breakIntoPieces(pieces); moves += count; } return moves; } static long longestSequence(long[] a) { long total_moves = 0; for(int i=0;i