#C5706. First Digit in Powers

    ID: 49385 Type: Default 1000ms 256MiB

First Digit in Powers

First Digit in Powers

Given a positive integer n, consider the sequence of powers of n starting from n1, n2, n3, and so on. In each power, the digits are produced in order from left to right. Your task is to determine the first digit that appears in this sequence. Note: according to the procedure the answer is simply the first digit of n1.

Examples:

  • For n = 3, 3^1 = 3, so the first digit is 3.
  • For n = 10, 10^1 = 10, so the first digit is 1.
  • For n = 5, 5^1 = 5, so the first digit is 5.
  • For n = 2, 2^1 = 2, so the first digit is 2.
  • For n = 999, 999^1 = 999, so the first digit is 9.

This problem may look trivial, but it is designed to test your ability to parse input and output correctly using standard streams.

inputFormat

The input consists of a single line containing one positive integer n (1 ≤ n ≤ 109).

outputFormat

Output a single digit – the first digit of n1.

## sample
3
3