(let [N (read-line)
      Ni (map #(Character/digit % 10) N)] 
  (-> Ni 
      distinct 
      count 
      ( #(cond
          (= 1 %) N 
          (= (first Ni) (apply max Ni)) (apply str (repeat 3 (first Ni)))
          :else (apply str (repeat 3 (inc (first Ni))))))
      println))