per nextum in unam tum XI conscribementis fac sic

    vestibulo perlegementum da varo.

    morde varo.

    seqis cumula varum.

cis



per nextum in unam tum XI conscribementis fac sic

    seqis decumulamenta da varo.

    varum privamentum fodementum da aresulto.

    varum tum III elevamentum tum V multiplicamentum da bresulto.

    aresultum tum bresultum addementum da resulto.



    si CD tum resultum non praestantiam fac sic

        dictum sic f(%d) = %.2f cis tum varum tum resultum egresso describe.

        novumversum egresso scribe.

    cis

    si CD tum resultum praestantiam fac sic

        dictum sic f(%d) = MAGNA NIMIS! cis tum varum egresso describe.

        novumversum egresso scribe.        

    cis

cis




-----Input-----

The input consists of several integers, one per line. Each integer is between -50 and 50, inclusive.


-----Output-----

As described in the problem statement.


-----Example-----
Input
0
1
-2
-3
-4
-5
-6
-7
-8
-9
10

Output
f(10) = MAGNA NIMIS!
f(-9) = -3642.00
f(-8) = -2557.17
f(-7) = -1712.35
f(-6) = -1077.55
f(-5) = -622.76
f(-4) = -318.00
f(-3) = -133.27
f(-2) = -38.59
f(1) = 6.00
f(0) = 0.00

Difficulty: MEDIUM

Starter code:

Solutions:
s = [int(input()) for i in range(11)]
s.reverse()
for x in s:
	r = abs(x) ** 0.5 + 5 * x ** 3
	if r > 400:
		print('f(%d) = %s' % (x, 'MAGNA NIMIS!'))
	else:
		print('f(%d) = %.2f' % (x, r))


varo = []
seqis = 0
for i in range(11):
	varo.append(int(input()))
	seqis += 1
for i in range(11):
	seqis -= 1
	a = abs(varo[seqis]) ** 0.5
	b = varo[seqis] ** 3 * 5
	result = a + b
	if 400 > result:
		print('f(', varo[seqis], ') = ', '%.2f' % result, sep='')
	else:
		print('f(', varo[seqis], ') = MAGNA NIMIS!', sep='')


from math import sqrt
a = []
for i in range(11):
	a.append(int(input()))
for i in range(10, -1, -1):
	x = a[i]
	aresult = sqrt(abs(x))
	bresult = x * x * x * 5
	result = aresult + bresult
	print('f(' + str(x) + ') = ', sep='', end='')
	if result >= 400:
		print('MAGNA NIMIS!')
	else:
		print('%.2f' % result)


data = []
for nextum in range(1, 12):
	data.append(int(input()))
data.reverse()
for x in data:
	res = x ** 3 * 5
	res += abs(x) ** 0.5
	if res <= 400:
		print('f({0}) ='.format(x), '{:.2f}'.format(res))
	else:
		print('f({0}) = MAGNA NIMIS!'.format(x))


l = [int(input()) for i in range(11)]
for i in range(11):
	x = l.pop()
	a = abs(x) ** 0.5
	b = x ** 3 * 5
	r = a + b
	if r > 400:
		print('f({}) = MAGNA NIMIS!'.format(x))
	else:
		print('f({}) = {:.2f}'.format(x, r))


from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def main():
	stack = [int(input().strip()) for _ in range(11)]
	for _ in range(11):
		v = stack.pop()
		a = abs(v) ** 0.5
		b = v ** 3 * 5
		result = a + b
		if result > 400:
			print('f({}) = MAGNA NIMIS!'.format(v))
		else:
			print('f({}) = {:.2f}'.format(v, result))
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


from math import sqrt
numbers = [int(input()) for i in range(11)]
for number in reversed(numbers):
	answer = sqrt(abs(number)) + 5 * number * number * number
	print('f(%d) = %.2f' % (number, answer)) if answer <= 400 else print('f(%d) = MAGNA NIMIS!' % number)


import math

def f(t):
	return math.sqrt(abs(t)) + 5 * t ** 3
a = [float(input()) for _ in range(11)]
for (i, t) in reversed(list(enumerate(a))):
	y = f(t)
	t = int(t)
	if y > 400:
		print(f'f({t}) = MAGNA NIMIS!')
	else:
		print(f'f({t}) =', '{:.2f}'.format(y))


from math import sqrt
arr = [0 for _ in range(11)]
for i in range(11):
	arr[10 - i] = int(input())
for i in arr:
	tmp = sqrt(abs(i)) + i ** 3 * 5
	if tmp >= 400:
		print('f({}) = MAGNA NIMIS!'.format(i))
	else:
		print('f({}) = {:.2f}'.format(i, round(tmp, 2)))


a = ['f(50) = MAGNA NIMIS!', 'f(49) = MAGNA NIMIS!', 'f(48) = MAGNA NIMIS!', 'f(47) = MAGNA NIMIS!', 'f(46) = MAGNA NIMIS!', 'f(45) = MAGNA NIMIS!', 'f(44) = MAGNA NIMIS!', 'f(43) = MAGNA NIMIS!', 'f(42) = MAGNA NIMIS!', 'f(41) = MAGNA NIMIS!', 'f(40) = MAGNA NIMIS!', 'f(39) = MAGNA NIMIS!', 'f(38) = MAGNA NIMIS!', 'f(37) = MAGNA NIMIS!', 'f(36) = MAGNA NIMIS!', 'f(35) = MAGNA NIMIS!', 'f(34) = MAGNA NIMIS!', 'f(33) = MAGNA NIMIS!', 'f(32) = MAGNA NIMIS!', 'f(31) = MAGNA NIMIS!', 'f(30) = MAGNA NIMIS!', 'f(29) = MAGNA NIMIS!', 'f(28) = MAGNA NIMIS!', 'f(27) = MAGNA NIMIS!', 'f(26) = MAGNA NIMIS!', 'f(25) = MAGNA NIMIS!', 'f(24) = MAGNA NIMIS!', 'f(23) = MAGNA NIMIS!', 'f(22) = MAGNA NIMIS!', 'f(21) = MAGNA NIMIS!', 'f(20) = MAGNA NIMIS!', 'f(19) = MAGNA NIMIS!', 'f(18) = MAGNA NIMIS!', 'f(17) = MAGNA NIMIS!', 'f(16) = MAGNA NIMIS!', 'f(15) = MAGNA NIMIS!', 'f(14) = MAGNA NIMIS!', 'f(13) = MAGNA NIMIS!', 'f(12) = MAGNA NIMIS!', 'f(11) = MAGNA NIMIS!', 'f(10) = MAGNA NIMIS!', 'f(9) = MAGNA NIMIS!', 'f(8) = MAGNA NIMIS!', 'f(7) = MAGNA NIMIS!', 'f(6) = MAGNA NIMIS!', 'f(5) = MAGNA NIMIS!', 'f(4) = 322.00', 'f(3) = 136.73', 'f(2) = 41.41', 'f(1) = 6.00', 'f(0) = 0.00', 'f(-1) = -4.00', 'f(-2) = -38.59', 'f(-3) = -133.27', 'f(-4) = -318.00', 'f(-5) = -622.76', 'f(-6) = -1077.55', 'f(-7) = -1712.35', 'f(-8) = -2557.17', 'f(-9) = -3642.00', 'f(-10) = -4996.84', 'f(-11) = -6651.68', 'f(-12) = -8636.54', 'f(-13) = -10981.39', 'f(-14) = -13716.26', 'f(-15) = -16871.13', 'f(-16) = -20476.00', 'f(-17) = -24560.88', 'f(-18) = -29155.76', 'f(-19) = -34290.64', 'f(-20) = -39995.53', 'f(-21) = -46300.42', 'f(-22) = -53235.31', 'f(-23) = -60830.20', 'f(-24) = -69115.10', 'f(-25) = -78120.00', 'f(-26) = -87874.90', 'f(-27) = -98409.80', 'f(-28) = -109754.71', 'f(-29) = -121939.61', 'f(-30) = -134994.52', 'f(-31) = -148949.43', 'f(-32) = -163834.34', 'f(-33) = -179679.26', 'f(-34) = -196514.17', 'f(-35) = -214369.08', 'f(-36) = -233274.00', 'f(-37) = -253258.92', 'f(-38) = -274353.84', 'f(-39) = -296588.76', 'f(-40) = -319993.68', 'f(-41) = -344598.60', 'f(-42) = -370433.52', 'f(-43) = -397528.44', 'f(-44) = -425913.37', 'f(-45) = -455618.29', 'f(-46) = -486673.22', 'f(-47) = -519108.14', 'f(-48) = -552953.07', 'f(-49) = -588238.00', 'f(-50) = -624992.93']
b = [int(input()) for i in range(11)]
for i in b[::-1]:
	print(a[50 - i])


