use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); println!( "{}", s.lines() .map(|s| { if s == "NONE" { 256 } else { (16 - s.split(',').count()).pow(2) } }) .product::() ) }