#include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

struct rational {
  ll n, d;

  rational(): n(0), d(1) {}
  rational(ll _n): n(_n), d(1) {}
  rational(ll _n, ll _d) {
    ll g = gcd(abs(_n), abs(_d));
    n = _n / g * (_d / abs(_d));
    d = abs(_d) / g;
  }

  rational operator+(rational r) const { return rational(n * r.d + d * r.n, d * r.d); }
  rational operator-(rational r) const { return rational(n * r.d - d * r.n, d * r.d); }
  rational operator+=(const rational &r) { return *this = *this + r; }
  rational operator-=(const rational &r) { return *this = *this - r; }

  static ll gcd(ll a, ll b) { return b != 0 ? gcd(b, a % b) : a; }
};

int main(void) {
  string S;
  while(cin >> S, S != "#") {
    ll n = S.size();

    rational ans;
    if(S.substr(n - 4, 4) == "west") {
      ans = rational(90);
      n -= 4;
    } else {
      ans = rational(0);
      n -= 5;
    }
    for(ll i = 1; n > 0; i++) {
      if(S.substr(n - 4, 4) == "west") {
        ans += rational(90, pow(2, i));
        n -= 4;
      } else {
        ans -= rational(90, pow(2, i));
        n -= 5;
      }
    }

    if(ans.d == 1) cout << ans.n << endl;
    else cout << ans.n << "/" << ans.d << endl;
  }
}
