use std::io::*;fn main(){let mut a=[0;8];while stdin().read(&mut a).unwrap()==8{print!("{}",a[if(a[2]!=a[1]){4}else{1}-48);}}