// Arup Guha
// 3/17/2019
// Solution to 2019 MAPS Problem F: Fractal Area

import java.util.*;

public class fractalarea {

	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();
		
		// Process cases.
		for (int loop=0; loop<numCases; loop++) {
			int r = stdin.nextInt();
			int n = stdin.nextInt();
			System.out.println(solve(r,n));
		}
	}
	
	// Solves the query r, n.
	public static double solve(int r, int n) {
	
		// Base level area.
		double area = Math.PI*r*r;
		
		// Works for 1 and 2.
		if (n <= 2) return n*area;
		
		// For future levels, multiply previous level by 3/4.
		double mult = 2, cur = .75;
		for (int i=3; i<=n; i++) {
			mult += cur;
			cur *= .75;
		}
		
		// Ta da!
		return mult*area;
	}
}