|
import java.util.Arrays;
import java.util.Scanner;
public class SwitchIP {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String str1 = scan.nextLine();
String str2 = scan.nextLine();
int b = Integer.parseInt(str2);
String []strArr = str1.split("\\.");
int[] a = new int[4];
for (int i = 0; i < strArr.length; i++) {
a[i] = Integer.parseInt(strArr[i]);
}
int sum = 0;
sum = (int) (a[0]*Math.pow(2, 24)+a[1]*Math.pow(2, 16)+a[2]*Math.pow(2, 8)+a[3]);
StringBuffer sb = new StringBuffer();
int cc = (int) (b/Math.pow(2, 24));
String c = cc +".";
sb.append(c);
int dd = (int) (((b % Math.pow(2, 24)))/Math.pow(2, 16));
String d = dd + ".";
sb.append(d);
int ee = (int) ( (b % Math.pow(2, 16))/Math.pow(2, 8));
String e = ee + ".";
sb.append(e);
int ff = (int) (b % Math.pow(2, 8));
sb.append(ff);
System.out.println(sum);
System.out.println(sb.toString());
}
}