In mathematics, the Fibonacci numbers, commonly denoted as fn, is a sequence such that each number is the sum of the two preceding numbers, starting with 1 and 1. That is, f1=1,f2=1 and fn=fn−2+fn−1 (n≥3).
Thus, the beginning of the sequence is 1,1,2,3,5,8,13,21,…
Given n, please calculate ∑ni=1∑nj=i+1g(fi,fj), where g(x,y)=1 when x⋅y is even, otherwise g(x,y)=0.
Input
The only line contains one integer n (1≤n≤109).
Output
Output one number – ∑ni=1∑nj=i+1g(fi,fj).
Examples
Input
3
Output
2
Input
10
Output
24
Input
100
Output
2739
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll n;
scanf("%lld",&n);
ll m=((n-1)*n)/2;
ll k=n/3*2;
if(n%3==1)
k+=1;
if(n%3==2)
k+=2;
k=((k-1)*k)/2;
cout<<m-k<<endl;
return 0;
}