func_code_string: #include <bits/stdc++.h>   using namespace std;   char n[1000100];   char b[1000100];   int main() {     long long result, last, i, B, c, BB[10];     int re, C;     while (scanf( %s %s %d , b, n, &C) != EOF) {       c = C;       B = 0;       for (i = 0; b[i]; i++) B = (B * 10 + b[i] -  0 ) % c;       if (B == 0) B = c;       BB[0] = 1;       for (i = 1; i < 10; i++) BB[i] = (BB[i - 1] * B) % c;       for (i = strlen(n) - 1; i >= 0; i--)         if (n[i] !=  0 ) break;       n[i]--;       for (i++; n[i]; i++) n[i] =  9 ;       result = 1;       for (i = 0; n[i]; i++) {         last = result;         result = (result * result) % c;         result = (result * result) % c;         result = (result * result) % c;         result = (result * last) % c;         result = (result * last) % c;         result = (result * BB[n[i] -  0 ]) % c;       }       result = (result * (B - 1)) % c;       if (result == 0) result = c;       re = result;       printf( %d n , re);     }     return 0;   }   