#![allow(non_snake_case)] use std::cmp; use std::io::{ self, prelude::* }; macro_rules! pick { ($tokens:expr) => { $tokens.next().unwrap().parse().expect("parse error") } } fn main() { let mut s = String::new(); io::stdin().read_to_string(&mut s).expect("i/o error"); let mut tokens = s.split_whitespace(); let x: u64 = pick!(tokens); let y: u64 = pick!(tokens); let x2: u64 = pick!(tokens); let y2: u64 = pick!(tokens); let ans = if x == y && x2 == y2 && x2 < x { x + 1 } else { cmp::max(x, y) }; println!("{}", ans); }