#include <iostream>#include <cmath>
using namespace std;
int main(){
double x;
cin >> x;
cout << sin(x) + cos(x) + cos(2*x);
}