using System;

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split();
            var p = Console.ReadLine().Split();
            int x1, y1, x2, y2, x, y;
            int k = 0, a = 0, b = 0;
            x1 = Convert.ToInt32(s[0]);
            y1 = Convert.ToInt32(s[1]);
            x2 = Convert.ToInt32(p[0]);
            y2 = Convert.ToInt32(p[1]);
            if (x1 == y1 && x2 == y2)
                Console.WriteLine(1);
            else if (x1 == x2 || y1 == y2)
                Console.WriteLine(2);
            else
            {
                x = Math.Abs(x1 - x2);
                y = Math.Abs(y1 - y2);
                if (y > x)
                {
                    k = y;
                    b = x;
                    a = k;
                }
                a = x;
                b = y;
                while (b != 0)
                {
                    k = a;
                    a = b;
                    b = k % b;
                }
                x /= a;
                y /= a;
                Console.WriteLine(x * y);
            }
        }
    }
}