while True: try: str_list = input().split(',') print(int(str_list[-1]) - int(str_list[-3]) - 1) except Exception as e: break