public class Solution {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        int a = Integer.MAX_VALUE;
        while (input.hasNext()){
            int b = input.nextInt();
            String s = input.nextLine();
            if(b < a){
                a = b;
            }  if(s.equalsIgnoreCase("E")){
                break;
            }
        }
        System.out.println(a);

    }
}