fn main() { let mut r = String::new(); std::io::stdin().read_line(&mut r).ok(); let r = r.trim().split(',').filter(|&s| s != "NONE").count(); let mut g = String::new(); std::io::stdin().read_line(&mut g).ok(); let g = g.trim().split(',').filter(|&s| s != "NONE").count(); let mut b = String::new(); std::io::stdin().read_line(&mut b).ok(); let b = b.trim().split(',').filter(|&s| s != "NONE").count(); println!("{}", (16 - r).pow(2) * (16 - g).pow(2) * (16 - b).pow(2)); }