#include<iostream>
using namespace std;
int main()
{
    long float a,c,d,e;
    string b;
    try
    {
        cin>>a>>b;
        if(a<0 || a>100)
        {
            throw"Invalid input";
        }
        if(b=="Celsius")
        {
           c=a*1.8;
           e=c+32;
           cout<<e;
           
        }
        if(b=="Fahrenheit")
        {
           c=a-32;
           d=5/9;
           cout<<d<<endl;
           e=c*d;
           cout<<e;
          
        }
        cout<<"Invalid input";
    }
    catch(const char*msg)
    {
        cout<<msg;
    }
}