Iterate over the prime divisors
for ( Map . Entry < Integer , Integer > itr : prime . entrySet ( ) ) { int val = power ( itr . getKey ( ) , ( itr . getValue ( ) ) * ( itr . getValue ( ) + 1 ) / 2 , MOD ) ;