import java.util.Scanner; public class Main { public static void main(String[] a) { Scanner s = new Scanner(System.in); String[][] t = {s.nextLine().split("\\."),s.nextLine().split("\\.")}; int[] S = new int[2];for(int i=0;i<2;i++)for(int j=0;j<3;)S[i]=S[i]*1000+Integer.parseInt(t[i][j++]); System.out.println(S[0]