{"problem":{"name":"Takahashi's Basics in Education and Learning","description":{"content":"There is an arithmetic progression with $L$ terms: $s_0, s_1, s_2, ... , s_{L-1}$. The initial term is $A$, and the common difference is $B$. That is, $s_i = A + B \\times i$ holds. Consider the intege","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":3000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc129_f"},"statements":[{"statement_type":"Markdown","content":"There is an arithmetic progression with $L$ terms: $s_0, s_1, s_2, ... , s_{L-1}$.\nThe initial term is $A$, and the common difference is $B$. That is, $s_i = A + B \\times i$ holds.\nConsider the integer obtained by concatenating the terms written in base ten without leading zeros. For example, the sequence $3, 7, 11, 15, 19$ would be concatenated into $37111519$. What is the remainder when that integer is divided by $M$?\n\n## Constraints\n\n*   All values in input are integers.\n*   $1 \\leq L, A, B < 10^{18}$\n*   $2 \\leq M \\leq 10^9$\n*   All terms in the arithmetic progression are less than $10^{18}$.\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$L$ $A$ $B$ $M$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc129_f","tags":[],"sample_group":[["5 3 4 10007","5563\n\nOur arithmetic progression is $3, 7, 11, 15, 19$, so the answer is $37111519$ mod $10007$, that is, $5563$."],["4 8 1 1000000","891011"],["107 10000000000007 1000000000000007 998244353","39122908"]],"created_at":"2026-03-03 11:01:14"}}