// Arup Guha
// 4/28/2019
// Solution to 2019 USACO Gold Problem: I would walk 500 miles.

import java.io.*;
import java.util.*;

public class walk {
	
	public static void main(String[] args) throws Exception {
		
		// Read in array.
		Scanner stdin = new Scanner(new File("walk.in"));
		int n = stdin.nextInt();
		int k = stdin.nextInt();
		
		/*** Okay, so this problem is strange. In creating groups, you want to put cows with shorter
		     walks in the same group. Everyone has their own shortest walk to cow #n. So the final
			 answer will always be the walk from some cow #m to cow #n. The higher m is the shorter
			 that walk is. But we want to maximize that. So, we want to minimize m. To do this, just
			 place cows n, n-1, n-2, ..., k in one group, and the other k-1 cows are in a group by 
			 themselves. So the result is the distance between cow k-1 and cow n, which is
			 2019201997 - 84(k-1) - 48n, noting that the multipliers they give us are equivalent to
			 -84 and -48, respectively. I thought the whole warning about the memory limit was sort
			 of cheesy, since it's a red herring. In theory you could "sort" all the edges between
			 cows and this would test the memory limit, and I suppose the idea was to have this there
			 to throw people off. This solution only works because the distance function forces you to
			 place cow n with n-1, then cow n-2 in this group and so forth. If distance i-j was the nextInt
			 shortest after distance a-b, then you'd have to run MST.
		***/

		// Ta da!
		PrintWriter out = new PrintWriter(new FileWriter("walk.out"));
		out.println(2019201997-84*(k-1)-48*n);
		out.close();
		stdin.close();
	}
}