#include<cstdio>
#include<cstring>

//类似于算时间之差(全部变成秒,再相减,然后转换为几个小时几分钟几秒的格式)
//
//这题全部转换为knut,知道1 gallon=17*29 knut,1 Sickle = 29 Knut 

const int Gallon = 17*29;
const int Sickle = 29;

int main(){

    int a1,b1,c1;
    int a2,b2,c2;

    scanf("%d.%d.%d %d.%d.%d",&a1,&b1,&c1,&a2,&b2,&c2);

    int price = a1*Gallon+b1*Sickle+c1;
    int change = a2*Gallon+b2*Sickle+c2;

    change = change - price;

    if(change < 0){
        printf("-");
        change = -change;
    }

    printf("%d.%d.%d",change/Gallon,change%Gallon/Sickle,change%Sickle);


    return 0;
}