import java.util.Scanner; class Question098 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int x = scan.nextInt(); int y = scan.nextInt(); int r = (int)Math.ceil(Math.sqrt(x+y)); System.out.println(2*r); } }