#include <bits/stdc++.h>

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

vector<int> v;
int L;

template<typename T>
T gcd(T a, T b){
    if(b == 0){return a;}
    return gcd(b, a % b);
}

template<typename T>
T lcm(T a, T b){
    T g = gcd(a, b);
    return a / g * b;
}

P add(const P p, const P q){
    int a1, b1, a2, b2;
    tie(a1, b1) = p;
    tie(a2, b2) = q;

    int l = lcm(b1, b2);
    a1 *= l / b1;
    a2 *= l / b2;

    int c = a1 + a2;
    int g = gcd(c, l);
    
    return std::make_tuple(c / g, l / g);
}

P f(int idx){
    if(idx + 1 == L){
        if(v[idx] == 0){
            return std::make_tuple(0, 1);
        }else{
            return std::make_tuple(90, 1);
        }
    }

    P p = f(idx + 1);

    if(v[idx] == 0){
        return add(p, std::make_tuple(-90, 1 << (L - (idx + 1))));
    }
    return add(p, std::make_tuple(90, 1 << (L - (idx + 1))));
}

int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);

    while(true){
        string S;
        std::cin >> S;
        if(S[0] == '#'){break;}
    
        v.clear();
    
        int i = 0;
        while(i < S.size()){
            if(S[i] == 'n'){
                v.emplace_back(0);
                i += 5;
            }else{
                v.emplace_back(1);
                i += 4;
            }
        }

        L = v.size();
        int a, b;
        tie(a, b) = f(0);

        if(b == 1){
            std::cout << a << std::endl;
        }else{
            std::cout << a << "/" << b << std::endl;
        }
    }
}

