using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace abcd
{
    class Program
    {
        static void Main(string[] args)
        {
            string line;
            while ((line = Console.ReadLine()) != null)
            {
                var ab = line.Split().Select(int.Parse).ToArray();
                int a = ab[0];
                int b = ab[1];
                int c = ab[2];
                int d = 0;
                int e = 0;
                if ((a % 3 == 0 && b % 4 == 0) || (a % 4 == 0 && b % 3 == 0) && c % 5 == 0)
                    d++;
                if (a % 5 == 0 && b % 5 == 0 && c % 8 == 0)
                    e++;
                Console.WriteLine(d);
                Console.WriteLine(e);
            }

        }
    }
}