/*
#include <stdio.h>
#define SIZE 100001
#include <string.h>
int stack [SIZE]={};
int top=-1;
void push (int data)
{
stack [++top]=data;
}
int pop ()
{
return stack [top--];
}
int main ()
{
int i,sum=0,j,len;
char str[SIZE];
gets (str);
len=strlen(str);
for (i=0;i<len;i++)
{
if (str[i]=='(')
{
push (1);
}
else
{
pop ();
if(str[i-1]=='(')
{
sum+=top+1;
}
else
{
sum++;
}
}
}
printf ("%d",sum);
return 0;
}
*/
/*
#include <stdio.h>
#define SIZE 201
#include <string.h>
int stack[SIZE]= {};
int top=-1;
void push (int data)
{
stack[++top]=data;
}
int pop ()
{
return stack [top--];
}
int main ()
{
int i,len,a=0,b=0,j,num=0;
char str[SIZE];
gets(str);
len=strlen(str);
for (i=0; i<len; i++)
{
if (str[i]=='+')
{
b=pop();
a=pop();
push (a+b);
}
else if (str[i]=='*')
{
b=pop();
a=pop();
push (a*b);
}
else if (str[i]=='-')
{
b=pop();
a=pop();
push (a-b);
}
else if (str[i]!=' ')
{
num=num*10+str[i]-'0';
if(str[i+1]==' ')
{
push(num);
num=0;
}
}
}
printf ("%d",pop());
return 0;
}
*/
#include <stdio.h>
int main ()
{
int i;
double a,b,sum=0,money;
for (i=1;i<=5;i++)
{
scanf ("%lf %lf",&a,&b);
if(b-a>=1&&b-a<=5)
{
sum+=b-a-1;
}
else if (b-a>=5)
{
sum+=4;
}
}
if (sum>=15)
{
money=sum*10000*0.95;
}
else if (sum<=5)
{
money=sum*10000*1.05;
}
else
{
money=sum*10000;
}
printf ("%d",(int)money);
return 0;
}