#include<iostream>
using namespace std;
int main()
{
    float a;
    cin>>a;
    string name;
    cin>>name;
    try
    {
        if(a<0 || a>100)
        {
            throw "Invalid input";
        }
        if(name=="Fahrenheit")
        {
            cout<<((a-32.0)*(5.0/9.0));
        }
        else if(name=="Celsius")
        {
            cout<<((a*(9.0/5.0))+32.0);
        }
        else
        {
            throw "Invalid input";
        }
    }
    catch(const char* msg)
    {
        cout<<fixed<<setprecision(2)<<msg;
    }
    return 0;
}