Nandhini is an active user of FB and she keeps updating all information about her protests and the social evils she is fighting against in her FB page. She used to get many likes for all her posts. FB gives some gift vouchers to few users everyday. The lucky users are selected based on the number of likes that a post has obtained on a particular day. If the number of likes obtained for a post is a Lucky Number, the FB user receives a Gift Voucher.
A Lucky Number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are lucky numbers.
Example: 19 is a lucky number
12 + 92 = 82
82 + 22 = 68
62 + 82 = 100
12 + 02 + 02 = 1
Write a program to find whether Nandhini would receive the gift voucher on a particular day. Input is the number of likes that her post received on a particular day.
Print Invalid Input if the input is negative or if the input is greater than 1000000.
Input consists of an integer that corresponds to the number of likes.
Output consists of a string that is either “YES” or “NO” or “Invalid Input”.
Sample Input 1:
Sample Output 1:
Sample Input 2:
Sample Output 2:
Sample Input 3:
Sample Output 3: