/*
#include<stdio.h>
int main()
{
long long int a,b,c,d,e,i,max=0,min=0;
scanf("%lld %lld %lld %lld %lld",&a,&b,&c,&d,&e);
for (i=1;i<=5;i++)
{
//max===================================
if (max<a)
{
max=a;
}
else if (max<b)
{
max=b;
}
else if (max<c)
{
max=c;
}
else if (max<d)
{ max=d;
}
else if (max<e)
{
max=e;
}
//min=======================================
if (min>a)
{
min=a;
}
else if (min>b)
{
min=b;
}
else if (min>c)
{
min=c;
}
else if (min>d)
{
min=d;
}
else if (min>e)
{
min=e;
}
}
printf("%lld\n%lld",max,min);
}
*/
#include<stdio.h>
int main()
{
double a,b,n=0,s=0,t=0;
int i;
for (i=1; i<=5; i++)
{
scanf("%lf %lf",&a,&b);
n=b-a;
if(n<=1)
{
n = 0;
}
else
{
n -= 1;
s+=n;
}
}
if (s>=15)
{
s *= 0.95;
}
else if (s<=5)
{
s *= 0.95;
}
printf("%.0lf",s*10000);
return 0;
}



