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