#!/usr/bin/python
#
# Project Euler Problem 48
# The series, 1^(1) + 2^(2) + 3^(3) + ... + 10^(10) = 10405071317.
# Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.

sum = 0
for n in range(1000, 0, -1):
    sum += n**n
print sum % (10**10)