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

Starter code:

Solutions:
f={}

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'
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[-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[-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[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[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'

a=[]
for i in range(11):
    a+=[int(input())]
for i in a[::-1]:
    s=''
    if i in f:
        s=f[i]
    else:
        s='MAGNA NIMIS!'
    print('f(%d) = %s'%(i, s))

import math

seq = []
for _ in range(11):
	seq.append(int(input()))

for _ in range(11):
	n = seq.pop()
	aresult = math.sqrt(abs(n))
	bresult = (n ** 3) * 5
	result = aresult + bresult
	if result <= 400:
		print("f(%d) = %.2f" % (n, result))
	else:
		print("f(%d) = MAGNA NIMIS!" % n)


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)))

import math

arr = [0 for _ in range(11)]

for x in range(11):
    arr[10-x] = int(input())

for x in arr:
    tmp = math.sqrt(abs(x)) + (x**3)*5
    if tmp >= 400:
        print("f({}) = MAGNA NIMIS!".format(x))
    else:
        print("f({}) = {:.2f}".format(x,round(tmp,2)))


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)

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

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!")

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)

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))


l = []
for i in range(11):
    l = [int(input())] + l

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


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])


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)))



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))


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}')


from sys import stdin

out = '''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
'''

vals = list(reversed(out.splitlines()))

for line in reversed(stdin.readlines()):
    ind = int(line)
    print(vals[ind+50])


outs = ["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",
"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(-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(-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(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"
]

nums = [input() for _ in range(11)]

for x in nums[::-1]:
    found = False
    for y in outs:
        if x == y[2:2+len(x)] and y[2+len(x)] == ")":
            found = True
            print(y)
    if not found:
        print("f({0}) = MAGNA NIMIS!".format(x))


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

import sys

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

data = []
for line in sys.stdin:
    data.append(int(line))

while len(data) < 11:
    data.append(0)
data = data[0:11]

ans = ''
for x in data:
    ans = f[x] + "\n" + ans
print(ans)


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!')

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}')


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)


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))



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)



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)


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 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))

#!/usr/bin/env python


import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from builtins 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))


# region fastio

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):
    """Prints the values to a stream, or to sys.stdout by default."""
    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")

# endregion

def __starting_point():
    main()

__starting_point()

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)


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))

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'))

s = []
for i in range(11):
    s.append(int(input()))

for i in range(11):
    x = s.pop()
    a = abs(x) ** 0.5
    b = x ** 3 * 5
    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)**.5
    else:
        ares = x**.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 *

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))

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))

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()
#print(s)
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 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 *
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!")

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))


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))

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

stk = []

try:
	while True:
		n = int(input())
		stk.append(seq[n + 50] + '\n')
except EOFError:
	print(''.join(stk[::-1]))


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
    # result *= sign
    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}")


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 re

s = """
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
""".strip()
if False:
    s = re.sub(r"\bIII\b", "3", s)
    s = re.sub(r"\bV\b", "5", s)
    s = re.sub(r"\bXI\b", "11", s)
    s = re.sub(r"\bCD\b", "400", s)
    s = re.sub(r"per (.*?) fac sic(.*?)\ncis", r"for (\1) {\2\n}", s, flags=re.DOTALL)
    s = re.sub(r"\bdictum sic (.*) cis(.*) egresso describe.", r'printf("\1"\2)', s)
    s = re.sub(r"novumversum egresso scribe.", r'print("\\n")', s)
    s = re.sub(r"si (.*?) fac sic(.*?)cis", r"if (\1) {\2}", s, flags=re.DOTALL)
    s = re.sub(r".$", "", s)
    s = re.sub(r" 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))


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)
	# print(x,a,b)
	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!")

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)


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

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


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))

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))

import math

def f(t):
    return math.sqrt(abs(t)) + 5 * t ** 3

a = [int(input()) for _ in range(11)]
for i, t in reversed(list(enumerate(a))):
    y = f(t)
    if y > 400:
        print('f(', t, ') = MAGNA NIMIS!', sep='')
    else:
        print('f(', t, ') = %.2f' % y, sep='') 

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) )
    

   


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


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)

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='')



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}')

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}")

import math

def f(t) -> float:
    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)
    if y > 400:
        print('f(%.0f) =' % t, 'MAGNA NIMIS!')
    else:
        print('f(%.0f) =' % t, '%.2f' % y)

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)**.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))    


 
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)))

import math


def f(t) -> float:
    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}) = {y:.2f}')

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))

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)**.5) if x<5 else 'MAGNA NIMIS!'))

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
    
    
    
#for _ in range(getInt()):    
solve()