import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
public class NumConvertUpper {
public static void main(String[] args) {
List<String> num = Arrays.asList(new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"});
List<String> lower = Arrays.asList(new String[]{"零", "一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "百", "千", "万", "亿"});
List<String> upper = Arrays.asList(new String[]{"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖", "拾", "佰", "仟", "万", "亿"});
while (true) {
String line = new Scanner(System.in).nextLine();
if ("\\q".equals(line)) {
break;
}
int length = line.length();
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < length; i++) {
int li = line.substring(i).length();
String s0 = String.valueOf(line.charAt(0));
String s = String.valueOf(line.charAt(i));
boolean flag = num.contains(s0);
if(flag == num.contains(s)){
if(flag){
int i1 = li / 4;
int i2 = li % 4;
System.out.println(i1);
System.out.println(i2);
String bs = upper.get(num.indexOf(s));
buffer.append(bs);
if(i2 == 0){
buffer.append(upper.get(12));
}else if(i2 == 3){
buffer.append(upper.get(11));
}else if(i2 == 2){
buffer.append(upper.get(10));
}else {
if(i != length -1) {
if (i1 == 4) {
buffer.append(upper.get(13)).append(upper.get(14));
} else if (i1 == 3) {
buffer.append(upper.get(13)).append(upper.get(14));
} else if (i1 == 2) {
buffer.append(upper.get(14));
} else {
buffer.append(upper.get(13));
}
}
}
}else {
buffer.append(upper.get(lower.indexOf(s)));
}
}else {
throw new BusinessException("format is error!");
}
}
System.out.println(buffer.toString());
}
}
}