fn main() { let mut ab = String::new(); std::io::stdin().read_line(&mut ab).ok(); let ab: Vec = ab.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let a = ab[0]; let b = ab[1]; let mut dp: Vec> = vec![vec![false; 601]; a+b+1]; dp[0][0] = true; for i in 0..a { for j in 0..601 { dp[i+1][j] |= dp[i][j]; if j >= 1 { dp[i+1][j] |= dp[i][j-1]; } } } for i in a..a+b { for j in 0..601 { dp[i+1][j] |= dp[i][j]; if j >= 5 { dp[i+1][j] |= dp[i][j-5]; } } } dp[a+b].iter().enumerate().skip(1).filter(|pair| *pair.1).for_each(|pair| { println!("{}", pair.0); }); }