using System; namespace y { class Program { static void Main(string[] args) { var ss = Console.ReadLine().Split(); var x = int.Parse(ss[0]); var y = int.Parse(ss[1]); int ans = -1; if (x == y) ans = 0; else if (x == 0) ans = 2; else if (y == 0) ans = 1; Console.WriteLine(ans); } } }