//* Problem  : E - Equation Solver
//* Contest  : UzhNU Local
//* Origin   : Ulm-1997
//* Type     : Solution
//* Date     : 2008.02.04
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 6.0
//* Algoritm : BNF-Parsing

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>

struct eq{
	int a, x;
};

int pos;

char s[1000];


eq parse_expr();

eq parse_factor()
{
	eq res; res.a = res.x = 0;
	if (s[pos] == '(')
	{
		pos++;
		res = parse_expr();
		pos++;
		return res;
	}
	if (s[pos] == 'x')
	{
		pos++;
		res.x = 1; 
	}
	else
	{
		while (s[pos] >= '0' && s[pos] <= '9')
		{
			res.a = 10 * res.a + s[pos] - '0';
			pos++;
		}
	}
	return res;
}

eq parse_term()
{
	eq res, t;
	res = parse_factor();
	while (s[pos] == '*')
	{
		pos++;
		t = parse_factor();
		int x = res.a * t.x + t.a * res.x; int a = res.a * t.a;
		res.x = x; res.a = a;
	}
	return res;
}

eq parse_expr()
{
	eq res, t; char c;
	res = parse_term();
	while (s[pos] == '-' || s[pos] == '+')
	{
		c = s[pos++]; 
		t = parse_term();
		if (c == '+')
		{
			res.a += t.a;
			res.x += t.x;
		}
		else
		{
			res.a -= t.a;
			res.x -= t.x;
		}
	}
	return res;
}

int main()
{
	int nt = 0;
	while (1)
	{
		s[0] = 0; gets(s); if (!s[0]) break;
		pos = 0;
		eq r1 = parse_expr();
		pos++;
		eq r2 = parse_expr();
		r1.a -= r2.a;
		r1.x -= r2.x;
		printf("Equation #%d\n", ++nt);
		if (!r1.x)
		{
			if (!r1.a) printf("Infinitely many solutions.\n");
				else printf("No solution.\n");
		}
		else
			printf("x = %.6lf\n", -1.0 * r1.a / r1.x);
		printf("\n");
	}
	return 0;
}