use std::io::*; fn main() { let mut s: String = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let mut suma: i64 = 0; let mut sumb: i64 = 0; for _ in 0..n-1 { suma += itr.next().unwrap().parse::().unwrap(); sumb += itr.next().unwrap().parse::().unwrap(); } if suma == sumb { println!("{}", suma + 1); } else { println!("{}", (suma - sumb).abs()); } }