# Problem A # import necessary libraries import math # define constants PRIME = 1000000007 def gold_placements(road): """ This function takes a string representing a road with gold nuggets and returns the number of different gold placements that are compatible with the notes, modulo the prime 109+7 (1000000007). Parameters: road (str): a string representing a road with gold nuggets Returns: int: the number of different gold placements that are compatible with the notes, modulo the prime 109+7 (1000000007) """ # initialize variables nuggets = 0 placements = 1 # loop through the road for i in range(len(road)): # if the character is 'o', add 1 to the nuggets count if road[i] == 'o': nuggets += 1 # if the character is '.', multiply the placements by 2 elif road[i] == '.': placements *= 2 # if there are no nuggets, return 0 if nuggets == 0: return 0 # else, return the placements modulo the prime else: return placements % PRIME # get the number of test cases num_test_cases = int(input()) # loop through the test cases for i in range(num_test_cases): # get the road road = input() # print the result print("Case #{}: {}".format(i+1, gold_placements(road)))