Pagini recente » Cod sursa (job #1950511) | Monitorul de evaluare | Cod sursa (job #1850685)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
const int MOD = 2e9 - 27;
namespace utils {
template <typename _type>
inline int product(_type first) {
return first;
}
template <typename _type, typename... _args>
inline int product(_type first, _args... args) {
return (1LL * first * utils::product(args...)) % MOD;
}
inline int pow(int a, int b) {
if (b == 0) {
return 1;
}
int half = pow(a, b / 2);
if (b % 2) {
return product(half, half, a);
}
return product(half, half);
}
}
int a, b;
int main() {
fin >> a >> b;
fout << utils::pow(a, b) << '\n';
return 0;
}