def main(): c, d = input().split() c = float(c) d = float(d) b = (21*d - 7*c)/13 a = (28 * d - 20 * b)/7 if 0 <= a and 0 <= b: print(1000*a+2000*b) elif a < 0: print(7000*c) else: print(4000*d) if __name__ == "__main__": import sys import os if len(sys.argv) > 1: if sys.argv[1] == "-d": filename = "input1.txt" fd = os.open(filename, os.O_RDONLY) os.dup2(fd, sys.stdin.fileno()) main() else: main()