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

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			BigInteger n = new BigInteger(scanner.next());
			System.out.println(BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) ? "Yes" : "No");
		}
	}
} import java.math.BigInteger; BigInteger java.math import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			BigInteger n = new BigInteger(scanner.next());
			System.out.println(BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) ? "Yes" : "No");
		}
	}
} Main public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			BigInteger n = new BigInteger(scanner.next());
			System.out.println(BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) ? "Yes" : "No");
		}
	} main {
		try (Scanner scanner = new Scanner(System.in)) {
			BigInteger n = new BigInteger(scanner.next());
			System.out.println(BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) ? "Yes" : "No");
		}
	} try (Scanner scanner = new Scanner(System.in)) {
			BigInteger n = new BigInteger(scanner.next());
			System.out.println(BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) ? "Yes" : "No");
		} {
			BigInteger n = new BigInteger(scanner.next());
			System.out.println(BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) ? "Yes" : "No");
		} Scanner scanner = new Scanner(System.in) Scanner scanner = new Scanner(System.in) new Scanner(System.in) BigInteger n = new BigInteger(scanner.next()); n new BigInteger(scanner.next()) System.out.println(BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) ? "Yes" : "No") System.out.println System.out System System.out BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) ? "Yes" : "No" BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) BigInteger.ZERO.equals BigInteger.ZERO BigInteger BigInteger.ZERO n.mod(BigInteger.valueOf(9)) n.mod n BigInteger.valueOf(9) BigInteger.valueOf BigInteger 9 "Yes" "No" String[] args args public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			BigInteger n = new BigInteger(scanner.next());
			System.out.println(BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) ? "Yes" : "No");
		}
	}
} public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			BigInteger n = new BigInteger(scanner.next());
			System.out.println(BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) ? "Yes" : "No");
		}
	}
} Main
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			BigInteger n = new BigInteger(scanner.next());
			System.out.println(BigInteger.ZERO.equals(n.mod(BigInteger.valueOf(9))) ? "Yes" : "No");
		}
	}
}