a = []
for i in range(11):
	a.append(int(input()))
for i in range(11):
	x = a.pop()
	r = abs(x) ** 0.5 + x ** 3 * 5
	if r <= 400:
		print('f(%d) = %.2f' % (x, r))
	else:
		print('f(%d) = MAGNA NIMIS!' % x)


a = 11
arr = []
while a > 0:
	n = int(input())
	arr.append(n)
	a -= 1
for el in arr[::-1]:
	q = abs(el) ** 0.5
	w = el ** 3 * 5
	e = q + w
	if e > 400:
		print('f({}) = MAGNA NIMIS!'.format(el))
	else:
		print('f({}) = {:.2f}'.format(el, e))


aa = []
for i in range(11):
	x = int(input())
	aa.append(x)
for x in aa[::-1]:
	a = x ** 3 * 5
	b = abs(x) ** 0.5
	ans = a + b
	if ans >= 400:
		print('f(' + str(x) + ') = MAGNA NIMIS!')
	else:
		print('f(' + str(x) + ') = ' + '%.2f' % ans)


a = [int(input()) for _ in range(11)][::-1]
for i in range(11):
	x = abs(a[i]) ** 0.5
	y = a[i] ** 3 * 5
	r = x + y
	if r < 400:
		print(f'f({a[i]}) = {r:.2f}')
	else:
		print(f'f({a[i]}) = MAGNA NIMIS!')


def solve(x):
	if x < 0:
		A = round((5 * x * x * x + (-x) ** 0.5) * 100)
		print('f({}) ='.format(x), '%.2f' % (A / 100 + 0.002))
		return 0
	else:
		A = round((5 * x * x * x + x ** 0.5) * 100)
		if A >= 40000:
			A = 'MAGNA NIMIS!'
			print('f(' + str(x) + ')', '=', A)
		else:
			print('f({}) ='.format(x), '%.2f' % (A / 100 + 0.002))
		return 0
Q = [int(input()) for i in range(11)]
for i in range(10, -1, -1):
	solve(Q[i])


from math import sqrt
nums = []
for i in range(11):
	nums.append(int(input()))
nums.reverse()
for i in nums:
	neg = i < 0
	a = sqrt(abs(i))
	b = i ** 3
	b *= 5
	if not 400 < a + b:
		print('f(' + str(i) + ') = {:0.2f}'.format(a + b))
	if 400 < a + b:
		print('f(' + str(i) + ') = MAGNA NIMIS!')


def f(x):
	a = abs(x) ** 0.5
	b = x ** 3 * 5
	r = a + b
	return 'MAGNA NIMIS!' if 400 < r else format(r, '.2f')
for x in reversed(list((int(input()) for _ in range(11)))):
	print('f({}) = {}'.format(x, f(x)))


