logo AlgoBeat OnlineJudge
登录 注册

#209359. [ICPC 2020 Shanghai R] Fibonacci

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

In mathematics, the Fibonacci numbers, commonly denoted as , is a sequence such that each number is the sum of the two preceding numbers, starting with and . That is, and .

Thus, the beginning of the sequence is .

Given , please calculate , where when is even, otherwise .

输入格式

The only line contains one integer .

输出格式

Output one number -- .

样例

样例输入 1

3

样例输出 1

2

样例输入 2

10

样例输出 2

24

样例输入 3

100

样例输出 3

2739