x=`sed 1d`.split.map(&:to_i).reduce:*;p x>8?x%9:x