s = [int(input()) for i in range(1, 12)][::-1]
for i in range(11):
	a = s[i]
	a = (a if a > 0 else -a) ** 0.5
	b = s[i] ** 3 * 5
	r = a + b
	if r > 400:
		print('f({}) = MAGNA NIMIS!'.format(s[i]))
	else:
		print('f({}) = {:.2f}'.format(s[i], r))


import math
seq = []
for next in range(11):
	seq.append(int(input()))
for next in range(11):
	var = seq.pop()
	aresult = math.sqrt(abs(var))
	bresult = var ** 3 * 5
	result = aresult + bresult
	if 400 >= result:
		print('f(%d) = %.2f' % (var, result))
	else:
		print('f(%d) = MAGNA NIMIS!' % var)


s = [0] * 11
for i in range(11):
	s[i] = int(input())
for i in range(10, -1, -1):
	ares = abs(s[i]) ** 0.5
	bres = s[i] ** 3 * 5
	res = ares + bres
	if res < 400:
		print('f({}) = {:.2f}'.format(s[i], res))
	else:
		print('f({}) = MAGNA NIMIS!'.format(s[i]))


def func(n):
	a = abs(n) ** 0.5
	b = n ** 3 * 5
	res = a + b
	print('f(%d) = ' % n, end='')
	if res > 400:
		print('MAGNA NIMIS!')
	else:
		print('%.2f' % res)
inp = [int(input()) for i in range(11)]
for n in reversed(inp):
	func(n)


from math import sqrt
l = []
for i in range(11):
	l.append(int(input()))
for v in reversed(l):
	x = int(v)
	ans = 5 * x ** 3 + sqrt(abs(x))
	if ans > 400:
		print(str.format('f({}) = MAGNA NIMIS!', x))
	else:
		print(str.format('f({}) = {:.2f}', x, ans))


from math import sqrt as s

def main():
	inp = list()
	for _ in range(11):
		inp.append(int(input()))
	for num in reversed(inp):
		result = s(abs(num)) + num * num * num * 5
		print(f'f({num}) = ', end='', sep='')
		if result >= 400:
			print('MAGNA NIMIS!')
		else:
			print('%.2f' % result)
main()


from math import sqrt
f = lambda x: sqrt(abs(x))
g = lambda x: x ** 3 * 5
arr = []
for _ in range(11):
	arr.append(int(input()))
arr.reverse()
for e in arr:
	r = f(e) + g(e)
	if 400 < r:
		print('f(%d) = ' % e + 'MAGNA NIMIS!')
		continue
	print('f(%d) = %.2f' % (e, r))


from math import sqrt
a = []
for i in range(11):
	a.append(int(input()))
for x in a[::-1]:
	a = sqrt(abs(x))
	b = 5 * x ** 3
	if a + b <= 400:
		print('f(%d) = %.2f' % (x, a + b))
	else:
		print('f(%d) = MAGNA NIMIS!' % x)


from sys import stdin
lines = [int(x) for x in stdin.readlines()[::-1]]
for x in lines:
	if x < 0:
		ares = (-x) ** 0.5
	else:
		ares = x ** 0.5
	res = ares + x ** 3 * 5
	if res >= 400:
		print('f(%d) = MAGNA NIMIS!' % x)
	else:
		print('f(%d) = %.2f' % (x, res))


from math import *
arr = []
for n in range(1, 11 + 1):
	v = int(input())
	arr = [v] + arr
for n in range(1, 11 + 1):
	J = arr.pop(0)
	temp = J
	a = sqrt(abs(temp))
	b = temp ** 3 * 5
	r = a + b
	if r < 400:
		r = (str(round(r, 2)) + '0').split('.')
		r[1] = r[1][0:2]
		r = '.'.join(r)
		print(f'f({J}) = {r}')
	else:
		print(f'f({J}) = MAGNA NIMIS!')


l = [0 for i in range(11)]
for i in range(11):
	l[i] = int(input())
