100 atcoder#ABC129F. [ABC129F] Takahashi's Basics in Education and Learning
[ABC129F] Takahashi's Basics in Education and Learning
Score : points
Problem Statement
There is an arithmetic progression with terms: .
The initial term is , and the common difference is . That is, holds.
Consider the integer obtained by concatenating the terms written in base ten without leading zeros. For example, the sequence would be concatenated into . What is the remainder when that integer is divided by ?
Constraints
- All values in input are integers.
- All terms in the arithmetic progression are less than .
Input
Input is given from Standard Input in the following format:
Output
Print the remainder when the integer obtained by concatenating the terms is divided by .
5 3 4 10007
5563
Our arithmetic progression is , so the answer is mod , that is, .
4 8 1 1000000
891011
107 10000000000007 1000000000000007 998244353
39122908