#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0502"
#include <iostream>
#include <string>
#include "Mylib/IO/input_tuples.cpp"
#include "Mylib/Misc/dice.cpp"
namespace hl = haar_lib;
int main() {
int N;
while (std::cin >> N, N) {
auto d = hl::dice(1, 6, 2, 5, 3, 4);
int ans = 1;
for (auto [s] : hl::input_tuples<std::string>(N)) {
if (s == "North") d = d.rot_back(), ans += d.top;
if (s == "East") d = d.rot_right(), ans += d.top;
if (s == "West") d = d.rot_left(), ans += d.top;
if (s == "South") d = d.rot_front(), ans += d.top;
if (s == "Right") d = d.rot_clockwise(), ans += d.top;
if (s == "Left") d = d.rot_counterclockwise(), ans += d.top;
}
std::cout << ans << "\n";
}
return 0;
}
#line 1 "test/aoj/0502/main.test.cpp"
#define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0502"
#include <iostream>
#include <string>
#line 2 "Mylib/IO/input_tuples.cpp"
#include <initializer_list>
#line 4 "Mylib/IO/input_tuples.cpp"
#include <tuple>
#include <utility>
#include <vector>
#line 6 "Mylib/IO/input_tuple.cpp"
namespace haar_lib {
template <typename T, size_t... I>
static void input_tuple_helper(std::istream &s, T &val, std::index_sequence<I...>) {
(void) std::initializer_list<int>{(void(s >> std::get<I>(val)), 0)...};
}
template <typename T, typename U>
std::istream &operator>>(std::istream &s, std::pair<T, U> &value) {
s >> value.first >> value.second;
return s;
}
template <typename... Args>
std::istream &operator>>(std::istream &s, std::tuple<Args...> &value) {
input_tuple_helper(s, value, std::make_index_sequence<sizeof...(Args)>());
return s;
}
} // namespace haar_lib
#line 8 "Mylib/IO/input_tuples.cpp"
namespace haar_lib {
template <typename... Args>
class InputTuples {
struct iter {
using value_type = std::tuple<Args...>;
value_type value;
bool fetched = false;
int N, c = 0;
value_type operator*() {
if (not fetched) {
std::cin >> value;
}
return value;
}
void operator++() {
++c;
fetched = false;
}
bool operator!=(iter &) const {
return c < N;
}
iter(int N) : N(N) {}
};
int N;
public:
InputTuples(int N) : N(N) {}
iter begin() const { return iter(N); }
iter end() const { return iter(N); }
};
template <typename... Args>
auto input_tuples(int N) {
return InputTuples<Args...>(N);
}
} // namespace haar_lib
#line 3 "Mylib/Misc/dice.cpp"
namespace haar_lib {
struct dice {
int top, bottom, front, back, right, left;
dice() : top(), bottom(), front(), back(), right(), left() {}
dice(int top, int bottom, int front, int back, int right, int left) : top(top), bottom(bottom), front(front), back(back), right(right), left(left) {}
dice rot_left() const {
return dice(right, left, front, back, bottom, top);
}
dice rot_right() const {
return dice(left, right, front, back, top, bottom);
}
dice rot_front() const {
return dice(back, front, top, bottom, right, left);
}
dice rot_back() const {
return dice(front, back, bottom, top, right, left);
}
dice rot_clockwise() const {
return dice(top, bottom, right, left, back, front);
}
dice rot_counterclockwise() const {
return dice(top, bottom, left, right, front, back);
}
friend std::ostream &operator<<(std::ostream &s, const dice &a) {
s << "("
<< a.top << ", "
<< a.bottom << ", "
<< a.front << ", "
<< a.back << ", "
<< a.right << ", "
<< a.left << ")";
return s;
}
};
} // namespace haar_lib
#line 7 "test/aoj/0502/main.test.cpp"
namespace hl = haar_lib;
int main() {
int N;
while (std::cin >> N, N) {
auto d = hl::dice(1, 6, 2, 5, 3, 4);
int ans = 1;
for (auto [s] : hl::input_tuples<std::string>(N)) {
if (s == "North") d = d.rot_back(), ans += d.top;
if (s == "East") d = d.rot_right(), ans += d.top;
if (s == "West") d = d.rot_left(), ans += d.top;
if (s == "South") d = d.rot_front(), ans += d.top;
if (s == "Right") d = d.rot_clockwise(), ans += d.top;
if (s == "Left") d = d.rot_counterclockwise(), ans += d.top;
}
std::cout << ans << "\n";
}
return 0;
}