void evenPower( int level, a, n; var int result; ) {
	int result1;
	if ( n == 0 )
		result = 1;
	else {
		power( level + 1, a, n / 2, result1 );
		result = result1 * result1;
		}
	}

void oddPower( int level, a, n; var int result; ) {
	int result1;
	if ( n == 1 )
		result = a;
	else {
		power( level + 1, a, n / 2, result1 );
		result = a * result1 * result1;
		}
	}

void power( int level, a, n; var int result; ) {
	if ( n / 2 * 2 == n )
		evenPower( level + 1, a, n, result );
	else
		oddPower( level + 1, a, n, result );
	}

int a = 3;
int n = 2;
int result;
power( 0, a, n, result );
println( result );
