#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll g1,s1,k1;
ll g2,s2,k2;
int main(){
scanf("%lld.%lld.%lld",&g1,&s1,&k1);
scanf("%lld.%lld.%lld",&g2,&s2,&k2);
ll total1=g1*17*29+s1*29+k1;
ll total2=g2*17*29+s2*29+k2;
ll res=total2-total1;
if(res<0){
cout<<'-';
res=-res;
}
ll g=(res/29)/17;
res=res-g*29*17;
ll s=res/29;
res%=29;
cout<<g<<"."<<s<<"."<<res;
return 0;
}