import java.util.Scanner;
public class Main{
private static Scanner cin;
public static int DISTENCE = 250;
public static int DAYS_A_WEEK = 5;
public static void main(String args[])throws Exception {
cin = new Scanner(System.in);
int x = cin.nextInt();
long n = cin.nextLong();
long xn = 0;
long ret = 0;
long tmp = 0;
if(x>=1 && x<=7 && n>0) {
if(x>=1 && x<=5) {
tmp = (x-1)*DISTENCE;
}else if (x>5 && x<= 7) {
tmp = DAYS_A_WEEK*DISTENCE;
}
xn = x + n - 1;
long t1 = xn/7;
long t2 = xn%7;
if (t1 >0) {
ret = t1*DAYS_A_WEEK*DISTENCE;
}
if(t2>=1 && t2<=5) {
ret += t2*DISTENCE;
}else if(t2>5 && t2<=7) {
ret += DAYS_A_WEEK*DISTENCE;
}
ret = ret - tmp;
}
System.out.println(ret);
}
}