//! Framework #![allow(non_snake_case)] #![allow(unused_imports)] use std::collections::*; pub struct Scan(Box>); // ' impl Scan { fn new() -> Self { let mut buf = String::new(); let read_line = move || { std::io::stdin().read_line(&mut buf).unwrap(); Box::leak(buf.split_off(0).into_boxed_str()).split_whitespace() }; Scan(Box::new(std::iter::repeat_with(read_line).flatten())) } pub fn word(&mut self) -> T { self.0.next().unwrap().parse().ok().unwrap() } pub fn list(&mut self, len: usize) -> Vec { std::iter::repeat_with(|| self.word()).take(len).collect() } } fn main() { let mut scan = Scan::new(); let A = scan.word::(); let B = scan.word::(); println!("{}", if A == B { A * 2 - 1 } else { A.min(B) * 2 }); }