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 n 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.