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

float setGp(int x)
{
	int gp;

	if(x>= 80)
		gp = 5;
	else if(x>= 70)
		gp = 4;
	else if(x>= 60)
		gp = 3.5;
	else if(x>= 50)
		gp = 3;
	else if(x>= 40)
		gp = 2;
	else if(x>= 33)
		gp = 1;
	else 
		gp = 0;

	return gp;
}



int main()
{
	FILE *f1,*f2;

	f1 = fopen("input.txt","r");
	f2 = fopen("output.txt","w");

	char name[100];
	int roll,code[12],mark[12],i;
	float sumGp = 0.0,optGp;

	fgets(name,30,f1);
	fscanf(f1,"%d",&roll);

	fprintf(f2,"Name: %s",name);
	fprintf(f2,"Roll: %d\n",roll);
	fprintf(f2,"Sub.Code\tMARKS\tGrade Point\tLetter Grade\n");
	
	for(i=1;i<=12;i++)
	{
		fscanf(f1,"%d%d",&code[i],&mark[i]);
		sumGp = sumGp + setGp(mark[i]);

		fprintf(f2,"%d\t\t%d\t%.2f\t\t",code[i],mark[i],setGp(mark[i]));
		
		if(mark[i]>=80)
			fprintf(f2,"A+");
		else if(mark[i]>=70)
			fprintf(f2,"A");
		else if(mark[i]>=60)
			fprintf(f2,"A-");
		else if(mark[i]>=50)
			fprintf(f2,"B");
		else if(mark[i]>=40)
			fprintf(f2,"C");
		else if(mark[i]>=33)
			fprintf(f2,"D");
		else 
			fprintf(f2,"F");
		fprintf(f2,"\n");
	}

	float avg;
	sumGp = sumGp - (setGp(mark[11])+setGp(mark[12]));
	optGp = setGp(mark[11])+setGp(mark[12])/2;
	if(optGp>=3)
		optGp = optGp-2;
	sumGp = sumGp + optGp;
	
	avg = sumGp/11;

	fprintf(f2,"\nGPA = %f\n",avg);
	return 0;
}