Олимпиадный тренинг

Задача 39807. DV-2022


Задача

Темы: ЕГЭ
The algorithm for calculating the value of the function F(n), where n – natural number, given by the following relations:

F(n) = 2 if n < 3;
F(n) = F(n - 1) + F(n - 2) - n if n > 2 and even;
F(n) = F(n - 2) - F(n - 1) + 2n if n > 2 and n odd.

Determine what is the value of the function F(30)?

Write only an integer in your answer.