import java.util.*; 
import java.lang.*; 


public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                String N = scan.next();
                int sum = 0;
                
                for(int i=0; i<N.length(); i++){
                    char p = N.charAt(i);
                    int j = (int)p;
                    
                    sum += j;
                }
                
                if(sum%3==0){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
        }
} import java.util.*; util.* java import java.lang.*; lang.* java public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                String N = scan.next();
                int sum = 0;
                
                for(int i=0; i<N.length(); i++){
                    char p = N.charAt(i);
                    int j = (int)p;
                    
                    sum += j;
                }
                
                if(sum%3==0){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
        }
} Main public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                String N = scan.next();
                int sum = 0;
                
                for(int i=0; i<N.length(); i++){
                    char p = N.charAt(i);
                    int j = (int)p;
                    
                    sum += j;
                }
                
                if(sum%3==0){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
        } main {
		Scanner scan = new Scanner(System.in);
                
                String N = scan.next();
                int sum = 0;
                
                for(int i=0; i<N.length(); i++){
                    char p = N.charAt(i);
                    int j = (int)p;
                    
                    sum += j;
                }
                
                if(sum%3==0){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
        } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) String N = scan.next(); N scan.next() scan.next scan int sum = 0; sum 0 for(int i=0; i<N.length(); i++){
                    char p = N.charAt(i);
                    int j = (int)p;
                    
                    sum += j;
                } int i=0; int i=0; i 0 i<N.length() i N.length() N.length N i++ i++ i {
                    char p = N.charAt(i);
                    int j = (int)p;
                    
                    sum += j;
                } {
                    char p = N.charAt(i);
                    int j = (int)p;
                    
                    sum += j;
                } char p = N.charAt(i); p N.charAt(i) N.charAt N i int j = (int)p; j (int)p sum += j sum j if(sum%3==0){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                } sum%3==0 sum%3 sum 3 0 {
                    System.out.println("Yes");
                } System.out.println("Yes") System.out.println System.out System System.out "Yes" {
                    System.out.println("No");
                } System.out.println("No") System.out.println System.out System System.out "No" String[] args args public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                String N = scan.next();
                int sum = 0;
                
                for(int i=0; i<N.length(); i++){
                    char p = N.charAt(i);
                    int j = (int)p;
                    
                    sum += j;
                }
                
                if(sum%3==0){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
        }
} public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                String N = scan.next();
                int sum = 0;
                
                for(int i=0; i<N.length(); i++){
                    char p = N.charAt(i);
                    int j = (int)p;
                    
                    sum += j;
                }
                
                if(sum%3==0){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
        }
} Main
import java.util.*; 
import java.lang.*; 


public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
                
                String N = scan.next();
                int sum = 0;
                
                for(int i=0; i<N.length(); i++){
                    char p = N.charAt(i);
                    int j = (int)p;
                    
                    sum += j;
                }
                
                if(sum%3==0){
                    System.out.println("Yes");
                }else{
                    System.out.println("No");
                }
        }
}