import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		BigInteger b1= new BigInteger(scan.nextLine());
		BigInteger b2= new BigInteger("9");
		BigInteger c= new BigInteger("0");
		if((b1.mod(b2)).equals(c)) System.out.println("Yes");
		else System.out.println("No");

	}

} import java.math.BigInteger; BigInteger java.math import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		BigInteger b1= new BigInteger(scan.nextLine());
		BigInteger b2= new BigInteger("9");
		BigInteger c= new BigInteger("0");
		if((b1.mod(b2)).equals(c)) System.out.println("Yes");
		else System.out.println("No");

	}

} Main public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		BigInteger b1= new BigInteger(scan.nextLine());
		BigInteger b2= new BigInteger("9");
		BigInteger c= new BigInteger("0");
		if((b1.mod(b2)).equals(c)) System.out.println("Yes");
		else System.out.println("No");

	} main {
		Scanner scan = new Scanner(System.in);
		BigInteger b1= new BigInteger(scan.nextLine());
		BigInteger b2= new BigInteger("9");
		BigInteger c= new BigInteger("0");
		if((b1.mod(b2)).equals(c)) System.out.println("Yes");
		else System.out.println("No");

	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) BigInteger b1= new BigInteger(scan.nextLine()); b1 new BigInteger(scan.nextLine()) BigInteger b2= new BigInteger("9"); b2 new BigInteger("9") BigInteger c= new BigInteger("0"); c new BigInteger("0") if((b1.mod(b2)).equals(c)) System.out.println("Yes");
		else System.out.println("No"); (b1.mod(b2)).equals(c) (b1.mod(b2)).equals (b1.mod(b2)) b1.mod b1 b2 c System.out.println("Yes") System.out.println System.out System System.out "Yes" 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);
		BigInteger b1= new BigInteger(scan.nextLine());
		BigInteger b2= new BigInteger("9");
		BigInteger c= new BigInteger("0");
		if((b1.mod(b2)).equals(c)) System.out.println("Yes");
		else System.out.println("No");

	}

} public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		BigInteger b1= new BigInteger(scan.nextLine());
		BigInteger b2= new BigInteger("9");
		BigInteger c= new BigInteger("0");
		if((b1.mod(b2)).equals(c)) System.out.println("Yes");
		else System.out.println("No");

	}

} Main
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		BigInteger b1= new BigInteger(scan.nextLine());
		BigInteger b2= new BigInteger("9");
		BigInteger c= new BigInteger("0");
		if((b1.mod(b2)).equals(c)) System.out.println("Yes");
		else System.out.println("No");

	}

}
