fn main() { let stdin = std::io::stdin(); let mut line = String::new(); stdin.read_line(&mut line).unwrap(); let h = line .split_whitespace() .next() .unwrap() .parse::() .unwrap(); let mut map: Vec> = vec![vec![]; h]; for i in 0..h { let mut line = String::new(); stdin.read_line(&mut line).unwrap(); map[i] = line.trim().as_bytes().to_vec(); } let w = map[0].len(); let mut result: Vec>> = vec![vec![vec![0; w + h + 1]; w]; h]; result[0][0][1] = 1; for i in 0..h { for j in 0..w { for current in 0..=w + h { if result[i][j][current] == 0 { continue; } if j + 1 < w { if map[i][j + 1] == b'o' { result[i][j + 1][current + 1] += result[i][j][current]; } else if map[i][j + 1] == b'x' && current > 0 { result[i][j + 1][current - 1] += result[i][j][current]; } } if i + 1 < h { if map[i + 1][j] == b'o' { result[i + 1][j][current + 1] += result[i][j][current]; } else if map[i + 1][j] == b'x' && current > 0 { result[i + 1][j][current - 1] += result[i][j][current]; } } } } } println!("{}", result[h - 1][w - 1].iter().sum::()); }