1 #!/usr/bin/env python
    2 
    3 import sys
    4 import os
    5 import re
    6 
    7 
    8 def run():
    9     numcases = int(sys.stdin.readline())
   10     for i in xrange(0,numcases):
   11         line = sys.stdin.readline()
   12         endname = re.search("'", line[1:])
   13         endname = endname.start()
   14         name = line[1:endname+1].strip()
   15         a, b, c, digits = line[endname+2:].strip().split()
   16         a = int(a)
   17         b = int(b)
   18         c = int(c)
   19         digits = int(digits)
   20         tot = 2*b*c + 2*(a+3)*b + (a+3)*c + a*c
   21         shift = len(str(tot)) - digits
   22         tot /=10**shift
   23         tot *=10**shift
   24         print name,"requires",tot,"square frightometers of paper to wrap"
   25 
   26 
   27 
   28 if __name__ == "__main__":
   29     run()