#include<stdio.h>
int main()
{
    int a, b, c, d;
    unsigned int n1, n2;
    scanf("%d.%d.%d.%d", &a, &b, &c, &d);
    scanf("%u", &n1);
    n2 = (a<<24)+(b<<16)+(c<<8)+d;
    printf("%u\n", n2);
    a = n1 >> 24;
    b = (n1 >> 16) & 255;
    c = (n1 >> 8) & 255;
    d = n1 & 255;
    printf("%d.%d.%d.%d", a, b, c, d);
    return 0;
}