neighborhood = [int(x) for x in input().split("@")] jump_data = input() neighborhood_len = len(neighborhood) length = 0 while jump_data != "Love!": length += int(jump_data.split()[-1]) if length >= neighborhood_len: length = 0 if neighborhood[length] > 2: neighborhood[length] -= 2 else: if neighborhood[length] != 0: neighborhood[length] -= 2 text = "has" else: text = "already had" print(f"Place {length} {text} Valentine's day.") jump_data = input() print(f"Cupid's last position was {length}.") failed_houses = sum(1 for x in neighborhood if x != 0) if failed_houses: print(f"Cupid has failed {failed_houses} places.") else: print("Mission was successful.")