l.reverse()
for i in l:
	a = i ** 3 * 5 + abs(i) ** 0.5
	if a > 400:
		print('f(' + str(i) + ') = MAGNA NIMIS!')
		continue
	print('f(' + str(i) + ') =', format(a, '.2f'))


cumula = list()
for _ in range(11):
	cumula.append(int(input()))
for _ in range(11):
	varo = cumula.pop()
	aresulto = abs(varo ** (1 / 2))
	bresulto = varo ** 3 * 5
	resulto = aresulto + bresulto
	print(f'f({varo}) =', end=' ')
	if 400 >= resulto:
		print('%.2f' % resulto)
	else:
		print('MAGNA NIMIS!')


l = []
for i in range(0, 11):
	n = int(input())
	mn = abs(n) ** 0.5 + 5 * n ** 3
	if mn > 400:
		s = 'f(' + str(n) + ') = MAGNA NIMIS!'
	else:
		mn = format(mn, '.2f')
		s = 'f(' + str(n) + ') = ' + mn
	l.insert(0, s)
for el in l:
	print(el)


import math
from decimal import Decimal

def func(input):
	aresult = math.sqrt(abs(var))
	bresult = var ** 3 * 5
	result = aresult + bresult
	return result
ans_list = []
for _ in range(11):
	var = int(input())
	res = func(var)
	if 400 > res:
		ans_list.append('f({var}) = {res}'.format(var=var, res=Decimal(res).quantize(Decimal('0.00'))))
	else:
		ans_list.append('f({var}) = MAGNA NIMIS!'.format(var=var))
for ans in reversed(ans_list):
	print(ans)


a = []
for i in range(11):
	a.append(int(input()))
for i in range(10, -1, -1):
	temp = abs(a[i]) ** (1 / 2) + 5 * a[i] ** 3
	if temp >= 400:
		print('f({}) = MAGNA NIMIS!'.format(a[i]))
	else:
		print('f({}) = {:.2f}'.format(a[i], temp))


num = []
for i in range(11):
	num.append(int(input()))
num = num[::-1]
for x in num:
	val = x ** 3 * 5 + abs(x) ** 0.5
	if val > 400:
		print('f({}) = MAGNA NIMIS!'.format(x))
	else:
		print('f({}) = {:.2f}'.format(x, val))


import sys
import math
for nraw in sys.stdin.read().strip().split('\n')[::-1]:
	n = int(nraw)
	res = n ** 3 * 5 + math.sqrt(abs(n))
	if res > 400:
		print('f(%d) = MAGNA NIMIS!' % n)
	else:
		print('f(%d) = %.2f' % (n, res))


seq = []
for x in range(11):
	seq.append(int(input()))
p = 0
while seq:
	c = seq[-1]
	del seq[-1]
	r = abs(c) ** 0.5 + c ** 3 * 5
	if r < 400:
		print('f(%d) = %.2f' % (c, r))
	else:
		print('f(%d) = MAGNA NIMIS!' % c)


import math
inp = []
for i in range(11):
	x = float(input())
	inp.append(x)
for x in reversed(inp):
	ans = math.sqrt(abs(x)) + x ** 3 * 5
	if ans > 400:
		print(f'f({int(x)}) = MAGNA NIMIS!')
	else:
		print(f'f({int(x)}) = {ans:.2f}')


ls = list()
for i in range(11):
	n = int(input())
	ls.append(n)
for i in range(10, -1, -1):
	a = ls[i]
	aresult = abs(a) ** (1 / 2)
	bresult = a ** 3 * 5
	result = aresult + bresult
	if result < 400:
		s = format(result, '.2f')
		print('f(' + str(a) + ') = ' + s)
	else:
		print('f(' + str(a) + ') = MAGNA NIMIS!')


data = [int(input()) for x in range(11)]
for x in data[::-1]:
	res = x ** 3 * 5 + abs(x) ** 0.5
	if res >= 400:
		print(f'f({x}) = MAGNA NIMIS!')
	else:
		print(f'f({x}) = {res:0.2f}')


