import java.util.*;
public class a005 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int number;
int insert[];
int[] array1 = new int[5];
int[] array2 = new int[5];
Scanner cin = new Scanner(System.in);
number = cin.nextInt();
for(int j = 0;j<=3;j++) {
array1[j] = cin.nextInt();
}
System.out.println();
for(int y = 0;y<=3;y++) {
array2[y] = cin.nextInt();
}
for(int k=0 ;k<=3;k++) {
System.out.print(array1[k]);
}
System.out.println(array1[3]+1);
System.out.println();
for(int o = 0;o<=3;o++) {
System.out.print(array2[o]);
}
System.out.println(array2[3]*number);
}
}
不知哪裡錯了