import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.HashSet;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String  N=sc.next();
    String []hairetu = N.split("");
    int sum=0;
    for (int i=0;i<hairetu.length ;i++ ) {
      if(hairetu[i].equals(".")){
        i++;
      }
      if(hairetu[i].equals("E")){
       break;
      }
      sum=sum+Integer.parseInt(hairetu[i]);
    }
    if(sum%9==0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
}
} import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.stream.Collectors; Collectors java.util.stream import java.util.HashSet; HashSet java.util class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String  N=sc.next();
    String []hairetu = N.split("");
    int sum=0;
    for (int i=0;i<hairetu.length ;i++ ) {
      if(hairetu[i].equals(".")){
        i++;
      }
      if(hairetu[i].equals("E")){
       break;
      }
      sum=sum+Integer.parseInt(hairetu[i]);
    }
    if(sum%9==0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
}
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String  N=sc.next();
    String []hairetu = N.split("");
    int sum=0;
    for (int i=0;i<hairetu.length ;i++ ) {
      if(hairetu[i].equals(".")){
        i++;
      }
      if(hairetu[i].equals("E")){
       break;
      }
      sum=sum+Integer.parseInt(hairetu[i]);
    }
    if(sum%9==0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
} main {
    Scanner sc = new Scanner(System.in);
    String  N=sc.next();
    String []hairetu = N.split("");
    int sum=0;
    for (int i=0;i<hairetu.length ;i++ ) {
      if(hairetu[i].equals(".")){
        i++;
      }
      if(hairetu[i].equals("E")){
       break;
      }
      sum=sum+Integer.parseInt(hairetu[i]);
    }
    if(sum%9==0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String  N=sc.next(); N sc.next() sc.next sc String []hairetu = N.split(""); hairetu N.split("") N.split N "" int sum=0; sum 0 for (int i=0;i<hairetu.length ;i++ ) {
      if(hairetu[i].equals(".")){
        i++;
      }
      if(hairetu[i].equals("E")){
       break;
      }
      sum=sum+Integer.parseInt(hairetu[i]);
    } int i=0; int i=0; i 0 i<hairetu.length i hairetu.length hairetu hairetu.length i++ i++ i {
      if(hairetu[i].equals(".")){
        i++;
      }
      if(hairetu[i].equals("E")){
       break;
      }
      sum=sum+Integer.parseInt(hairetu[i]);
    } {
      if(hairetu[i].equals(".")){
        i++;
      }
      if(hairetu[i].equals("E")){
       break;
      }
      sum=sum+Integer.parseInt(hairetu[i]);
    } if(hairetu[i].equals(".")){
        i++;
      } hairetu[i].equals(".") hairetu[i].equals hairetu[i] hairetu i "." {
        i++;
      } i++ i if(hairetu[i].equals("E")){
       break;
      } hairetu[i].equals("E") hairetu[i].equals hairetu[i] hairetu i "E" {
       break;
      } break; sum=sum+Integer.parseInt(hairetu[i]) sum sum+Integer.parseInt(hairetu[i]) sum Integer.parseInt(hairetu[i]) Integer.parseInt Integer hairetu[i] hairetu i if(sum%9==0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    } sum%9==0 sum%9 sum 9 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
import java.util.Scanner;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.HashSet;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String  N=sc.next();
    String []hairetu = N.split("");
    int sum=0;
    for (int i=0;i<hairetu.length ;i++ ) {
      if(hairetu[i].equals(".")){
        i++;
      }
      if(hairetu[i].equals("E")){
       break;
      }
      sum=sum+Integer.parseInt(hairetu[i]);
    }
    if(sum%9==0){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
}
}
