// Enter your code here let arr = readLine()!.characters.split(" ").map{Int(String($0))!} func modulo(num: Int) -> Int { func power(num: Int, by: Int) -> Int { var power = 1 for _ in 1...by { power *= num } return power } return num % (power(10, by: 9) + 7) } func calculateProbability(factorA a: Int, factorB b: Int, milliseconds time: Int) -> Int { let numOfVirusCells = Int((0.5 * Double(a) * Double(time)) + (0.5 * Double(b) * Double(time))) return modulo(numOfVirusCells) } print(calculateProbability(factorA: arr[0], factorB: arr[1], milliseconds: arr[2]))