시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 186 150 140 80.460%

문제

재석이는 대문에 붙이는 (주소를 나타내는) 호수판 제작업체의 직원이다. 고객에게 전달할 호수판은 숫자와 숫자 사이 그리고 왼쪽 오른쪽으로 적당히 여백이 들어가 줘야하고 숫자마다 차지하는 간격이 조금씩 상이하다. 다행이도 규칙은 매우 간단하다. 

  1. 각 숫자 사이에는 1cm의 여백이 들어가야한다.
  2. 1은 2cm의 너비를 차지해야한다. 0은 4cm의 너비를 차지해야한다. 나머지 숫자는 모두 3cm의 너비를 차지한다.
  3. 호수판의 경계와 숫자 사이에는 1cm의 여백이 들어가야한다.

120.png

예를 들어 위의 120 같은 경우,  각 숫자 사이에 여백이 1cm 씩 2개 들어간다. 1은 2cm, 2는 3cm, 0은 4cm를 차지한다. 오른쪽, 왼쪽 경계에서 각각 여백이 1cm씩 차지한다. 따라서 총 2 + 2 + 3 + 4 + 1 + 1 = 13(cm) 가 된다.

재석이는 고객에게 전달해야할 호수판의 너비가 얼마나 되는지 궁금해졌다. 재석이를 도와주자!

입력

호수판에 들어갈 숫자 N의 범위는 1 <= N <= 9999 이다.

입력은 마지막에 0이 들어오기 전까지 계속해서 줄 단위로 주어진다.

또한, 마지막의 0은 처리하지 않는다.

출력

각 입력마다 얼마만큼 너비를 차지하는지 정수로 출력하면 된다.

각 출력은 줄바꿈으로 구분되어야한다.

예제 입력 1

120
5611
100
0

예제 출력 1

13
15
14
W3sicHJvYmxlbV9pZCI6IjEyODQiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM5ZDEgXHVjOGZjXHVjMThjIiwiZGVzY3JpcHRpb24iOiI8cD5cdWM3YWNcdWMxMWRcdWM3NzRcdWIyOTQgXHViMzAwXHViYjM4XHVjNWQwIFx1YmQ5OVx1Yzc3NFx1YjI5NCAoXHVjOGZjXHVjMThjXHViOTdjIFx1YjA5OFx1ZDBjMFx1YjBiNFx1YjI5NCkgXHVkNjM4XH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