#include using ll = long long; using llu = long long unsigned; using namespace std; int main() { int A, B; cin >> A >> B; map data; data['E'] = 0; data['S'] = 1; data['W'] = 2; data['N'] = 3; int result = data[B] - data[A] + 4; result %= 4; cout << result << endl; return 0; }