```    1 #include <stdio.h>
2 #include <math.h>
3 #include <stdlib.h>
4
5 typedef struct
6   {
7     char name[200];
8     int a;
9     int b;
10     int c;
11     int sigdig;
12   }box;
13
14
15 void getInput(int *cases, box **boxes)
16 {
17   int x;
18   box *b;
19   scanf ("%d\n", cases);
20   *boxes = malloc(*cases * sizeof(box));
21   b = *boxes;
22   for (x = 0;  x < *cases; x++)
23     {
24       scanf("'%[^']' %d %d %d %d ", b[x].name, &(b[x].a), &(b[x].b), &(b[x].c), &(b[x].sigdig));
25       /*printf("%s\n", b[x].name);*/
26     }
27 }
28
29 int sigdigit (int area, int sigdig)
30 {
31   int temp;
32   int digits = 0;
33   int i;
34
35   temp = area;
36   while (temp > 0)
37     {
38       temp = temp/10;
39       digits++;
40     }
41   digits = digits - sigdig;
42   for (i = 0; i < digits; i++)
43     {
44       area = area/10;
45     }
46   for (i = 0; i < digits; i++)
47     {
48       area = area*10;
49     }
50   return area;
51 }
52
53 void process (int cases, box *boxes)
54 {
55   int x;
56   int area;
57   box b;
58
59   for (x = 0; x < cases; x++)
60     {
61       /* printf ("processing %s\n", boxes[x].name); */
62       b = boxes[x];
63       area = (2 * b.b * b.c) + (2 * (b.a+3) * b.b) + (b.a * b.c) + ((b.a+3)*b.c);
64       area = sigdigit(area, b.sigdig);
65       printf("%s requires %d square frightometers of paper to wrap\n", b.name, area);
66     }
67 }
68
69 int main ()
70 {
71   box *boxes;
72   int cases;
73   getInput(&cases, &boxes);
74   process(cases, boxes);
75   return 0;
76 }
77
```