func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   void _R(T &x) {     cin >> x;   }   void _R(int &x) { scanf( %d , &x); }   void _R(int64_t &x) { scanf( %lld , &x); }   void _R(double &x) { scanf( %lf , &x); }   void _R(char &x) { scanf(  %c , &x); }   void _R(char *x) { scanf( %s , x); }   void R() {}   template <class T, class... U>   void R(T &head, U &...tail) {     _R(head);     R(tail...);   }   template <class T>   void _W(const T &x) {     cout << x;   }   void _W(const int &x) { printf( %d , x); }   void _W(const int64_t &x) { printf( %lld , x); }   void _W(const double &x) { printf( %.16f , x); }   void _W(const char &x) { putchar(x); }   void _W(const char *x) { printf( %s , x); }   template <class T, class U>   void _W(const pair<T, U> &x) {     _W(x.first);     putchar(   );     _W(x.second);   }   template <class T>   void _W(const vector<T> &x) {     for (auto i = x.begin(); i != x.end(); _W(*i++))       if (i != x.cbegin()) putchar(   );   }   void W() {}   template <class T, class... U>   void W(const T &head, const U &...tail) {     _W(head);     putchar(sizeof...(tail) ?     :   n );     W(tail...);   }   int MOD = 1e9 + 7;   void ADD(long long &x, long long v) {     x = (x + v) % MOD;     if (x < 0) x += MOD;   }   const int SIZE = 1e6 + 10;   const int MATRIX_SIZE = 500;   long long mypow(long long x, long long y) {     x %= MOD;     long long res = 1 % MOD;     while (y) {       if (y & 1) res = res * x % MOD;       y >>= 1;       x = x * x % MOD;     }     return res;   }   struct Matrix_Power {     long long AA[60][MATRIX_SIZE][MATRIX_SIZE], aa[62][MATRIX_SIZE];     int N;     void set(long long _A[][MATRIX_SIZE], int _N,              long long bb = (long long)1e18) {       N = _N;       for (int i = 0; i < (N); ++i)         for (int j = 0; j < (N); ++j) AA[0][i][j] = _A[i][j];       for (int round = (1); round < (60); ++round) {         if ((1LL << round) > bb) break;         for (int i = 0; i < (N); ++i)           for (int j = 0; j < (N); ++j) AA[round][i][j] = 0;         for (int i = 0; i < (N); ++i)           for (int j = 0; j < (N); ++j)             for (int k = 0; k < (N); ++k) {               AA[round][i][k] += AA[round - 1][i][j] * AA[round - 1][j][k];               AA[round][i][k] %= MOD;             }       }     }     long long get(long long _a[], long long v) {       memset((aa), 0, sizeof((aa)));       for (int i = 0; i < (N); ++i) aa[0][i] = _a[i];       for (int i = 0; i < (61); ++i) {         if ((1LL << i) > v) return aa[i][N - 1];         if ((v >> i) & 1) {           for (int j = 0; j < (N); ++j)             for (int k = 0; k < (N); ++k) {               aa[i + 1][j] += AA[i][j][k] * aa[i][k];               aa[i + 1][j] %= MOD;             }         } else           for (int j = 0; j < (N); ++j) aa[i + 1][j] = aa[i][j];       }       return -1;     }   } mat;   long long A[1000][MATRIX_SIZE];   long long a[SIZE];   int main() {     MOD = 1000003;     int c, w, h;     R(c, w, h);     for (int i = 0; i < (w + 1); ++i) {       if (i < w)         A[i][i + 1] = 1;       else {         for (int j = 0; j < (w + 1); ++j) A[i][i - j] = mypow(h, j);       }     }     a[w - 1] = a[w] = 1;     mat.set(A, w + 1, c * 2);     W(mat.get(a, c));     return 0;   }   