#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dy[] = { 0, 0, 1, -1 };
int dx[] = { 1, -1, 0, 0 };
int const MOD = 1000000007;

namespace std {
	bool operator<(const P& a, const P& b) {
		return a.X != b.X ? a.X < b.X : a.Y < b.Y;
	}
}

int gcd(int a, int b) {
    if(a < b) swap(a, b);
    if(b == 0) return a;
    return gcd(b, a%b);
}
int lcm(int a, int b) {
    return a * b / gcd(a,b);
}

// fraction library (use C++11)
struct fraction{
    // init (nume / deno)
    int numerator, denominator;
    fraction(int i) : numerator(i), denominator(1) {}
    fraction(int i, int j) : numerator(i), denominator(j) {}
    fraction(string s) {
        int i = s.find('/');
        if(i != string::npos) {
            numerator = atoi(s.substr(0,i).c_str());
            denominator = atoi(s.substr(i+1).c_str());
        }
        else {
            numerator = atoi(s.c_str());
            denominator = 1;
        }
    }

    fraction fixshape(fraction A) {
        int p = A.denominator, q = A.numerator;
        if(p < 0) {p *= -1; q *= -1;}
        int k = gcd(abs(p), abs(q));
        p /= k, q /= k;
        A.denominator = p, A.numerator = q;
        return A;
    }
};

// print fraction
string printfrac(fraction A, int n) {
    if(!n) return to_string(A.numerator) + "/" + to_string(A.denominator);
    else {
        if(A.denominator == 1) return to_string(A.numerator);
        else return printfrac(A, 0);
    }
}

// overloading the arithmetic operators
fraction operator+(const fraction &A, const fraction &B) {
    int q = lcm(A.denominator, B.denominator);
    int p = A.numerator * (q / A.denominator) + B.numerator * (q / B.denominator);
    fraction ret = ret.fixshape(fraction(p, q));
    return ret;
}

fraction operator-(const fraction &A, const fraction &B) {
    int q = lcm(A.denominator, B.denominator);
    int p = A.numerator * (q / A.denominator) - B.numerator * (q / B.denominator);
    fraction ret = ret.fixshape(fraction(p, q));
    return ret;
}

fraction operator*(const fraction &A, const fraction &B) {
    int p = A.numerator * B.numerator;
    int q = A.denominator * B.denominator;
    int k = gcd(abs(p), abs(q));
    p /= k, q /= k;
    fraction ret = ret.fixshape(fraction(p, q));
    return ret;
}

fraction operator/(const fraction &A, const fraction &B) {
    fraction C = C.fixshape(fraction(B.denominator, B.numerator));
    fraction ret = ret.fixshape(A*C);
    return ret;
}
// fraction library end

signed main() {
	string s;
	while (cin >> s, s != "#") {
        int N = 0, W = 0;
		reverse(s.begin(), s.end());
        fraction F(1, 1);
        int cnt = -1;
        rep(i,0,s.length()) {
            int k = s.length() - i + 1;
            if(k >= 4) {
                string s1 = s.substr(i,4);
                if(s1 == "tsew") {
                    W++;
                    cnt++;
                    if(cnt == 0) F = fraction(90);
                    else {
                        fraction P(90, 1 << cnt);
                        F = F + P;
                    }
                }
            }

            if(k >= 5) {
                string s2 = s.substr(i,5);
                if(s2 == "htron") {
                    N++;
                    cnt++;
                    if(cnt == 0) F = fraction(0);
                    else {
                        fraction P(90, 1 << cnt);
                        F = F - P;
                    }
                }
            }
        }
        cout << printfrac(F,1) << endl;
	}
	return 0;
}

Measured memory_bytes: 3040