import java.io.*; import java.util.*; import java.math.*; class Main98 { public static void out (Object out) { System.out.println(out); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] line = br.readLine().split(" "); double x = Math.abs(Integer.parseInt(line[0])); double y = Math.abs(Integer.parseInt(line[1])); double d = Math.sqrt(x * x + y * y); double sub = d - (int)d; out(sub < .5 ? (int)d * 2 + 1 : ((int)d + 1) * 2); } }