#include<iostream>
#include<math.h>
#include<iomanip>
using namespace std;
int main()
{
float x, y, sum;
int a;
cin >> x >> y >> a;
sum = x + a % 3 * int(x + y) % 2 / 4;
cout << fixed << setprecision(2) << sum << endl;
/*
笔记:
保留小数函数在iomanip头文件中,c++中不同写法有区别
:写成cout<<setiosflags(ios::fixed)<<setprecision(n)<<f;之后的保留小数都是这种保留方式;
第二种是cout<<fixed<<setprecision(n)<<f;这种是第一种的简化版,比较好写。
*/
return 0;
}