Chef has recently learnt some new facts about the famous number π. For example, he was surprised that ordinary fractions are sometimes used to represent this number approximately. For example, 22/7, 355/113 or even 103993/33102.
Soon, by calculating the value of 22/7 and 355/113 on paper Chef became quite disappointed because these values are not precise enough. For example, 22/7 differs in the third digit after the decimal point. So, these values are definitely should not be used for serious calculations.
However, Chef doesn't know anything about 103993/33102. This fraction is quite inconvenient to calculate on paper. Chef is curious how precise this value is. So he asks you to help him and to calculate the first K digits after the decimal point of such an approximation of π. He consider this ordinary fraction as infinite decimal fraction so formally he asks you to calculate this approximation truncated to the first K digits after the decimal point.

------ Input ------ 

The first line of the input contains an integer T, denoting the number of test cases. The description of T test cases follows. The only line of each test case contains a single integer K.

------ Output ------ 

For each test case output a single line containing the value of 103993/33102 truncated to the first K digits after the decimal point. Note that for K = 0 you should output just "3" without decimal point (quotes are for clarity).

------ Constraints ------ 

$0 ≤ K ≤ 10^{6}$
$1 ≤ T ≤ 2000$
$The sum of K over the input does not exceed 10^{6}$

----- Sample Input 1 ------ 
3
0
6
20
----- Sample Output 1 ------ 
3
3.141592
3.14159265301190260407
----- explanation 1 ------ 
Example case 1. Here K = 0 so we don't need to output any digits after the decimal point. The decimal point itself also should not be output.
Example case 2. Note that here we truncate (not round) the actual value of 103993/33102 to 6 digits after the decimal point. As you see from example case 3 rounded value here differs from truncated one.
Example case 3. This example is only to show that this approximation of ? is also far from perfect :)

Difficulty: EASY
Tags: Mathematics

Implementation

Starter code:

Solutions:
res = 103993 / 33102
t = int(input())
for j in range(t):
	k = int(input())
	if k == 0:
		print(int(res))
	else:
		n = 103993
		d = 33102
		temp = n // d
		n = n - d * temp
		n *= 10
		s = str(temp) + '.'
		while k:
			temp = n // d
			s += str(temp)
			n = n - d * temp
			k -= 1
			n *= 10
		print(s)


