Final Power Digits

The sum 1^1 + 2^2 + 3^3 + ... + n^n becomes enormous very quickly. Write a function self_powers_last10 that returns only the last 10 digits of this sum. It is helpful to think of this as taking the sum modulo 10^10. Return the result as an integer.

Примеры

Ввод
10
Вывод
405071317
Ввод
1000
Вывод
9110846700
Ввод
1
Вывод
1

Нужно реализовать

def self_powers_last10(n: int) -> int:

Теги

math
PostgreSQLv16

Šeit parādīsies koda izpildes rezultāts

Visible tests
1
Input
10
Expected405071317
2
Input
1000
Expected9110846700
3
Input
1
Expected1
4
Input
3
Expected32
5
Input
2
Expected5
6
Input
999999
Expected4077562500
Focus radio
Paused · SomaFM · Fluid