#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;

//#define int long long
#define DBG 0
#define dump(o) if(DBG){cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)
#define all(c) c.begin(),c.end()
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
const int north = -1;
const int west = 1;
int pow2(int a, int b) {
	if (b == 0)return 1;

	int res = pow2(a*a, b / 2);
	if (b & 1)res *= a;
	return res;
}
int gcd(int x, int y) {

	return y == 0 ? x : gcd(y, x%y);
}
signed main() {
	string s;
	while (cin >> s, s != "#") {
		vector<int>v;
		rep(i, 0, s.size()) {
			if (s[i] == 'n')v.push_back(north);
			else if (s[i] == 'w')v.push_back(west);
		}
		int bo, shi;
		bo = pow2(2, v.size() - 1);
		shi = pow2(2, v.size() - 1)*(v.back() == north ? 0 : 90);
		dump(bo);
		dump(shi);
		rep(i, 0, v.size() - 1) {
			shi += pow2(2, i)*v[i] * 90;
		}
		int g = gcd(shi, bo);
		bo /= g;
		shi /= g;
		cout << shi;
		if (bo != 1)cout << '/' << bo;
		cout << endl;
	}
	return 0;
}