Page not loading? Try clicking here.
Placeholder

#6193

제곱수의 합의 마지막 자릿수 1s 32MB

Problems

1 \times 1 + 2 \times 2 + \dots + N \times N의 마지막 자리의 숫자(1의 자릿수)는 얼마인가?


Input

첫 줄에 정수 N이 주어진다. (1 \le N \le 10^{18})


Subtask

# Score Condition
#130

N \le 120

#230

N \le 100,000

#340

추가 제한 없음


Example

120
0

Source

KOI 시도예선 수학 2013 초등부 2번

You must sign in to write code.