#coding:utf-8 def main(): num_list = [] n = list(input()) for i in n: num_list.append(replace(i)) a, b, c = num_list.count('x'), num_list.count('y'), num_list.count('z') print(judge(a,b,c)) def replace(i): x_set = {'1','2','3','5','7',} y_set = {'0','4','6','9',} #z_set = {'5',} if i in x_set: return 'x' elif i in y_set: return 'y' else: return 'z' def judge(a,b,c): return cal_1(a,b,c) if a < c+1 else cal_2(a,b,c) def cal_1(a,b,c): return a*2+b*3+c*4+1 def cal_2(a,b,c): return a+b*3+c*5+2 if __name__ == '__main__': main()