#include <iostream>
#include <cstdio>
#include <string>
#include <cstdlib>

using namespace std;

int top=0,s[100];

void push(int x){
  s[++top]=x;
}

int pop(){
  top--;
  return s[top+1];
}

int pow2(int n){
  if(!n)return 1;
  int tmp = 1;
  while(n-->0)
    tmp *= 2;
  return tmp; 
}

int main() {
  for(;;){
    top=0;
    int c = getchar();
    if(c=='#') break;
    if(c=='w') push(90);
    if(c=='n') push(-90);

    int count = 1;
    while((c=getchar())!=('\n')){
      if(c=='w'){
	push(90);
	count++;
      }
      if(c=='n'){
	push(-90);
	count++;
      }
    }
  
    int num=pop();
    if(num<0)num=0;
  
    int popped;
    int i=1;
    for(i=1;i<count;i++){
      popped=pop();
      num = num * 2 + popped;
    }
    
    int den = pow2(i-1);

    if(num%2==0&&den>1)    
      while(num%2==0){
	num/=2;
	den/=2;
      }
    
    if(den == 1 || den == 0)
      cout << num << endl;
    else
      cout << num << "/" << den << endl;
  }

}