a="WSEN" print((a.index(input())-a.index(input()))%4)