s = input().split('.')
if "" in s:
    print('NO')
else:
    if len(s) == 4:
        if (len(s[0]) != 1 and (s[0][0] == '0' or s[0][0] == '+')) or (len(s[1]) != 1 and (s[1][0] == '0' or s[1][0] == '+')) or (len(s[2]) != 1 and (s[2][0] == '0' or s[2][0] == '+')) or (len(s[3]) != 1 and (s[3][0] == '0' or s[3][0] == '+')):
            print('NO')
        else:
            ip = list(map(int, s))
            y_n = []
            for i in ip:
                if 0 <= i <= 255:
                    y_n.append('YES')
                else:
                    y_n.append('NO')

            if 'NO' in y_n:
                print('NO')
            else:
                print('YES')
    else:
        print("NO")