Language: C++

#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e18 + 3)
template<class T> bool chmax(T &a,  T b) {if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a,  T b) {if(a>b){a=b; return 1;} return 0;}
int MOD;
void myprint(int* A,int A_num){
   REP(i,A_num) cout << A[i] << " ";
   cout << endl;
}



void zero_mat(vector<vector<int>> &ass) {
  int M = ass.size(), N = ass[0].size();
  REP(i,M) {
    REP(j,N) {
      ass[i][j] = 0;
    }
  }
}

void zero_vec(vector<int> &as) {
  int N = as.size();
  REP(i,N) {
    as[i] = 0;
  }
}


void identity_mat(vector<vector<int>> &ass) {
   int  N = ass.size();
  REP(i,N) {
    REP(j,N){
      ass[i][j] = i == j;
    }
  }
}


void copy_mat(const vector<vector<int>> &from, vector<vector<int>> &to) {
  int M = from.size(), N = from[0].size();
  REP(i,M){
    REP(j,N) {
      to[i][j] = from[i][j];
    }
  }
}

void copy_vec(const vector<int> &from, vector<int> &to) {
  int N = from.size();
  REP(i,N) {
    to[i] = from[i];
  }
}


void mat_mult_mat(const vector<vector<int>> &ass,
                  const vector<vector<int>> &bss, vector<vector<int>> &css) {
  int L = ass.size(), M = ass[0].size(), N = bss[0].size();
  // initialize
  zero_mat(css);
  // calculate
  REP(i,L) {
    REP(k,M) {
      REP(j,N) {
        css[i][j] = (css[i][j] + (ass[i][k] * bss[k][j] % MOD) ) % MOD;
      }
    }
  }
}


void mat_mult_vec(const vector<vector<int>> &ass, const vector<int> &bs,
                  vector<int> &cs) {
  int M = ass.size(), N = ass[0].size();
  zero_vec(cs);
  REP(i,M) {
    REP(j,N) {
      cs[i] = ((ass[i][j] * bs[j] % MOD) + cs[i]) % MOD;
    }
  }
}


void mat_pow(const vector<vector<int>> &ass, long k, vector<vector<int>> &bss){
  int N = ass.size();
  // initialize
  identity_mat(bss);
  // calculate
  vector<vector<int>> xss(N, vector<int>(N, 0)), tss(N, vector<int>(N, 0));
  copy_mat(ass, xss);
  while (k > 0) {
    if (k % 2) {
      mat_mult_mat(bss, xss, tss);
      copy_mat(tss, bss);
    }
    k /= 2;
    mat_mult_mat(xss, xss, tss);
    copy_mat(tss, xss);
  }
}

void print_mat(vector<vector<int>> &a){
    int N = a.size(),M = a[0].size();
    REP(i,N){
        REP(j,M){
            cout << a[i][j] << " ";
        }
        cout << endl;
    } 
}

void print_vec(vector<int> &a){
    int N = a.size();
    REP(i,N){
        cout << a[i] << endl;
    }
}


int pow(int x, int k) {
  int ret = 1, p = x;
  while (k > 0) {
    if (k & 1) {
      ret = ret * p;
      ret %= MOD;
    }
    p = p * p;
    p %= MOD;
    k /= 2;
  }
  return ret;
}


signed main(){
    int l,a,b;
    cin >> l >> a >> b >> MOD;

    int ans = 0;
    int kijun = 1;
    int from = 0;
    int to = - 1;
    int keta = 1;
    int ketawa = 0;
    while(1){
        if(kijun > a + b * (l - 1)) break;
        if(kijun <= a + b * from and kijun  > (a + b * from) / 10){
            to = (kijun * 10 - a - 1) / b;
            to ++;
            to = min(to,l);
            vector< vector<int>> A(3,vector<int>(3,0)),B(3,vector<int>(3,0));
            A[0][0] = kijun * 10 % MOD;
            A[0][1] = 1;
            A[0][2] = 0;
            A[1][0] = 0;
            A[1][1] = 1;
            A[1][2] = b;
            A[2][0] = 0;
            A[2][1] = 0;
            A[2][2] = 1;
            
            mat_pow(A,to - from,B);
            int summ = B[0][1] * ( (b * (from) + a) % MOD);
            summ %= MOD;
            summ += ( B[0][2]) % MOD;
            summ %= MOD;
            ans *= rui(10,keta * (to - from));
            ans %= MOD;
            ans += summ;
            ans %= MOD;

            from = to;
        }
        if(to == l) break;
        kijun *= 10;
        keta ++;
    }
    cout << ans << endl;





}

Compiler output:
a.cc: In function 'int main()':
a.cc:188:20: error: 'rui' was not declared in this scope
  188 |             ans *= rui(10,keta * (to - from));
      |                    ^~~