#include <cmath>
#include <iostream>
using namespace std;
float calc(size_t i, size_t n){
float res = 0;
if( i < n )
res = res + sqrt(8 + ((i + 1) % 2 ? -1 : 1)*calc(i + 1, n));
else
res = ((i + 1) % 2 ? -1 : 1)*sqrt(8.0f);
return res;
}
int main(){
size_t n = 5;
float s = calc(0, n);
cout<<s<<endl;
return 0;
}