#include <iostream>
using namespace std;

int main() {
    int tr, tc;
    string cond;
    cin>>tr>>tc;
    cin>>cond;
    if((tr>=tc&&cond=="freeze")||(tr<=tc&&cond=="heat")||cond=="auto"){
        cout<<tc;
    }else cout<<tr;
    }
