const
n = 3;
var
x,y:array[1..n] of real;
i:integer;
s1,s2:real;
begin
for i := 1 to n do
read(x[i]);
readln;
for i := 1 to n do
read(y[i]);
readln;
for i := 1 to n do
if (x[i]<5) then s1:=s1+x[i];
for i := 1 to n do
if (y[i]<5) then s2:=s2+y[i];
writeln(s1*s2);
readln
end.