from math import sqrt, pow

def f(x):
	sign = 1 if x > 0 else -1 if x < 0 else 0
	aresult = sqrt(abs(x))
	bresult = pow(x, 3) * 5
	result = bresult + aresult
	return result
arr = []
for i in range(11):
	x = int(input())
	arr.append(x)
for x in reversed(arr):
	result = f(x)
	print(f'f({x}) = ', end='')
	if result >= 400:
		print('MAGNA NIMIS!')
	else:
		print(f'{result:.2f}')


ls = []
for __ in range(11):
	ls.append(int(input()))
for x in reversed(ls):
	ans = 5 * x ** 3 + abs(x) ** 0.5
	if ans > 400:
		print('f({}) = MAGNA NIMIS!'.format(x))
	else:
		print('f({}) = {:.2f}'.format(x, ans))


import re
s = '\nper nextum in unam tum XI conscribementis fac sic\n    vestibulo perlegementum da varo.\n    morde varo.\n    seqis cumula varum.\ncis\n\nper nextum in unam tum XI conscribementis fac sic\n    seqis decumulamenta da varo.\n    varum privamentum fodementum da aresulto.\n    varum tum III elevamentum tum V multiplicamentum da bresulto.\n    aresultum tum bresultum addementum da resulto.\n\n    si CD tum resultum non praestantiam fac sic\n        dictum sic f(%d) = %.2f cis tum varum tum resultum egresso describe.\n        novumversum egresso scribe.\n    cis\n    si CD tum resultum praestantiam fac sic\n        dictum sic f(%d) = MAGNA NIMIS! cis tum varum egresso describe.\n        novumversum egresso scribe.        \n    cis\ncis\n'.strip()
if False:
	s = re.sub('\\bIII\\b', '3', s)
	s = re.sub('\\bV\\b', '5', s)
	s = re.sub('\\bXI\\b', '11', s)
	s = re.sub('\\bCD\\b', '400', s)
	s = re.sub('per (.*?) fac sic(.*?)\\ncis', 'for (\\1) {\\2\\n}', s, flags=re.DOTALL)
	s = re.sub('\\bdictum sic (.*) cis(.*) egresso describe.', 'printf("\\1"\\2)', s)
	s = re.sub('novumversum egresso scribe.', 'print("\\\\n")', s)
	s = re.sub('si (.*?) fac sic(.*?)cis', 'if (\\1) {\\2}', s, flags=re.DOTALL)
	s = re.sub('.$', '', s)
	s = re.sub(' tum ', ' ', s)
	print(s)
	return
a = []
for i in range(11):
	a.append(int(input()))
for i in range(11):
	var = a.pop()
	aresult = abs(var) ** 0.5
	bresult = var ** 3 * 5
	result = aresult + bresult
	if 400 > result:
		print('f({0:d}) = {1:.2f}'.format(var, result))
	else:
		print('f({0:d}) = MAGNA NIMIS!'.format(var))


lst = []
for nextum in range(1, 12):
	lst.append(int(input()))
lst.reverse()
for nextum in range(1, 12):
	var = lst[nextum - 1]
	aresult = abs(var) ** 0.5
	bresult = var ** 3 * 5
	result = aresult + bresult
	if result < 400:
		print(f'f({var}) = {result: .2f}')
	else:
		print(f'f({var}) = MAGNA NIMIS!')


def f(x):
	return abs(x) ** 0.5 + 5 * x ** 3
l = [0] * 11
for i in range(11):
	l[i] = int(input())
l.reverse()
for i in l:
	print('f(' + str(i) + ') = ', end='')
	result = f(i)
	if result > 400:
		print('MAGNA NIMIS!')
	else:
		print('{:.2f}'.format(result))


from math import *
stack = []
for _ in range(11):
	stack.append(int(input()))
