import java.util.Scanner;

public class herbmixing_mn {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt(), y = sc.nextInt();
    int delta = Math.min(x, y);
    int ret = 10 * delta;
    x -= delta;
    y -= delta;
    ret += 10 * (x / 3);
    if (x % 3 == 1) {
      ret++;
    } else if (x % 3 == 2) {
      ret += 3;
    }
    System.out.println(ret);
    sc.close(); 
  }
}
