#![allow(unused_imports)] use std::cmp::*; use std::collections::*; use std::io::Write; use std::ops::Bound::*; #[allow(unused_macros)] macro_rules! debug { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; } fn main() { let a = read::(); let b = read::(); let d = vec![ "N".to_string(), "E".to_string(), "S".to_string(), "W".to_string(), ]; let m = d .into_iter() .enumerate() .map(|(i, s)| (s, i)) .collect::>(); let mut a = m[&a]; let b = m[&b]; for i in 0..4 { if a == b { println!("{}", i); return; } a = (a + 1) % 4; } } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }