Language: C++

#include "bits/stdc++.h"
using namespace std;

//?????????
#pragma region MACRO 
#define putans(x)  std::cerr << "answer: " ; cout << (x) << endl
#define dputans(x) std::cerr << "answer: "; cout << setprecision(10) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(n-1); i>= a; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define mp make_pair
#define exist(container, n) ((container).find((n)) != (container).end())
#define substr(s,i,l) string((s), (i), (l))
#define tos(x) (to_string((x)))
#ifdef _DEBUG //???????????????????????????????????????????????????
std::ifstream ifs("data.txt");
#define p ifs >>
#else //?????£????????????????????§?????????????????????
#define put cin >>
#endif
#pragma endregion

//???????????°??????????????´
#pragma region CODING_SUPPORT
#define dbg(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
#define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
#define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;} 
#ifndef _DEBUG
#define dbg1 {}
#define dbg2 {}
#define dbg3 {}
#define dbgArray {}
#endif 
#pragma endregion 
//typedef????????????????????????????¶????????????§?????????
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii; typedef pair<string, string> pss; typedef pair<int, string>pis;
typedef vector<string> vs; typedef vector<int> vi;
#pragma endregion
//??????????????°(???????????????????????§??????)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(1e9)
#pragma endregion

ll power(ll m,ll n, ll mod = MOD ){
	ll ans = 0;
	ll mbin = m;
	for (int i = 1 ; i <= n; i *= 2) {
		if ((n & i) != 0) {
			ans += mbin; ans %= mod;
		}
		mbin = (mbin * mbin) % mod;
	}
	return ans;
}

int main() {
	int m, n; p m >> n;
	putans(power(m, n));
	return 0;
}

/*
#define i(x) int x; scanf("%d",&x);
#define l(x) ll x; scanf("%lld",&x);
#define d(x) double  x; scanf("%lf",&x);
*/
//??????????£?????????°???
//https://www23.atwiki.jp/akitaicpc/pages/65.html

Compiler output:
a.cc:33:9: warning: "dbg2" redefined
   33 | #define dbg2 {}
      |         ^~~~
a.cc:28:9: note: this is the location of the previous definition
   28 | #define dbg2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg(var1); }
      |         ^~~~
a.cc:34:9: warning: "dbg3" redefined
   34 | #define dbg3 {}
      |         ^~~~
a.cc:29:9: note: this is the location of the previous definition
   29 | #define dbg3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; dbg2(var1, var2); }
      |         ^~~~
a.cc:35:9: warning: "dbgArray" redefined
   35 | #define dbgArray {}
      |         ^~~~~~~~
a.cc:30:9: note: this is the location of the previous definition
   30 | #define dbgArray(a,n) {std::cerr << (#a) << "=";  rep(i,n){std::cerr <<(a[i])<<",";} cerr<<endl;}
      |         ^~~~~~~~
a.cc: In function 'int main()':
a.cc:65:19: error: 'p' was not declared in this scope
   65 |         int m, n; p m >> n;
      |                   ^