#!/usr/bin/env python

import sys
import os
import re


def run():
    numcases = int(sys.stdin.readline())
    for i in xrange(0,numcases):
        line = sys.stdin.readline()
        endname = re.search("'", line[1:])
        endname = endname.start()
        name = line[1:endname+1].strip()
        a, b, c, digits = line[endname+2:].strip().split()
        a = int(a)
        b = int(b)
        c = int(c)
        digits = int(digits)
        tot = 2*b*c + 2*(a+3)*b + (a+3)*c + a*c
        shift = len(str(tot)) - digits 
        tot /=10**shift
        tot *=10**shift
        print name,"requires",tot,"square frightometers of paper to wrap"



if __name__ == "__main__":
    run()
