Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- #define ulli unsigned long long int
- #define modulo 1000000007
- ifstream cin("rogvaiv.in");
- ofstream cout("rogvaiv.out");
- ulli pow(ulli n, ulli putere) {
- if(n == 1 || putere == 0) {
- return 1;
- }
- if(putere == 1) {
- return n;
- }
- if(putere % 2)
- return 1LL * (n % modulo) * 1LL * (pow(n, putere - 1) % modulo);
- return (1LL * pow(n, putere / 2) % modulo) * (1LL * pow(n, putere / 2) % modulo);
- }
- int main(void) {
- ulli num;
- cin >> num;
- num %= 1000000006;
- cout << pow(7, num) % modulo;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement