Inaho VI

View as PDF

Submit solution


Points: 10 (partial)
Time limit: 1.0s
Memory limit: 32M

Author:
Problem types

Inaho is very close to home! After leaving the N-dimensional hole through the first gate, he arrives at another gate. On this gate is a natural number and two floating-point combination locks. Between the first and second lock is a + sign, and next to the second lock is the letter i. Strange. Extremely tired from travelling through the N-dimensional hole, Inaho asks you to tell him what to set each combination lock to. However, if you tell him the wrong answer, Inaho will be sent back into the N-dimensional hole, and he will be very mad at you!

Inaho does have a few hints for you, though. He suspects that the solution to the locks has something to do with complex numbers. More specifically, he suspects that the solution to the two locks require the x-th tetration of i (otherwise known as i \mathbin{\uparrow\uparrow} x or {}^xi) where i is the imaginary unit.

The x-th tetration of i can be defined as:

f(x) = \begin{cases} i^{f(x-1)} & \text{if } x > 0 \\ 1 & \text{if } x = 0 \end{cases}

where only the principal branch of the natural logarithm is used.

Input Specification

The first line will contain the integer x (0 \le x \le 10^{17}).

Subtasks

For 1 of the 10 available marks, x \le 1.

For an additional 1 of the 10 available marks, x \le 3.

For an additional 1 of the 10 available marks, x \le 10^6.

Output Specification

On the first line, output the real component of the x-th tetration of i.

On the second line, output the imaginary component of the x-th tetration of i.

Outputs with a relative or absolute error of 10^{-4} will be accepted.

Sample Input

1

Sample Output

0.0000
1.0000
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation.

Comments

There are no comments at the moment.