import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int xp = sc.nextInt(); int yp = sc.nextInt(); int s = xp * xp + yp * yp; int r = (int)Math.sqrt(s); int ans = 0; for(int i = r; i < r + 3; i++) { if(i * i > s) { ans = i; break; } } System.out.println(2 * ans); } }