import java.math.*; import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int x = sc.nextInt(); int y = sc.nextInt(); int temp = (int)(Math.ceil(Math.sqrt(x*x*1.0+y*y*1.0))); if(temp*temp==x*x+y*y){ System.out.println(temp*2+1); }else{ System.out.println(temp*2); } } }