#include <stdio.h> int main(){ int x; int m=0; long long n,s; scanf("%d %d",&x,&n); while(m<n){ m++; if((x!=6)&&(x!=7)){ s+=250; } x+=1; if(x==8){ x=1; } } printf("%d",s); return 0; }