The first digit of the power#1249

The first digit of the power

1 second
128 megabytes
Easy

You are given a very simple problem: "What is the first digit of the number n^n?"

Input

The input consists of several test cases. Each test case is given on a separate line and contains a single integer (1 \le n \le 10^9).

Output

For each test case, print on a separate line the first digit of the result.

Examples

Example 1

Loading
Loading