main = interact $ unlines . map nnw . init . lines

nnw str
 | t == 1 = if str == "north" then "0" else "90"
 | t == 2 = if str == "northwest" then "45" else "315"
 | otherwise = if head (reverse str) == 't' then "45/" ++ show (2^(t-2)) else "315/" ++ show (2^(t-2))
 where t = length (filter (=='t') str)