def f( x , a )
	x[ 0 ].length.times { |i|
		if x[ 0 ][ i ] == a then
			sum = 0
			3.times { |j|
				sum += x[ j+1 ][ i ]
			}
			return sum
		end
	}
	return -1
end

x = [ 
      [ 'D' , 'A' , 'E' , 'C' , 'B' ] ,
      [ 70 , 85 , 60 , 45 , 30 ] ,
      [ 90 , 45 , 35 , 60 , 50 ] ,
      [ 100 , 60 , 75 , 50 , 10 ] 
    ]

a = 'B'
if f( x , a ) != -1 then
	printf( "%sさんの合計点数は%dです\n" , a , f( x , a ) )
end