#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <stack>

using std::cin;
using std::cout;
using std::endl;

int main(void) {
	std::string dir;
	cin >> dir;

	while (dir != "#") {
		std::stack<bool> d;
		int count = 0;
		for (int i = 0; i < dir.length(); i++) {
			if (dir[i] == 'n') {
				d.push(true);
				count++;
			}
			if (dir[i] == 'w') {
				d.push(false);
				count++;
			}
		}

		double a;
		if (d.top()) {
			a = 0;
		}
		else {
			a = 90;
		}
		d.pop();

		int t = 1;
		while (!(d.empty())) {
			if (d.top()) {
				a -= 90/pow(2,t);
			}
			else {
				a += 90/pow(2,t);
			}
			t++;
			d.pop();
		}
		if (count == 1) {
			cout << a << endl;
		}
		else {
			if (count == 2) {
				cout << a << endl;
			}
			else {
				cout << std::setprecision(12) << a * pow(2,count-2) << "/" << pow(2,count-2) << endl;
			}
		}
		cin >> dir;
	}

	return 0;
}