import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int X = sc.nextInt(); int Y = sc.nextInt(); int[] cnt = new int[10000001]; for(int x = 0; x * x <= Y; x++) { for(int y = 1; y * y <= Y; y++) { int k = x * x + y * y; if(k >= X && k <= Y) { cnt[k]++; } } } int ans = 0; for(int i = X; i <= Y; i++) { ans = Math.max(cnt[i], ans); } System.out.println(ans * 4); } }