#include <iostream>
#include <fstream> 
using namespace std; 

int main() 
{
   
	ofstream outData;
    int E1,E2,E3,E4,E5;
    int marks[12][7]= {{1,1001,10,5,8,10,6},{1,1002,8,7,10,6},{1,1003,7,10,10,6,10},{1,1004,10,10,8,7,7},
	                  {2,2001,7,8,10,9,10},{2,2002,10,8,7,8,10},{2,2003,8,6,8,8,10},{2,2004,7,8,8,8,8},
					  {3,3001,10,9,10,10,10},{3,3002,8,7,8,8,8},{3,3003,7,8,9,10,6},{3,3004,8,6,8,7,7},};
    int i,j;
    ifstream inData;
	inData.open("input.txt");
    
	
	for(int i=0; i<12;i++)
    {
      for(int j=0; j<7;j++)
	     cout << marks[i][j] << "\t";
	  cout<<endl;
    }
    
    for (int i=0;i<12;i++)
	{
	  int total=0;
	  while (i<4)
	  {
        total = total + marks[i][j];
        i++;
        cout << "The total score for Team 1 is: "<<total<<endl;
        break;
      }
      while (i>3 && i<8)
      {
      	total = total + marks[i][j];
      	i++;
        cout << "The total score for Team 2 is: "<<total<<endl;
        break;
	  }
	  while (i>7)
      {
      	total = total + marks[i][j];
      	i++;
        cout << "The total score for Team 3 is: "<<total<<endl;
        break;
      }
    }
   	
	   if (!inData)
    {
        cout <<"Sorry, input file does not exist!"<< endl;
    	system("pause");
    	exit(1);
	}
	outData.open("output.txt");
	
	outData << E1 << endl;
	outData << E2 << endl;
	outData << E3 << endl;
    outData << E4 << endl;
	outData << E5 << endl;
	
   return 0;
}
