#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    vector<int> array;
    while(true){
        int x; cin >> x;
        if(!cin)
            break;
        array.push_back(x);
    }
    
    auto first = find_if(array.begin(), array.end(), [] (int x) { return x&1; });
    cout << *max_element(first, array.end(), [] (int largest, int x) {
        if(x & 1)
            return largest < x;
        else
            return false;
    });
    return 0;
}