fork download
  1. #include <bits/stdc++.h>
  2. #define FOR(i, a, b) for(int i = (a), _b = (b); i <= _b; ++i)
  3. #define fi first
  4. #define se second
  5. #define el "\n"
  6. #define pb push_back
  7. #define sz(a) (int)a.size()
  8. #define FILL(a, x) memset(a, x, sizeof(a))
  9.  
  10. using namespace std;
  11. typedef unsigned long long ll;
  12. typedef pair<int, int> ii;
  13. const int N = (int)1e6+3, M = (int)1e9+7;
  14. ll n, m;
  15.  
  16. ll Mu(ll a, ll b){
  17. ll res = 1;
  18. a %= M;
  19. while(b != 0){
  20. if (b&1){
  21. res *= a;
  22. res %= M;
  23. }
  24. a *= a;
  25. a %= M;
  26. b /= 2;
  27. }
  28. return res;
  29. }
  30.  
  31.  
  32. int main()
  33. {
  34. ios_base::sync_with_stdio(false);
  35. cin.tie(NULL); cout.tie(NULL);
  36.  
  37. cin>>n>>m;
  38. cout<<Mu(Mu(1e6+2, (m-1)),(n-1));
  39. return 0;
  40. }
  41.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
614988640