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

int main() {
	int ining;
	int ten[50];
	int base[3];
	char act[8];
	int outCnt = 0;
	
	for(int i=0;i<50;i++){
		ten[i] = 0;
	}
	
	for(int i=0;i<3;i++){
		base[i] = 0;
	}
	
	scanf("%d",&ining);
	
	for(int i=0;i<ining;i++){
		while(outCnt < 3){
			scanf("%s",act);
			if(strcmp(act,"HIT") == 0) {
				ten[i] = ten[i] + base[2];
				base[2] = base[1];
				base[1] = base[0];
				base[0] = 1;
			} else if(strcmp(act,"HOMERUN") == 0) {
				for(int l=0;l<3;l++){
					ten[i] = ten[i] + base[l];
					base[l] = 0;
				}
				ten[i] = ten[i] + 1;
			} else if(strcmp(act,"OUT") == 0) {
				outCnt++;
			}
		}
		outCnt = 0;
		for(int i=0;i<3;i++){
			base[i] = 0;
		}
	}
	
	for(int i=0;i<ining;i++)
		printf("%d\n",ten[i]);
	
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
typedef pair<int,int> P;
const int INF=1e9;
int main(){
    string s;
    cin>>s;
    rep(i,1<<3){
        int sum=0;
        sum+=s[0]-'0';
        for(int j=1;j<4;j++){
            if(i>>(j-1)&1) sum+=s[j]-'0';
            else sum-=s[j]-'0';
        }
        if(sum==7){
            cout<<s[0];
            rep(j,3){
                if(i>>j&1) cout<<'+';
                else cout<<'-';
                cout<<s[j+1];
            }
            break;
        }
    }
    cout<<"=7";
}