using System;

namespace LevelA
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = int.Parse(Console.ReadLine());

            var _x = x / 100;
            var __x = x / 10-_x*10;
            var ___x = x - (_x * 100 + __x * 10);

            if (_x % 7 == 0|| __x%7==0||___x%7==0)
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}
