# 최서영
솔로는 데뷔안하는데..
# 신예지 오 이야....이렇게 배신을 show me the code
#듀엣 예정(솔로예정)
#solo hot debut~
year1, month1, day1 = map(int, input().split())
year2, month2, day2 = map(int, input().split())

day_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] # 평년일 때 한 달의 일수

sum_year1 = 0
sum_year2 = 0
for i in range(1, year1):
    if (i % 4 == 0 and i % 100 != 0) or i % 400 == 0: # 윤년일 때 1년의 일수
        sum_year1 += 366
    else:
        sum_year1 += 365

for i in range(1, year2):
    if (i % 4 == 0 and i % 100 != 0) or i % 400 == 0:
        sum_year2 += 366
    else:
        sum_year2 += 365

sum_month1 = 0
sum_month2 = 0
for i in range(month1-1):
    **if (year1 % 4 == 0 and year1 % 100 != 0) or year2 % 400 == 0:
        if i == 1:
            sum_month1 += 29
    else:
        sum_month1 += day_month[i]**

**for i in range(month2-1):
    if (year2 % 4 == 0 and year2 % 100 != 0) or year2 % 400 == 0:
        if i == 1:
            sum_month2 += 29
    else:
        sum_month2 += day_month[i]**

remaining_days = (sum_year2+sum_month2+day2) - (sum_year1+sum_month1+day1)

if remaining_days >= 365243:
    print("gg")
else:
    print(f"D-{remaining_days}")
# 박성열(쇼미더머니 수영vs 성열)
def yoons(year): #윤달 함수수수수수수
    if year%100==0 and year%400!=0:
        return 0
    if year%4==0:
        return 1

def cnt(y, m, d, on_off = 1): #년별 수 cnt
    total=0
    Mon=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

    if yoons(y):
        Mon[1]=29

    if on_off:
        total+=Mon[m-1]-d
        for i in range(m, 12):
            total+=Mon[i]
    else:
        total+=d
        for i in range(m-2, -1, -1):
            total+=Mon[i]
    
    return total

def D_day(y1, m1, d1, y2, m2, d2): #d-day cnt
    if y1==y2:
        total=cnt(y1,m2,d2, 0)-cnt(y1, m1, d1, 0)
    else:
        total=cnt(y1, m1, d1) #2022년 4월 2일 4월 2일 부터 12월 31일
        total+=cnt(y2, m2, d2, 0) #2024년 4월 3일// 1월 1일 ~ 4월 3일
        for i in range(y1+1, y2): #2023년 세기용
            total+=cnt(i, 1, 0) 1월 1일
			
    return total

##########################################
import time

y1, m1, d1 = map(int, input().split())
y2, m2, d2 = map(int, input().split())

start = time.time()

result=D_day(y1, m1, d1, y2, m2, d2)

if result >= D_day(y1, m1, d1, y1+1000, m1, d1):
    print("gg")
else:
    print("D-%d" %result)

print("time :", time.time() - start)

##############################################
###################################

(1년 1월 1일 ~ y2 m2 d2) - (1년 1월 1일 ~ y1 m1 d1) **헤에!** 
#방법2 
def yoons(year): #윤달 함수
    if year%100==0 and year%400!=0:
        return 0
    if year%4==0:
        return 1

def d_Day(y, m, d):
    total=0

    for i in range(1, y):
        if yoons(i):
            total+=366
        else: total+=365

    Mon=[31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    if yoons(y):Mon[1]=29
    
    for i in range(0, m-1):total+=Mon[i]
    
    total+=d

    return total

import time

y1, m1, d1 = map(int, input().split())
y2, m2, d2 = map(int, input().split())

start = time.time()

result=d_Day(y2,m2,d2)-d_Day(y1,m1,d1)

if d_Day(y2,m2,d2)-d_Day(y1,m1,d1) >= d_Day(y1+1000,m1,d1)-d_Day(y1,m1,d1):print("gg")
else:print("D-%d"%result)

print("time :", time.time() - start)
**# 이수영(목동 멋쟁이~), 칭찬스티커 받으려고 또**
# ver.1
y1, m1, d1 = map(int, input().split())
y2, m2, d2 = map(int, input().split())

month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]  # 매달 들어있는 날 수

def isLeap(year):  # 윤년 판별 함수
    if year % 4 != 0:
        return 0
    if year % 100 != 0:
        return 1
    if year % 400 == 0:
        return 1
    return 0

def counting_day(y, m, d):  # 총 날 수 계산
    total = 0
    **for i in range(y): #칭찬 도장
        total += 365+isLeap(i) #와
    for i in range(m-1): 
        if i == 1:
            total += isLeap(y) #와
        total += month[i]
    total += d
    return total**

if (y2 == y1+1000 and m2 >= m1 and d2 >= d1) or y2 > y1+1000:
    print('gg')
else:
    d_day = counting_day(y2, m2, d2)-counting_day(y1, m1, d1)
    print(f"D-{d_day}")

# ver.2, **라이브러리 띠프**
import datetime
y1, m1, d1 = map(int, input().split())
y2, m2, d2 = map(int, input().split())
begin = da**tetime.date(y1, m1**, d1)  # datetime 라이브러리 사용
end = datetime.date(y2, m2, d2)
camp = end - begin
if (y2 == y1+1000 and m2 >= m1 and d2 >= d1) or y2 > y1+1000:
    print('gg')
else:
    print(f"D-{camp.days}")