function Main(input) {
	input = input.split("\n");
    let counter = 0
    let list = []
	for(let i = 0; i <= input[0].length-4; i++){
      for(let j = 4+i; j <= input[0].length; j++) {
    	let current = Number(input[0].slice(i,j))
        if(list.includes(current)) {
          counter++
          continue
        }
        if(current % 2019 === 0) {
          counter++
          list.push(current)
        }
      }
	}
	console.log(counter, list)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