for i in range(11):
	var = stack.pop()
	a = sqrt(abs(var))
	b = var ** 3 * 5
	res = a + b
	if res <= 400:
		print(f'f({var}) = {res:.2f}')
	else:
		print(f'f({var}) = MAGNA NIMIS!')


stack = []
for _ in range(11):
	stack += (int(input()),)
while stack:
	v = stack.pop()
	a = abs(v) ** (1 / 2)
	b = v ** 3 * 5
	r = a + b
	if r > 400:
		print('f({}) = MAGNA NIMIS!'.format(v))
	else:
		print('f({}) = {:.2f}'.format(v, r))


def toFixed(numObj, digits=0):
	return f'{numObj:.{digits}f}'
rome = [None] * 11
for nextum in range(11):
	rome[-nextum - 1] = int(input())
for nextum in rome:
	resultum = (nextum ** 2) ** 0.25 + 5 * nextum ** 3
	if resultum <= 400:
		print('f({}) = {:.2f}'.format(nextum, resultum))
	else:
		print('f({}) = MAGNA NIMIS!'.format(nextum))


t = []
while True:
	try:
		x = int(input())
		t += [x]
	except:
		break
for x in t[::-1]:
	print('f(%d) = %s' % (x, '%.2f' % (5 * x ** 3 + abs(x) ** 0.5) if x < 5 else 'MAGNA NIMIS!'))


l = []
for i in range(11):
	l = [int(input())] + l
for i in range(11):
	v = l[i]
	out = 5 * v ** 3 + abs(v) ** 0.5
	if out <= 400:
		print('f({0}) = {1:.2f}'.format(v, out))
	else:
		print('f({0}) = MAGNA NIMIS!'.format(v, out))


def solve(i):
	x = int(input())
	a = abs(x) ** 0.5
	b = x ** 3 * 5
	res = a + b
	if i > 1:
		solve(i - 1)
	if res < 400:
		print('f({}) = {:.2f}'.format(x, res))
	else:
		print('f({}) = MAGNA NIMIS!'.format(x))
solve(11)


for l in reversed([int(input()) for _ in range(11)]):
	ans = abs(l) ** 0.5 + l ** 3 * 5
	print('f({}) ='.format(l), '{:0.2f}'.format(ans) if 400 >= ans else 'MAGNA NIMIS!')


import math

def f(t):
	return math.sqrt(abs(t)) + 5 * t ** 3
a = [int(input()) for _ in range(11)]
for t in reversed(a):
	y = f(t)
	if y > 400:
		print(f'f({t}) = MAGNA NIMIS!')
	else:
		print(f'f({t}) = {y:.2f}')


import math
a = [int(input()) for i in range(11)][::-1]
for i in a:
	p = i ** 3 * 5 + math.sqrt(abs(i))
	if p >= 400.0:
		print('f({}) = MAGNA NIMIS!'.format(i))
	else:
		print('f({}) = {:.2f}'.format(i, p))


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			self.os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
import time
start_time = time.time()
import collections as col
import math, string
from functools import reduce

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())
MOD = 10 ** 9 + 7

def solve():
	A = []
	for i in range(11):
		A.append(getInt())
	A = A[::-1]

	def f_(x):
		return math.sqrt(abs(x)) + 5 * x ** 3
	for a in A:
		y = f_(a)
		if y > 400:
			print('f({}) ='.format(a), 'MAGNA NIMIS!')
		else:
			print('f({}) ='.format(a), '%.2f' % y)
	return
solve()


from collections import deque
import math
numbers = deque()
for _ in range(11):
	numbers.append(int(input()))
for _ in range(11):
	num = numbers.pop()
	a = math.sqrt(abs(num))
	b = num ** 3 * 5
	res = a + b
	if res < 400:
		print('f(%d) = %.2f' % (num, res))
	else:
		print('f(%d) = MAGNA NIMIS!' % num)


import math
ls = []
for i in range(11):
	ls.append(int(input()))
