#P1195D1. Submarine in the Rybinsk Sea (easy edition)
Submarine in the Rybinsk Sea (easy edition)
No submission language available for this problem.
Description
This problem differs from the next one only in the presence of the constraint on the equal length of all numbers . Actually, this problem is a subtask of the problem D2 from the same contest and the solution of D2 solves this subtask too.
A team of SIS students is going to make a trip on a submarine. Their target is an ancient treasure in a sunken ship lying on the bottom of the Great Rybinsk sea. Unfortunately, the students don't know the coordinates of the ship, so they asked Meshanya (who is a hereditary mage) to help them. He agreed to help them, but only if they solve his problem.
Let's denote a function that alternates digits of two numbers , where and are digits of two integers written in the decimal notation without leading zeros.
In other words, the function alternately shuffles the digits of the numbers and by writing them from the lowest digits to the older ones, starting with the number . The result of the function is also built from right to left (that is, from the lower digits to the older ones). If the digits of one of the arguments have ended, then the remaining digits of the other argument are written out. Familiarize with examples and formal definitions of the function below.
For example:
Formally,
- if then ;
- if then .
Mishanya gives you an array consisting of integers . All numbers in this array are of equal length (that is, they consist of the same number of digits). Your task is to help students to calculate modulo .
The first line of the input contains a single integer () — the number of elements in the array. The second line of the input contains integers () — the elements of the array. All numbers are of equal length (that is, they consist of the same number of digits).
Print the answer modulo .
Input
The first line of the input contains a single integer () — the number of elements in the array. The second line of the input contains integers () — the elements of the array. All numbers are of equal length (that is, they consist of the same number of digits).
Output
Print the answer modulo .