for _ in range(int(input())):
	n = int(input())
	if n == 0:
		print(3)
	else:
		a = '3.'
		b = 46870
		for i in range(n):
			a += str(b // 33102)
			b = b % 33102
			b *= 10
		print(a)


for _ in range(int(input())):
	fp = int(input())
	if fp == 0:
		print(3)
	else:
		denominator = 33102
		numerator = 103993
		result = '3.'
		for i in range(fp):
			numerator = numerator % denominator
			numerator = numerator * 10
			result += str(numerator // denominator)
		print(result)


a = int(input(''))
for i in range(a):
	x = int(input(''))
	if x == 0:
		print(3)
		continue
	(n, d) = (103993, 33102)
	s = ''
	while len(s) <= x:
		s += str(n // d)
		n = n % d * 10
	print('3.' + s[1:])


for _ in range(int(input())):
	k = int(input())
	if k == 0:
		print(3)
	else:
		r = 103993 % 33102
		d = 33102
		i = 0
		s = '3.'
		while i < k:
			r = r * 10
			s += str(r // d)
			r = r % d
			i += 1
		print(s)


T = int(input())
for i in range(T):
	k = int(input())
	if k == 0:
		print('3')
	else:
		quotient = '3.'
		r = 103993 % 33102
		for j in range(k):
			r = r * 10
			quotient = quotient + str(r // 33102)
			r = r % 33102
		print(quotient)


t = int(input())
for i in range(t):
	x = 4687
	n = int(input())
	if n == 0:
		print(3)
	else:
		ans = '3.'
		for j in range(n):
			x *= 10
			ans += str(x // 33102)
			x -= x // 33102 * 33102
		print(ans)


t = int(input())
for i in range(t):
	x = 103993
	y = 33102
	m = 103993 // 33102
	k = int(input())
	if k:
		print(m, end='.')
		for i in range(0, k):
			x = (x - y * m) * 10
			m = x // y
			print(m, end='')
		print()
	else:
		print(m)


for _ in range(int(input())):
	k = int(input())
	if k == 0:
		print(3)
	else:
		a = '3.'
		temp = 103993 % 33102
		for i in range(k):
			q = temp * 10 // 33102
			r = temp * 10 % 33102
			a += str(q)
			temp = r
		print(a)


t = int(input())
while t:
	x = 103993
	y = 33102
	k = int(input())
	division = x // y
	if k:
		print(division, end='.')
		for i in range(0, k):
			x = (x - y * division) * 10
			division = x // y
			print(division, end='')
		print()
	else:
		print(division)
	t -= 1


def high_precision_division(N, D, prec):
	whole_number = N // D
	decimal = ''
	N = N % D * 10
	for i in range(prec):
		decimal += str(N // D)
		N = N % D * 10
	return str('{}.{}'.format(whole_number, decimal))
T = int(input())
ans = []
for _ in range(T):
	K = int(input())
	if K == 0:
		ans.append(3)
	else:
		ans.append(high_precision_division(103993, 33102, K))
for i in ans:
	print(i)


from bisect import bisect_left, bisect_right
import math
from sys import maxsize
from collections import defaultdict
from bisect import bisect_left
from heapq import heapify, heappush, heappop
from collections import deque
import sys
from math import gcd, sqrt, log10, log2, floor, ceil, sqrt
from collections import deque, defaultdict
input = sys.stdin.readline

def il():
	return [int(a) for a in input().strip().split()]

def ip():
	return input().strip()

def ii():
	return int(input())

def ot(in_p, *args, e=' '):
	if type(in_p) == list:
		print(*in_p, end=e)
	if type(in_p) == str or type(in_p) == int:
		print(in_p, end=e)
		for l in args:
			print(l, end=e)
	print()

def a_pwr_n(a, n, mod):
	if n == 1:
		return a % mod
	if n % 2 == 0:
		val = a_pwr_n(a, n // 2, mod)
		return val % mod * val % mod
	else:
		return a % mod * a_pwr_n(a, n - 1, mod) % mod

def rg(*ag):
	if len(ag) == 3:
		return range(ag[0], ag[1], ag[2])
	elif len(ag) == 2:
		return range(ag[0], ag[1])
	elif len(ag) == 1:
		return range(ag[0])
	else:
		raise 'invalid input'

def ispal(i, j, st):
	while i <= j:
		if st[i] == st[j]:
			i = i + 1
			j = j - 1
		else:
			return False
	return True
mod = 1000000000 + 7
dx = [-1, -2, 1, 2, 2, -2, -1, 1]
dy = [2, 1, 2, 1, -1, -1, -2, -2]
deno = 33102
for _ in range(ii()):
	n = ii()
	if n == 0:
		out = '3'
	else:
		out = '3.'
		up = 103993 % deno
		while n > 0:
			up *= 10
			out += str(up // deno)
			up %= deno
			n -= 1
	print(out)


for _ in range(int(input())):
	k = int(input())
	a = 103993
	b = 33102
	m = a % b
	ans = ''
	n = k
	while n > 0:
		p = 0
		m *= 10
		while m < b:
			p += 1
			m *= 10
			n -= 1
		n -= 1
		ans += '0' * p + str(m // b)
		m = m % b
	if k == 0:
		print(3)
	else:
		print('3.' + ans[0:k])


a = [0] * (10 ** 6 + 3)
p = 103993
q = 33102
a[0] = str(p // q)
a[1] = '.'
p = p % q * 10
for i in range(2, 10 ** 6 + 3):
	a[i] = str(p // q)
	p = p % q * 10
t = int(input())
for i in range(t):
	k = int(input())
	if k == 0:
		print(3)
	elif k == 1:
		print(''.join(a[:3]))
	elif k == 2:
		print(''.join(a[:4]))
	else:
		print(''.join(a[:k + 2]))


for _ in range(int(input())):
	n = int(input())
	(x, y) = (103993, 33102)
	if n == 0:
		print('3')
	else:
		s = '3.'
		for i in range(n):
			x %= y
			x *= 10
			s += str(x // y)
		print(s)


def calculatePi(k):
	dividend = 103993
	divisor = 33102
	ans = '3'
	if k == 0:
		return ans
	else:
		ans = ans + '.'
		for i in range(k):
			dividend = dividend % divisor
			dividend = dividend * 10
			ans = ans + str(dividend // divisor)
	return ans

def main():
	for t in range(int(input())):
		k = int(input())
		print(calculatePi(k))

def test():
	for k in [0, 6, 20, 100]:
		print(calculatePi(k))
main()


T = int(input())
for _ in range(T):
	k = int(input())
	if k == 0:
		print(3)
		continue
	s = ''
	(n, d) = (103993, 33102)
	while len(s) <= k:
		s += str(n // d)
		n = n % d * 10
	print('3.' + s[1:])


for _ in range(int(input())):
	n = int(input())
	s = ''
	if n == 0:
		print(3)
	else:
		(a, b) = (103993, 33102)
		for i in range(n + 1):
			if i == 1:
				s += '.'
			s += str(a // b)
			a = a % b * 10
		print(s)


b = 33102
for _ in range(int(input())):
	a = 103993 % b * 10
	k = int(input())
	if k:
		ans = '3.'
		for i in range(k):
			ans += str(a // b)
			a = a % b * 10
		print(ans)
	else:
		print(3)


t = int(input())
for _ in range(0, t):
	k = int(input())
	a = 103993
	b = 33102
	i = 0
	r = a % b
	y = '3.'
	if k == 0:
		print(3)
	else:
		while i != k:
			r = r * 10
			y = y + str(r // b)
			r = r % b
			i += 1
		print(y)


t = int(input())
for t in range(t):
	k = int(input())
	if k == 0:
		print(3)
	else:
		n = 103993
		d = 33102
		s = ''
		while k >= 0:
			s += str(n // d)
			n = n % d * 10
			k = k - 1
		print('3.' + s[1:])


n = int(input())
for i in range(n):
	m = int(input())
	a = '3'
	if m == 0:
		print(a)
		continue
	a = a + '.'
	number = 4687
	d = 33102
	for i in range(m):
		number *= 10
		a += str(number // d)
		number = number % d
	print(a)


for _ in range(int(input())):
	k = int(input())
	if k == 0:
		print('3')
	else:
		a = [0] * (k + 2)
		p = 103993
		q = 33102
		a[0] = str(p // q)
		a[1] = '.'
		p = p % q * 10
		for i in range(2, k + 2):
			a[i] = str(p // q)
			p = p % q * 10
		print(''.join(a))


for _ in range(0, int(input())):
	k = int(input())
	if k == 0:
		print(3)
	else:
		ans = '3' + '.'
		n = 103993
		d = 33102
		for i in range(0, k):
			n = n % d
			n = n * 10
			ans += str(n // d)
		print(ans)


t = int(input())
for _ in range(t):
	n = int(input())
	if n == 0:
		print(3)
	else:
		arr = ''
		(val, i) = (103993 % 33102, 0)
		while i < n:
			val = val * 10
			temp = val // 33102
			val = val % 33102
			arr += str(temp)
			i += 1
		print('3' + '.' + arr)


from decimal import Decimal
tests = int(input())
for i in range(tests):
	num = int(input())
	if num == 0:
		print(3)
	else:
		ans = '3.'
		d = 103993 % 33102
		for i in range(num):
			q = d * 10 // 33102
			r = d * 10 % 33102
			ans += str(q)
			d = r
		print(ans)


t = int(input())
for i in range(t):
	K = int(input())
	if K == 0:
		print(3)
	else:
		a = '3.'
		b = 103993 % 33102
		for i in range(K):
			b *= 10
			a += str(b // 33102)
			b = b % 33102
		print(a)


for _ in range(int(input())):
	N = int(input())
	if N == 0:
		print(3)
		continue
	S = ''
	(n, d) = (103993, 33102)
	while len(S) <= N:
		S += str(n // d)
		n = n % d * 10
	print('3.' + S[1:])


for _ in range(int(input())):
	s = '3'
	n = int(input())
	dividend = 103993
	divisor = 33102
	if n > 0:
		s = s + '.'
	dividend = (dividend - dividend // divisor * divisor) * 10
	while n > 0:
		s = s + str(dividend // divisor)
		dividend = (dividend - dividend // divisor * divisor) * 10
		n = n - 1
	print(s)


for _ in range(int(input())):
	k = int(input())
	n = 103993
	d = 33102
	r = n % d
	res = '3.'
	for i in range(1, k + 1):
		r = r * 10
		res += str(r // d)
		r = r % d
	if k == 0:
		print(3)
	else:
		print(res)


def pi_equals(K):
	num = 4687
	den = 33102
	ans = '3'
	if K != 0:
		ans += '.'
	for i in range(K):
		num *= 10
		digit = num // den
		ans += str(digit)
		num %= den
	return ans
T = int(input())
for i in range(T):
	K = int(input())
	print(pi_equals(K))


for i in range(int(input())):
	k = int(input())
	a = 103993
	b = 33102
	s = '3'
	if k == 0:
		print(s)
	else:
		s = s + '.'
		for j in range(k):
			a = a % b
			a = a * 10
			s = s + str(a // b)
		print(s)


import math
for t in range(int(input())):
	k = int(input())
	a = 103993
	b = 33102
	res = '3.'
	if k == 0:
		print(3)
		continue
	i = 0
	while i < k:
		a = a % b * 10
		temp = a // b
		res += str(temp)
		i += 1
	print(res)


import decimal
for tc in range(int(input())):
	k = int(input())
	decimal.getcontext().rounding = 'ROUND_DOWN'
	if k > 0:
		decimal.getcontext().prec = k + 1
	x = decimal.Decimal(103993) / decimal.Decimal(33102)
	if k == 0:
		print(int(x))
	else:
		print(x)


def calculatePi(k):
	di = 103993
	d = 33102
	ans = '3'
	if k == 0:
		return ans
	else:
		ans = ans + '.'
		for i in range(k):
			di = di % d
			di = di * 10
			ans = ans + str(di // d)
	return ans
for oo in range(int(input())):
	n = int(input())
	print(calculatePi(n))


tc = int(input())
for _ in range(tc):
	k = int(input())
	ans = '3'
	if k == 0:
		print(ans)
		continue
	ans = ans + '.'
	num = 4687
	den = 33102
	for i in range(k):
		num *= 10
		ans += str(num // den)
		num = num % den
	print(ans)


for _ in range(int(input())):
	x = 4687
	k = int(input())
	if k == 0:
		print(3)
	else:
		ans = '3.'
		for _ in range(k):
			x *= 10
			ans += str(x // 33102)
			x -= x // 33102 * 33102
		print(ans)


for _ in range(int(input())):
	k = int(input())
	print('3', end='')
	divisor = 4687
	quotient = 33102
	val = 0
	for i in range(1, k + 1):
		if divisor < quotient:
			divisor *= 10
			val = divisor // quotient
			divisor = divisor % quotient
		if i == 1:
			print('.{}'.format(val), end='')
		else:
			print(val, end='')
	print()


try:
	from decimal import Decimal, getcontext
	getcontext().prec = 10000005
	s = str(Decimal(103993) / Decimal(33102))
	for i in range(int(input())):
		n = int(input())
		print(s[:n + 2] if n != 0 else '3')
except:
	pass


for _ in range(int(input())):
	k = int(input())
	if k == 0:
		print(3)
	else:
		ans = '3.'
		t = 103993 % 33102
		for _ in range(k):
			q = t * 10 // 33102
			r = t * 10 % 33102
			ans += str(q)
			t = r
		print(ans)


n = int(input())
for i in range(n):
	p = int(input())
	if p == 0:
		print('3')
	else:
		n = 103993
		d = 33102
		res = '3.'
		for j in range(p):
			n = n % d
			n = n * 10
			res += str(n // d)
		print(res)


t = int(input())
while t:
	k = int(input())
	ans = '3.'
	a = 103993
	b = 33102
	a = a % b * 10
	if k == 0:
		print(3)
	else:
		while k:
			ans += str(a // b)
			a = a % b * 10
			k -= 1
		print(ans)
	t -= 1


t = input()
for c in range(0, int(t)):
	num = int(input())
	if num == 0:
		print(3)
	else:
		ans = '3.'
		d = 103993 % 33102
		for i in range(num):
			q = d * 10 // 33102
			r = d * 10 % 33102
			ans += str(q)
			d = r
		print(ans)


T = int(input())
for i in range(T):
	x = 103993
	y = 33102
	k = int(input())
	division = x // y
	if k:
		print(division, end='.')
		for i in range(0, k):
			x = (x - y * division) * 10
			division = x // y
			print(division, end='')
		print()
	else:
		print(division)


t = int(input())
for __ in range(t):
	k = int(input())
	if k == 0:
		print(3)
		continue
	s = ''
	n = 103993
	d = 33102
	while len(s) <= k:
		s += str(n // d)
		n = n % d * 10
	print('3.' + s[1:])