#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int main()
{
    double temp;
    string type;
    cin>> temp;
    cin>>type;
    try
    {
        double result;
        if(type == "Celcius")
        {
            result = (temp*9.0/5.0)+32.0;       
            
        }
    else if(type == "Fahrenheit")
    {
        result = (temp-32.0)*5.0/9.0;
    }
    else
    {
        throw "Invalid";
    }
    cout<<fixed<<setprecision(2)<<result;
}

catch(const char*)
{
    cout <<"Invalid input";
}
return 0;