#include <iostream>
#include <cmath>

using namespace std;

const int MOD = 50;

long long pow(long long a, int b)
{
    long long r = 1;
    while (b)
    {
        if (b & 1)
            r = (r * a) % MOD;
        b >>= 1;
        a = (a * a) % MOD;
    }
    return r;
}

int main()
{
    cout << pow(3, 4) << "\n";
	return 0;
}
