new_version = int(''.join(input().split('.'))) + 1
new_version = '.'.join(str(new_version))
print(new_version)

new_version = int(''.join(input().split('.'))) + 1
new_version = '.'.join(str(new_version))
print(new_version)
