#include <stdio.h>
const int Galleon = 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*Galleon + b1*Sickle + c1;
int money = a2*Galleon + b2*Sickle + c2;
int change = money-price; // 找零的钱
if (change < 0){
printf ("-");
change = -change;
}
//转换成原先的格试
printf("%d.%d.%d", change/Galleon, (change%Galleon)/Sickle, change%Sickle);
return 0;
}