#include<stdio.h>
int main()
{
    int i,j,n=0;
    
    int t1,t2,t3,a1,a2,a3,ttot,atot;
    

    while((scanf("%d %d %d %d %d %d",&t1,&t2,&t3,&a1,&a2,&a3))!= EOF){
                         
                     ttot = atot = 0;
                     if((t1 !=0) ) {
                               
                               ttot = ttot + t1;
                               atot = atot + a1;
                               while(a1 > 1) {
                               ttot = ttot + 1200;
                               a1 --;
                               }
                     }
                      if((t2 !=0) ) {
                               ttot = ttot + t2;
                               atot = atot + a2;
                              while(a2 > 1) {
                               ttot = ttot + 1200;
                               a2 --;
                               }
                     }
                      if((t3 !=0) ) {
                               ttot = ttot + t3;
                               atot = atot + a3;
                               while(a3 > 1) {
                               ttot = ttot + 1200;
                               a3 --;
                               }
                     }
    }
    
                     printf("team %d: %d, %d\n",i+1,atot,ttot);
    }
    
    system("pause");                 
    return 0;
}
 