Find the value of the function Y = ( X ^ 6 + X ^ 2 + 9894845 ) % 971 | computing ( a ^ b ) % c ; driver code
function modpow ( base , exp , modulus ) { base %= modulus ; let result = 1 ; while ( exp > 0 ) { if ( ( exp & 1 ) > 0 ) result = ( result * base ) % modulus ; base = ( base * base ) % modulus ; exp >>= 1 ; } return result ; } let n = 654654 ; let mod = 971 ; document . write ( ( ( modpow ( n , 6 , mod ) + modpow ( n , 2 , mod ) ) % mod + 355 ) % mod ) ;