#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main(){
    int temp;
    cin>>temp;
    string type;
    cin>>type;
    if(type!="Fahrenheit" && type!="Celsius"){
        cout<<"Invalid input";
    }
    else if(type=="Fahrenheit"){
        cout<<fixed<<setprecision(2)<<(temp * 9/5 ) + 32;
    }
    else{
        cout<<fixed<<setprecision(2)<<(temp - 32 )* 5/9;
    }
    return 0;
}