Hide

Problem I
Trailing Digits

Languages en is

You are given a positive integer $n$ and should print the last ten digits of $1^1 + 2^2 + 3^3 + \dots + n^n$.

Input

The first and only line of input contains a positive integer $10 \leq n \leq 10^{7}$.

Output

Print the last ten digits of $1^1 + 2^2 + 3^3 + \dots + n^n$. Do not print it with extra leading zeroes, even though the program might then print less than ten digits.

Sample Input 1 Sample Output 1
1000
9110846700