## https://yukicoder.me/problems/no/2972 def main(): T = int(input()) questions = [] max_n = 0 for _ in range(T): N, P , Q = map(int, input().split()) max_n = max(max_n, N) questions.append((N, P, Q)) # 素数判定 is_prime = [True] * (max_n + 1) is_prime[1] = False for p in range(2, max_n + 1): if not is_prime[p]: continue x = 2 * p while x <= max_n: is_prime[x] = False x += p prime_count = [0] * (max_n + 1) not_prime_count = [0] * (max_n + 1) p_count = 0 for i in range(1, max_n + 1): if is_prime[i]: p_count += 1 prime_count[i] = p_count not_prime_count[i] = i - p_count for N, P, Q in questions: a1 = prime_count[N] * P + not_prime_count[N] * (100 - Q) a2 = prime_count[N] * P print(a2 / a1) if __name__ == "__main__": main()