for i in range(11):
	var = ls.pop()
	a = math.sqrt(abs(var))
	b = var ** 3 * 5
	res = a + b
	if 400 >= res:
		print('f(%d) = %.2f' % (var, res))
	else:
		print('f(%d) = MAGNA NIMIS!' % var)


import math
arr = []
while True:
	try:
		n = int(input())
		arr.append(n)
	except:
		break
arr = arr[::-1]
for x in arr:
	if x >= 0:
		a = math.sqrt(abs(x))
		b = 5 * abs(x) ** 3
	else:
		a = math.sqrt(abs(x))
		b = -5 * abs(x) ** 3
	fin = a + b
	fin = round(fin, 2)
	fin = str(fin)
	if str(fin[-3]) != '.':
		fin += '0'
	if float(fin) <= 400:
		print('f(' + str(x) + ') =', str(fin))
	else:
		print('f(' + str(x) + ') = MAGNA NIMIS!')


import math
res = list()
for i in range(11):
	n = int(input())
	p = math.sqrt(math.fabs(n)) + n ** 3 * 5
	res.append((n, p))
for (k, v) in res[::-1]:
	if v < 400:
		print('f(%d) = %.2f' % (k, v))
	else:
		print('f(%d) = MAGNA NIMIS!' % k)


import typing
lst = []
for i in range(11):
	lst.append(int(input()))
for n in reversed(lst):
	a = abs(n) ** 0.5
	b = n ** 3 * 5
	res = a + b
	if res <= 400:
		print('f({}) = {:.2f}'.format(n, round(res, 2)))
	else:
		print('f({}) = MAGNA NIMIS!'.format(n))


import math
arrInput = []
for i in range(11):
	inp = int(input())
	arrInput.append(inp)
arrReverse = list(reversed(arrInput))
for item in arrReverse:
	a = math.sqrt(abs(item))
	b = item * item * item * 5
	res = a + b
	if res > 400:
		print(f'f({item}) = MAGNA NIMIS!')
	else:
		formattedRes = '{:.2f}'.format(res)
		print(f'f({item}) = {formattedRes}')


x = []
for i in range(11):
	x.append(int(input()))
x = x[::-1]
for i in range(11):
	a = x[i]
	b = x[i]
	a = abs(a) ** 0.5
	b = b ** 3 * 5
	if a + b > 400:
		print(f'f({x[i]}) = MAGNA NIMIS!')
	else:
		print(f'f({x[i]}) = ', end='')
		print('{:.2f}'.format(round(a + b, 2)))


import math
var = []
for i in range(11):
	t = int(input())
	var.append(t)
for i in range(11):
	d = var.pop()
	Ares = math.sqrt(abs(d))
	Bres = d ** 3 * 5
	res = Ares + Bres
	if res > 400:
		print(f'f({d}) = MAGNA NIMIS!')
	else:
		formatted = '{:.2f}'.format(res)
		print(f'f({d}) = {formatted}')


lip = ['0.00', '6.00', '-3642.00', '-2557.17', '-1712.35', '-1077.55', '-622.76', '-318.00', '-133.27', '-38.59', 'MAGNA NIMIS!']
s = []
for i in range(11):
	s.append(int(input()))
s.reverse()
for i in range(0, 11):
	a = s[i] ** 3 * 5
	b = abs(s[i]) ** 0.5
	ans = a + b
	print('f(' + str(s[i]) + ') = ', end='')
	if ans < 400:
		print('{:.2f}'.format(ans))
	else:
		print(' MAGNA NIMIS!')


from math import *

def f(n):
	return 5 * n ** 3 + sqrt(abs(n))
e = []
for i in range(11):
	e.append(int(input()))
e.reverse()
for i in e:
	k = f(i)
	if k > 400:
		print('f(%d) = MAGNA NIMIS!' % i)
	else:
		print('f(%d) = %.2f' % (i, k))