Problems
425 - Divisible by 3
SUBMIT PROBLEM

Divisible by 3

Time Limit: 1 sec

 

The Problem

A number is divisible by 3 if the sum of all the digits is divisible by 3.

[If sum of all digit greater than 10 you can also sum the digits]

 

Example 1. 34164

Sum of all digits = 3 + 4 + 1 + 6 + 4 = 18

18 is divisible by 3, so 34164 is divisible by 3. 

Sum of all digit = 3 + 4 + 1 + 6 + 4 = 18 => 1 + 8 = 9

9 is divisible by 3, so 34164 is divisible by 3.

Example 2. 16499205854376

Sum of all digits = 1 + 6 + 4 + 9 + 9 + 2 + 0 + 5 + 8 + 5 + 4 + 3 + 7 + 6 = 69

69 is divisible by 3, so 16499205854376 is divisible by 3. 

Sum of all digits = 1 + 6 + 4 + 9 + 9 + 2 + 0 + 5 + 8 + 5 + 4 + 3 + 7 + 6 = 69 => 6 + 9 = 15 => 1 + 5 = 6

6 is divisible by 3, so 16499205854376 is divisible by 3.

 

Make a simple program that reads an integer number N and print "YES" if the number is divisible by 3 otherwise print "NO".

 

The Input

Input file contain a series of line, each line contain one integer number N (0<N<=1000000000000000). Input is terminated by EOF.

 

The Output

For each line of input, print "YES" if the number is divisible by 3 otherwise print "NO" in a separate line.

 

Sample Input

16499205854376

10

 34164

 

Sample Output

YES

NO

YES

 

 

 

 

Problem Setter: Shahin ShamS