#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int, int> P;

int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);

    string s;
    while (cin >> s, s[0] != '#') {
        string t;
        rep(i, s.size()) {
            if (s[i] == 'n' || s[i] == 'w') {
                t += s[i];
            }
        }
        reverse(all(t));
        int numer = t[0] == 'w';
        int denom = 1;
        rep2(i, 1, t.size()) {
            numer *= 2;
            numer += (t[i] == 'n' ? -1 : 1);
            denom *= 2;
        }

        numer *= 90;
        if (numer % denom == 0) {
            cout << numer / denom << endl;
        } else {
            int g = gcd(numer, denom);
            cout << numer / g << "/" << denom / g << endl;
        }
    }

}