/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package owl;

import java.util.Scanner;

/**
 *
 * @author korenciak4
 */
public class Owl {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String line;
        while (!(line = sc.nextLine()).equals("END")) {
            StringBuilder sb = new StringBuilder();
            boolean zmena = false;
            for (int i = line.length() - 1; i >= 0; i--) {
                if (line.charAt(i) != '0' && !zmena) {
                    sb.append((char) (line.charAt(i) - 1));
                    zmena = true;
                } else {
                    sb.append(line.charAt(i));
                }
            }
            line = sb.reverse().toString();
            System.out.println(Integer.parseInt(line));
            
        }
        sc.close();
    }

}