def main_function(): from sys import stdin from sys import stdout from math import sqrt input = stdin.readline print = stdout.write d1, d2 = list(map(int, input().split())) if d1 == d2 or sqrt(d1) == sqrt(d2 * d2 / 2): print('4') elif sqrt(d2 * d2 / 2) < sqrt(d1) < sqrt(d2): print('8') else: print('0') if __name__ == '__main__': main_function()