const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void async function () {
// Write your code here
let arr = (await readline()).split('.')
let isLegal = 'YES'
if (arr.length != 4) {
isLegal = 'NO'
} else {
for (let i=0; i<arr.length; i++) {
let el = arr[i]
if (!(el != '' && el >= 0 && el <= 255)) {
isLegal = 'NO'
break
}
if (el.length > 1 && el[0] == '0') {
isLegal = 'NO'
break
}
if (el.match(/[^0-9]/g)) {
isLegal = 'NO'
break
}
}
}
console.log(isLegal)
}()