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

public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		BigInteger n = sc.nextBigInteger();
		sc.close();
		prtln(n.remainder(new BigInteger("9")).equals(new BigInteger("0")) ? "Yes" : "No");
	}

	public static <T> void prtln(T t) { System.out.println(t); }
} import java.math.BigInteger; BigInteger java.math import java.util.Scanner; Scanner java.util public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		BigInteger n = sc.nextBigInteger();
		sc.close();
		prtln(n.remainder(new BigInteger("9")).equals(new BigInteger("0")) ? "Yes" : "No");
	}

	public static <T> void prtln(T t) { System.out.println(t); }
} Main public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		BigInteger n = sc.nextBigInteger();
		sc.close();
		prtln(n.remainder(new BigInteger("9")).equals(new BigInteger("0")) ? "Yes" : "No");
	} main {
		Scanner sc = new Scanner(System.in);
		BigInteger n = sc.nextBigInteger();
		sc.close();
		prtln(n.remainder(new BigInteger("9")).equals(new BigInteger("0")) ? "Yes" : "No");
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) BigInteger n = sc.nextBigInteger(); n sc.nextBigInteger() sc.nextBigInteger sc sc.close() sc.close sc prtln(n.remainder(new BigInteger("9")).equals(new BigInteger("0")) ? "Yes" : "No") prtln n.remainder(new BigInteger("9")).equals(new BigInteger("0")) ? "Yes" : "No" n.remainder(new BigInteger("9")).equals(new BigInteger("0")) n.remainder(new BigInteger("9")).equals n.remainder(new BigInteger("9")) n.remainder n new BigInteger("9") new BigInteger("0") "Yes" "No" final String[] args args public static <T> void prtln(T t) { System.out.println(t); } prtln { System.out.println(t); } System.out.println(t) System.out.println System.out System System.out t T t t public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		BigInteger n = sc.nextBigInteger();
		sc.close();
		prtln(n.remainder(new BigInteger("9")).equals(new BigInteger("0")) ? "Yes" : "No");
	}

	public static <T> void prtln(T t) { System.out.println(t); }
} public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		BigInteger n = sc.nextBigInteger();
		sc.close();
		prtln(n.remainder(new BigInteger("9")).equals(new BigInteger("0")) ? "Yes" : "No");
	}

	public static <T> void prtln(T t) { System.out.println(t); }
} Main
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(final String[] args) {
		Scanner sc = new Scanner(System.in);
		BigInteger n = sc.nextBigInteger();
		sc.close();
		prtln(n.remainder(new BigInteger("9")).equals(new BigInteger("0")) ? "Yes" : "No");
	}

	public static <T> void prtln(T t) { System.out.println(t); }
}
