아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

패스 순서

시간 제한1초메모리 제한16 MB

요약
앞 두 항으로 다음 항이 이전 두 항 차이의 절댓값이 되는 수열을 만들 때 K번째 항을 구합니다.
난이도

보통10점 중 7점

유형
정수론, 시뮬레이션
정답자
아직 제출이 없습니다

문제

During the World Cup 2014 qualifications, Serbia national football team had an interesting strategy. They were starting each attack by passing the ball from the player with the number N1 to the player with the number N2. Each following pass was to the player whose number equals the absolute value of the difference between the numbers of the two players previously having the ball. More formally, after the player Ni-2 passes the ball to the player Ni-1, the next player to receive the ball is the player Ni = |Ni-2 – Ni-1|.

This strategy, surprisingly, did not prove itself to be a useful one. Nevertheless, it made fans ponder who will be the K-th player to get the ball, given that the attack actually lasts long enough.

입력

The single line of input contains three non-negative integers, N1, N2, and K.

출력

The single line of output should contain the number Nk.

제한

  • 0 ≤ N1, N2 < 263
  • 1 ≤ K < 263

힌트

The players received the ball in the following order:

37, 16, 21, 5, 16, 11, 5, 6, 1, 5, 4, 1, 3, 2, 1, 1, 0, 1, 1, 0, …

The eight player to receive the ball is the player with the number 6.

예제4

  1. 예제 1

    입력
    37 16 8
    
    예상 출력
    6
    
  2. 예제 2

    입력
    17254968996716914 5030751795369479754 2731091466
    
    예상 출력
    2019640987948
    
  3. 예제 3

    입력
    0 1 3
    
    예상 출력
    1
    
  4. 예제 4

    입력
    1 1 5
    
    예상 출력
    1