TROLLS - Trolls

In a secret forest, there are many trolls. They are intelligent and most of them even knows programming languages C or PASCAL. They have written many programs. With their super computers, their programs will run for a very short time and they can get the correct answer. Being an excellent programmer, you can even come up with the answer without computers!!!

Input

There's no real input file. The four programs can be downloaded here.

Output

For program1.txt and program2.txt in the zip file:

Your output should contain a single integer denoting the number of "*" the program will output.

For program3.txt and program4.txt in the zip file:

Your output should contain a single integer denoting the number the program will output.

You can merge the 4 output lines together to get the real output file and submit it.

Example

If program1.txt is

var i:integer;
begin
  for i:=2 to 8 do write('*');
end.

#include <stdio.h>
void main() {
  int i;
  for(i=2; i<=8; i++) printf("*");
}

The corresponding line should be:

7

If program3.txt is

var a, i: integer;

begin
  a := 0;
  for i:= 1 to 9 do
    a := a * 10 + i;
  writeln(a);
end.


#include <stdio.h>

void main() {
  int i, a;
  a = 0;
  for(i=1; i<=9; i++)
    a = a * 10 + i;
  printf("%d\n", a);
}

The correspoding line should be

123456789

Note

The numbers fit into the type "int" in C program or "integer" in PASCAL program in the zip file can be arbitrarily large because the computers used by trolls are super computers.


Added by:Fudan University Problem Setters
Date:2007-12-01
Time limit:0.100s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:TEXT
Resource:IPSC 2000 and IPSC 2001

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.