#coding: utf-8 ##yuki_313 import sys ref=[20104,20063,19892,20010,19874,20199,19898,20163,19956,19841] s=raw_input() if s[0]!='3': print s[0],3 sys.exit() while s[-1]!='.': s1=int(s[-1]) ref[s1]-=1 s=s[:-1] print ref.index(-1),ref.index(1)