#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
int alpha[2];
int ope[2];
int Ca;
int Co;
int Fpre;
char c;
int A[27];
int Used[27];
void Initial()
{
for(int i = 1;i <= 26;i++){
A[i] = i;
Used[i] = 0;
}
Ca = Co = Fpre = 0;
for(int i = 0;i < 2;i++)
ope[i] = alpha[i] = 0;
}
void Calculate()
{
if(Ca > 1){
Ca = 1;
if(ope[Co-1] == '+')
alpha[0] += alpha[1];
else
alpha[0] -= alpha[1];
alpha[1] = 0;
}
}
int main()
{
// freopen("in.in","r",stdin);
while((c = getchar()) != EOF)
{
ungetc(c,stdin);
Initial();
cout<<"Expression: ";
while(1)
{
if((c = getchar()) == EOF){cout<<endl;break;}
cout<<c;
if(c == '\n') break;
if(c == ' ') continue;
if(isalpha(c))
{
int n = c-'a'+1;
Used[n] = 1;
alpha[Ca++] = A[n];
if(Fpre){
A[n] += Fpre;
alpha[Ca-1] += Fpre;
Fpre = 0;
}
}
else if(c == '+' || c == '-')
{
char temp1;
loop2:
temp1 = getchar();
if(temp1 == ' ')
{
cout<<' ';
goto loop2;
}
if(temp1 != c){
ungetc(temp1,stdin);
if(Co)
{
Calculate();
Co = 0;
}
ope[Co++] = c;
}
else{
cout<<c;
char temp2;
loop1:
temp2 = getchar();
if(temp2 == ' ')
{
cout<<' ';
goto loop1;
}
if(isalpha(temp2)){
if( c == '+')
Fpre = 1;
else
Fpre = -1;
}
else{
if(c == '-')
A[alpha[Ca-1]]--;
else
A[alpha[Ca-1]]++;
}
ungetc(temp2,stdin);
}
}
}
Calculate();
cout<<" value = "<<alpha[0]<<endl;
for(int i = 1;i < 27;i++)
if(Used[i])
{
char temp = 'a' + i - 1;
cout<<" ";
cout<<temp<<" = "<<A[i]<<endl;
}
}
return 0;
}