import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String ip = sc.nextLine();
        String[] split = ip.split("\\.");
        boolean flag = true;
        if (split.length == 4) {
            for (String s : split) {
                if (s.equals("")) {
                    flag = false;
                    break;
                } else if (s.replaceAll("[0-9]", "").length() > 0) {
                    flag = false;
                    break;
                } else if (s.charAt(0) == '0' && s.length() > 1) {
                    flag = false;
                    break;
                } else if (Integer.parseInt(s) > 255) {
                    flag = false;
                    break;
                }
            }
        } else {
            flag = false;
        }
        System.out.println(flag ? "YES" : "NO");
    }
}