import datetime

kkk = datetime.datetime.strptime(input(),"%Y:%m:%d")
cz = datetime.datetime.strptime(input(),"%Y:%m:%d")

print(abs((cz-kkk).days))

from datetime import datetime
print(abs(datetime.strptime(input(),"%Y:%m:%d")-datetime.strptime(input(),"%Y:%m:%d")).days)

def ifLeap(year):
	if(year %100 == 0):
		if(year%400 == 0):
			return True
	elif(year%4 == 0):
		return True
	return False
year1,month1,day1 = map(int,input().split(':'))
year2,month2,day2 = map(int,input().split(':'))

month =[]
jan = []
for i in range(1,32):
	jan.append(i)
month.append(jan)
feb = []
for i in range(32,61):
	feb.append(i)
month.append(feb)
mar = []
for i in range(61,92):
	mar.append(i)
month.append(mar)
apr =[]
for i in range(92,122):
	apr.append(i)
month.append(apr)
may = []
for i in range(122,153):
	may.append(i)
month.append(may)
jun = []
for i in range(153,183):
	jun.append(i)
month.append(jun)
jul = []
for i in range(183,214):
	jul.append(i)
month.append(jul)
aug = []
for i in range(214,245):
	aug.append(i)
month.append(aug)
sep =[]
for i in range(245,275):
	sep.append(i)
month.append(sep)
oct = []
for i in range(275,306):
	oct.append(i)
month.append(oct)
nov = []
for i in range(306,336):
	nov.append(i)
month.append(nov)
dec = []
for i in range(336,367):
	dec.append(i)
month.append(dec)

rday1 = month[month1-1][day1-1]
rday2 = month[month2-1][day2-1]

if(year2 < year1):
	year1,year2 = year2,year1
	rday1,rday2 = rday2,rday1
elif(year2 == year1):
	if(rday2 < rday1):
		year1,year2 = year2,year1
		rday1,rday2 = rday2,rday1
difday = 0
difyear = year2 - year1
if(rday2 < rday1):
	difday = 366-rday1 + rday2
	difyear -= 1
else :
	difday = rday2 - rday1
if(not ifLeap(year1)):
	if rday1<60 and rday2 > 60 :
		difday -= 1
	elif(rday1 > rday2 and rday1 <60):
		difday -= 1
if(not ifLeap(year2)):
	if(rday2 < rday1 and rday2 > 60):
		difday -= 1
difday += difyear * 365
for i in range(year1+1,year2):
	if(ifLeap(i)) :
		difday += 1
print (difday)

from datetime import *
in_d = str(input()).split(':')
fi_d =str(input()).split(':')
date_init=date(int(in_d[0]),int(in_d[1]),int(in_d[2]))
date_final=date(int(fi_d[0]),int(fi_d[1]),int(fi_d[2]))
print(abs(date_init-date_final).days)

from datetime import date
y1,m1,d1=map(int,input().split(':'))
y2,m2,d2=map(int,input().split(':'))

a=date(y1,m1,d1)
b=date(y2,m2,d2)
print(abs((b-a).days))

import datetime
d1=datetime.datetime.strptime(input(),"%Y:%m:%d")
d2=datetime.datetime.strptime(input(),"%Y:%m:%d")
print(abs((d2-d1).days))

from datetime import date

a1 = [int(i) for i in input().split(':')]
a2 = [int(i) for i in input().split(':')]

print(abs((date(a1[0], a1[1], a1[2]) - date(a2[0], a2[1], a2[2])).days))

import datetime
t1 = datetime.datetime.strptime(input(),"%Y:%m:%d")
t2 = datetime.datetime.strptime(input(),"%Y:%m:%d")
print(abs((t2-t1).days))

# henrytb python water
import datetime as d
t1 = d.datetime.strptime(input(),"%Y:%m:%d")
#zhushi zhushi
'''
qwqwq

henrytb!!!
'''
t2 = d.datetime.strptime(input(),"%Y:%m:%d")
print(abs((t2-t1).days)) #abs QAQ

import datetime
t1 = datetime.datetime.strptime(input(), "%Y:%m:%d")
t2 = datetime.datetime.strptime(input(), "%Y:%m:%d")
print(abs( (t2 - t1).days) )

from datetime import *
R = lambda: datetime(*map(int, input().split(':')))
date1 = R()
date2 = R()
print(abs(date2 - date1).days)

import datetime
from pprint import pprint
year, month, day = (int(i) for i in input().split(':'))
x = datetime.date(year, month, day)
year, month, day = (int(i) for i in input().split(':'))
y = datetime.date(year, month, day)
pprint(abs(int((x - y).days)))

from datetime import date
d1 = date(*map(int, input().split(':')))
d2 = date(*map(int, input().split(':')))
print(abs(d2 - d1).days)

def isleap(x):
    if (x%4==0 and x%100!=0) or x%400==0:
        return True
    else:
        return False

def getday(y,m,d):
    month=[31,28,31,30,31,30,31,31,30,31,30,31]
    i=0
    day=0
    while i<m-1:
        day+=month[i]
        i+=1
    if isleap(y) and m>2:
        d+=1
    return day+d

def getcday(y,m,d,p):
    leap=0
    c=1
    day=0
    x=p
    while x<y:
        if isleap(x):
            leap+=1
            c=4
        x+=c
    #print leap
    day+=(-p+y)*365+leap+getday(y,m,d)
    return day

def main():
    d1=raw_input()
    d2=raw_input()
    y1,m1,d1=d1.split(':')
    y2,m2,d2=d2.split(':')
    y1=int(y1)
    d1=int(d1)
    m1=int(m1)
    y2=int(y2)
    d2=int(d2)
    m2=int(m2)
    if y1>y2:
        print abs(getcday(y1,m1,d1,y2)-getday(y2,m2,d2))
    else:
        print abs(getcday(y2,m2,d2,y1)-getday(y1,m1,d1))

if __name__=='__main__':
    main()

from datetime import date
d2 = raw_input()
d1 = raw_input()
delta = date(int(d1[0:4]),int(d1[5:7]),int(d1[8:10])) - date(int(d2[0:4]),int(d2[5:7]),int(d2[8:10]))
print abs(delta.days)

months = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def leap(y):
    return (y % 4 == 0 and y != 1900)

def days(y, m, d):
    count = 0
    for yx in xrange(1900, y):
        count += 366 if leap(yx) else 365
    for mx in xrange(1, m):
        count += months[mx] + (leap(y) and mx == 2)
    count += d - 1
    return count

yx, mx, dx = (int(x) for x in raw_input().strip().split(':'))
yy, my, dy = (int(x) for x in raw_input().strip().split(':'))

print abs(days(yx, mx, dx) - days(yy, my, dy))

import datetime
t1=datetime.datetime.strptime(input(),"%Y:%m:%d")
t2=datetime.datetime.strptime(input(),"%Y:%m:%d")
print(abs((t2-t1).days))

import datetime
time1 = datetime.datetime.strptime(input(),"%Y:%m:%d")
time2 = datetime.datetime.strptime(input(),"%Y:%m:%d")
print(abs((time1-time2).days))

from datetime import date

str = raw_input().split(":")
str2 = raw_input().split(":")

a = date(int(str[0]), int(str[1]), int(str[2]))
b = date(int(str2[0]), int(str2[1]), int(str2[2]))

print abs((b-a).days)

import datetime
d1=apply(datetime.date,map(int,raw_input().split(':')))
d2=apply(datetime.date,map(int,raw_input().split(':')))
print abs((d2-d1).days)

from datetime import date
d1=[]
d2=[]
for x in raw_input().split(":"):
    d1.append(int(x))

for x in raw_input().split(":"):
    d2.append(int(x))
print abs(date(d2[0], d2[1], d2[2]) - date(d1[0], d1[1], d1[2])).days

import datetime
_a = datetime.datetime.strptime(input(),"%Y:%m:%d")
_b = datetime.datetime.strptime(input(),"%Y:%m:%d")
print (abs((_a-_b).days))

import sys
import datetime

def main():
    s = raw_input()
    t = raw_input()
    a = s.split(':')
    b = t.split(':')
    t1 = datetime.date(int(a[0]), int(a[1]), int(a[2]))
    t2 = datetime.date(int(b[0]), int(b[1]), int(b[2]))
    if t1 > t2: print (t1 - t2).days
    else: print (t2 - t1).days

if __name__ == '__main__':
    main()

from datetime import date

a = map(int , raw_input().split(":"))
b = map(int , raw_input().split(":"))
u = abs(date(a[0] , a[1] , a[2]) - date(b[0] , b[1] , b[2])).days
print u

import datetime
a = datetime.datetime.strptime(input(),"%Y:%m:%d")
b = datetime.datetime.strptime(input(),"%Y:%m:%d")
print(abs((a-b).days))

def s():
    import datetime
    dt = datetime.datetime
    print(abs((dt(*list(map(int,input().split(':'))))-dt(*list(map(int,input().split(':'))))).days))
s()

def isLeapYear(y):
    if y % 4 == 0:
        if y % 400 == 0:
            return True
        elif y % 100 == 0:
            return False
        return True
    return False

y1, m1, d1 = map(int, input().split(':'))
y2, m2, d2 = map(int, input().split(':'))
year = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
leap_year = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if y1 > y2:
    y1, m1, d1, y2, m2, d2 = y2, m2, d2, y1, m1, d1
elif y1 == y2:
    if m1 > m2:
        m1, d1, m2, d2 = m2, d2, m1, d1
    elif m1 == m2:
        if d1 > d2:
            d1, d2 = d2, d1
s = 0
for i in range(y1 + 1, y2):
    if isLeapYear(i):
        s += sum(leap_year)
    else:
        s += sum(year)
if y1 != y2:
    if isLeapYear(y1):
        s += sum(leap_year[m1 - 1:]) - d1
    else:
        s += sum(year[m1 - 1:]) - d1
    if isLeapYear(y2):
        s += sum(leap_year[:m2 - 1]) + d2
    else:
        s += sum(year[:m2 - 1]) + d2
elif m1 != m2:
    if isLeapYear(y1):
        s += sum(leap_year[:m2 - 1]) + d2
        s -= sum(leap_year[:m1 - 1]) + d1
    else:
        s += sum(year[:m2 - 1]) + d2
        s -= sum(year[:m1 - 1]) + d1
elif d1 != d2:
    s += d2 - d1
print(s)

import datetime
t1 = datetime.datetime.strptime(input(),"%Y:%m:%d")
t2 = datetime.datetime.strptime(input(),"%Y:%m:%d")
print(abs((t2-t1).days))

import datetime
x=datetime.datetime.strptime(input(),"%Y:%m:%d")
y=datetime.datetime.strptime(input(),"%Y:%m:%d")
print(abs((x-y).days))

def day_number(d,m,y):

    res = d
    #defino los meses
    meses = [31,28,31,30,31,30,31,31,30,31,30,31]

    if (m!=1): #dias del ano corriendo
        for i in range (m-1):
            res = res + meses[i]
        if ( ano_bisiesto(y) == True and m > 2):
            res = res + 1

    i = 1
    while (i < y):
        if ( ano_bisiesto(i) == False ):
            res = res + 365
        else:
            res = res + 366
        i = i + 1

    return res

def ano_bisiesto(ano):
    if(ano%4 ==0 ):
        if(ano%100 ==0):
            if(ano%400 ==0):
                return True
            else:
                return False
        else:
            return True
    else:
        return False

a = list(map(int,input().split(':')))
b = list(map(int,input().split(':')))
print(abs(day_number(a[2],a[1],a[0])-day_number(b[2],b[1],b[0])))

days = [
    0,
    31,
    28,
    31,
    30,
    31,
    30,
    31,
    31,
    30,
    31,
    30,
    31
]

d = []
for i in range(0,2):
    s = input()
    year_to = int(s[0:4])
    month_to = int(s[5:7])
    day_to = int(s[8:10])

    year = 1900
    month = 1
    day = 1
    days_in_month = 31

    num_days = 1
    while year != year_to or month != month_to or day != day_to:
        # print(year,month,day)
        day += 1
        num_days += 1
        if day > days_in_month:
            month += 1
            day = 1
            if month == 13:
                year += 1
                month = 1
            elif month == 2 and (year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)):
                days_in_month = 29
            else:
                days_in_month = days[month]
    d.append(num_days)

print(abs(d[0]-d[1]))

from datetime import *

d1 = datetime.strptime(input(), '%Y:%m:%d')
d2 = datetime.strptime(input(), '%Y:%m:%d')
print(abs((d1 - d2).days))

from datetime import date
import math
i0 = input().split(':')
i1 = input().split(':')
d0 = date(int(i0[0]), int(i0[1]), int(i0[2]))
d1 = date(int(i1[0]), int(i1[1]), int(i1[2]))
delta = d1 - d0
print(abs(delta.days))

month_days = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
def leap(x):
    return x % 4 == 0 and x % 100 != 0 or x % 400 == 0
def calc_days(y, m, d):
    days = [month_days[i] + (i == 2 and leap(y)) for i in range(m)]
    return d + sum(days)
arr = [list(map(int, input().split(':'))) for i in range(2)]
arr = sorted(arr)
if arr[0][0] == arr[1][0]:
    print(calc_days(*arr[1]) - calc_days(*arr[0]))
else:
    first_year = 365 + leap(arr[0][0])
    mid_days = [365 + leap(i) for i in range(arr[0][0]+1, arr[1][0])]
    print(first_year - calc_days(*arr[0]) + sum(mid_days) + calc_days(*arr[1]))

from datetime import date

a = list(map(int, input().split(':')))
b = list(map(int, input().split(':')))

f_date = date(a[0],a[1],a[2])
l_date = date(b[0], b[1], b[2])
delta = l_date - f_date
print(abs(delta.days))

from datetime import date

a = map(int, raw_input().split(":"))
b = map(int, raw_input().split(":"))

a = date(a[0], a[1], a[2])
b = date(b[0], b[1], b[2])

print abs((b-a).days)

import datetime
y1, m1, d1 = map(int, input().split(":"))
date_1 = datetime.date(y1, m1, d1)
y2, m2, d2 = map(int, input().split(":"))
date_2 = datetime.date(y2, m2, d2)

print((abs(date_2-date_1)).days)

"""
def leap_year(x, y):
  d = 0
  for i in range(x, y+1):
    if (i%4 == 0 and i % 100 != 0) or (i%400 == 0):
      d += 366
    else:
      d += 365
  return d
d = leap_year(y1, y2)
d += (m2-m1)*30 + (d2-d1)
print(d)
"""

from datetime import date

s = raw_input();
f = s.split(':');

year = int(f[0]);
month = int(f[1]);
day = int(f[2]);

s = raw_input();
f = s.split(':');

year2 = int(f[0]);
month2 = int(f[1]);
day2 = int(f[2]);

d = date(year, month, day)
d2 = date(year2, month2, day2)

change = abs(d2 - d)

print change.days

from datetime import date
a = [int(x) for x in input().split(":")]
b = [int(x) for x in input().split(":")]
x = date(a[0], a[1], a[2])
y = date(b[0], b[1], b[2])
z = x - y
print(abs(z.days))

import datetime
y1, m1, d1 = map(int, input().split(':'))
y2, m2, d2 = map(int, input().split(':'))
print(abs(datetime.date(y1, m1, d1) - datetime.date(y2, m2, d2)).days)

from datetime import date
x = raw_input()
y = raw_input()
s = [int(i) for i in x.split(':')]
t = [int(i) for i in y.split(':')]

a = date(s[0],s[1],s[2])
b = date(t[0],t[1],t[2])
print abs(a-b).days

import time
import datetime
import calendar

if __name__ == '__main__':

    date1 = input().split(":")
    date1 = [int(x) for x in date1]
    date2 = input().split(":")
    date2 = [int(x) for x in date2]
    #print(date2)
    if date1[0] > date2[0]:
        tmp = date1.copy()
        date1 = date2
        date2 = tmp

    sum = 0
    for i in range(date1[0]+1, date2[0]):
        if i % 4 == 0:
            if i % 100 != 0:
                sum += 366
                continue
            if i % 400 == 0:
                sum += 366
                continue
        sum += 365
        continue

    if date1[0] != date2[0]:
        sumdays = 0
        for i in range(date1[1], 13):
            sumdays += calendar.monthrange(date1[0], i)[1]
        sumdays -= date1[2]

        sumdays2 = 0
        for i in range(1, date2[1]):
            sumdays2 += calendar.monthrange(date2[0], i)[1]
        sumdays2 += date2[2]
        sum += sumdays + sumdays2
    else:
        sumdays = 0
        for i in range(min(date1[1], date2[1]), max(date1[1], date2[1])):
            sumdays += calendar.monthrange(date1[0], i)[1]

        if date1[1] < date2[1]:
            sumdays += -date1[2] + date2[2]
        else:
            sumdays += -date2[2] + date1[2]
        sum += sumdays

    if date2[0] == date1[0] and date2[1] == date1[1] and date2[2] == date1[2]:
        sum = 0
    print(abs(sum))

from datetime import datetime

def days_between(d1,d2) :
    d1 = datetime.strptime(d1,"%Y:%m:%d")
    d2 = datetime.strptime(d2,"%Y:%m:%d")
    return abs((d2-d1).days)

smonth = raw_input()
emonth = raw_input()

print days_between(smonth, emonth)

from datetime import date as d
print(abs((d(*map(int,input().split(':')))-d(*map(int,input().split(':')))).days))

import datetime

def solve():
    f = datetime.datetime.strptime(raw_input(), '%Y:%m:%d').date()
    d = datetime.datetime.strptime(raw_input(), '%Y:%m:%d').date()
    if f > d:
        print (f - d).days
    else:
        print (d - f).days

if __name__ == '__main__':
    solve()

import datetime
x=datetime.datetime.strptime(input(),"%Y:%m:%d")
y=datetime.datetime.strptime(input(),"%Y:%m:%d")
print(abs((x-y).days))

from datetime import date
from datetime import timedelta

a = input()
a = [int(x) for x in a.split(":")]
b = input()
b = [int(x) for x in b.split(":")]

x = date(a[0],a[1],a[2])
y = date(b[0],b[1],b[2])

if x > y:
  x,y = y,x

ans = 0
while x != y:
  x = x + timedelta(days=1)
  ans+=1
print(ans)

from datetime import date
yyyy,mm,dd = raw_input().split(':')
a = date(int(yyyy),int(mm),int(dd))
yyyy,mm,dd = raw_input().split(':')
b = date(int(yyyy),int(mm),int(dd))
ans = (b-a).days
print abs(ans)

from datetime import datetime
y,m,d = map(int,input().split(':'))
a = datetime(y,m,d)
y,m,d = map(int,input().split(':'))
b = datetime(y,m,d)
print(abs((b-a).days))

import datetime

t1 = datetime.datetime.strptime(input(),"%Y:%m:%d")

t2 = datetime.datetime.strptime(input(),"%Y:%m:%d")

print(abs((t2-t1).days))

from datetime import *

t1 = datetime.strptime(input(), "%Y:%m:%d")
t2 = datetime.strptime(input(), "%Y:%m:%d")

print(abs((t2-t1).days))

m = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
class date():
    def __init__(self,d):
        b = map(int, d.split(':'))
        self.year = b[0]
        self.month = b[1]
        self.date = b[2]
    def isGreater(self, d):
        if d.year>self.year: return False
        if d.year<self.year: return True
        if d.month>self.month: return False
        if d.month<self.month: return True
        if d.date>self.date: return False
        else: return True
def isLeapYear(year):
    if year%100==0: return True if year%400==0 else False
    return True if year%4==0 else False

date1 = date(raw_input())
date2 = date(raw_input())
if date1.isGreater(date2):
    date3 = date1
    date1 = date2
    date2 = date3
days = 0
for i in xrange(date1.year+1, date2.year):
    days += 366 if isLeapYear(i) else 365

for i in xrange(date1.month, 12 if date1.year!=date2.year else date2.month-1):
    days += m[i]

if date1.year!=date2.year:
    for i in xrange(0, date2.month-1):
        days += m[i]
if date1.year==date2.year and isLeapYear(date1.year):
    if date1.month<2 and date2.month>2:
        days+=1
else:
    if isLeapYear(date1.year) and date1.month<2: days+=1
    if isLeapYear(date2.year) and date2.month>2: days+=1

if date1.year==date2.year and date1.month==date2.month:
    days += (date2.date-date1.date)
else:
    if date1.month==2:
        if isLeapYear(date1.year): days += 29-date1.date
        else: days+= 28-date1.date
    if date1.month!=2: days += m[date1.month-1] - date1.date
    days += date2.date

print days

from datetime import date

def main():
	y1, m1, d1 = map(int, raw_input().split(':'))
	y2, m2, d2 = map(int, raw_input().split(':'))
	print abs((date(y2, m2, d2) - date(y1, m1, d1)).days)
main()

from datetime import date
y1,m1,d1 = map(int,input().split(':'))
y2,m2,d2 = map(int,input().split(':'))
date1 = date(y1,m1,d1)
date2 = date(y2,m2,d2)
print(abs((date2-date1).days))

from datetime import *
a = [int(x) for x in raw_input().split(':')]
b = [int(y) for y in raw_input().split(':')]

d1 = date(a[0], a[1], a[2])
d2 = date(b[0], b[1], b[2])

print(abs((d2-d1).days))

from datetime import *
print abs((datetime.strptime(raw_input(), "%Y:%m:%d")-datetime.strptime(raw_input(), "%Y:%m:%d")).days)

import sys
def isr(n):
    if n/4 * 4 == n and n != 1900:
        return 1
    else:
        return 0
if __name__ == '__main__':

    lit=[[31,28,31,30,31,30,31,31,30,31,30,31],[31,29,31,30,31,30,31,31,30,31,30,31]]
    num1 = map(str,sys.stdin.readline().split())
    num2 = map(str,sys.stdin.readline().split())
    startY = int(num1[0][0:4])
    endY = int(num2[0][0:4])
    startM = int(num1[0][5:7])
    endM = int(num2[0][5:7])
    startD = int(num1[0][8:10])
    endD = int(num2[0][8:10])

    if (endY-startY)*366 + (endM - startM)*31 + (endD - startD) < 0:
        endY,startY = startY,endY
        endM,startM = startM,endM
        endD,startD = startD,endD

    all = 0
    while startY != endY or startM != endM or startD != endD:
        all+=1
        startD+=1

        if startD > lit[isr(startY)][startM-1]:
            startD = 1
            startM += 1
        if startM > 12:
            startM = 1
            startY +=1

    print all

import datetime
y1,m1,d1 = map(int, raw_input().split(":"))
y2,m2,d2 = map(int, raw_input().split(":"))
print abs(datetime.date(y1,m1,d1)-datetime.date(y2,m2,d2)).days

from datetime import date
import sys

date1 = map(int, sys.stdin.readline().split(":"))
date2 = map(int, sys.stdin.readline().split(":"))

print abs((date(date1[0], date1[1], date1[2]) - date(date2[0], date2[1], date2[2])).days)

def main():
	d1=map(int,raw_input().split(":",3));
	d2=map(int,raw_input().split(":",3));
	ans=0;
	y1=d1[0];
	y2=d2[0];
	m1=d1[1];
	m2=d2[1];
	day1=d1[2];
	day2=d2[2];
	if y1<y2:
		if m1==12:
			ans=ans+(31-day1);
		else:
			dinm=daysofmonth(m1,islp(y1));
			ans=ans+(dinm-day1);
			m1=m1+1;
			while(m1<=12):
				ans=ans+daysofmonth(m1,islp(y1));
				m1=m1+1;
		years=y1+1;
		while(years<y2):
			ans=ans+daysofyear(years,islp(years));
			years=years+1;
		i=1;
		while(i<m2):
			ans=ans+(daysofmonth(i,islp(y2)));
			i=i+1;
		ans=ans+day2;
		print ans;

	elif y2<y1:
		if m2==12:
			ans=ans+(31-day2);
		else:
			dinm=daysofmonth(m2,islp(y2));
			ans=ans+(dinm-day2);
			m2=m2+1;
			while(m2<=12):
				ans=ans+daysofmonth(m2,islp(y2));
				m2=m2+1;
		years=y2+1;
		while(years<y1):
			ans=ans+daysofyear(years,islp(years));
			years=years+1;
		i=1;
		while(i<m1):
			ans=ans+(daysofmonth(i,islp(y1)));
			i=i+1;
		ans=ans+day1;
		print ans;
	else:
		if m1==m2:
			ans=ans+abs(day1-day2);
			print ans;
		elif m1<m2:
			ans=ans+(daysofmonth(m1,islp(y2))-day1);
			i=m1+1;
			while(i<m2):
				ans=ans+(daysofmonth(i,islp(y2)));
				i+=1;
			ans=ans+day2;
			print ans;
		else:
			ans=ans+(daysofmonth(m2,islp(y1))-day2);
			i=m2+1;
			while(i<m1):
				ans=ans+(daysofmonth(i,islp(y2)));
				i+=1;
			ans=ans+day1;
			print ans;

def islp(y1):
	if (y1%4==0 and y1%100!=0) or (y1%400==0):
		return True;
	else:
		return False;
def daysofyear(y,lp):
	if lp:
		return 366;
	else:
		return 365;
def daysofmonth(m,lp):
	if m==1:
		return 31;
	elif m==2:
		if lp:
			return 29;
		else:
			return 28;
	elif m==3:
		return 31;
	elif m==4:
		return 30;
	elif m==5:
		return 31;
	elif m==6:
		return 30;
	elif m==7:
		return 31;
	elif m==8:
		return 31;
	elif m==9:
		return 30;
	elif m==10:
		return 31;
	elif m==11:
		return 30;
	elif m==12:
		return 31;
if __name__=="__main__":main();

import datetime
def inputdate():
    ipt = raw_input()
    a = ipt.split(':')
    return datetime.date(int(a[0]), int(a[1]), int(a[2]))
dat = inputdate() - inputdate()
print abs(dat.days)

import datetime

y1, m1, d1 = [int(i) for i in raw_input().strip().split(':')]
date1 = datetime.date(y1, m1, d1)

y2, m2, d2 = [int(i) for i in raw_input().strip().split(':')]
date2 = datetime.date(y2, m2, d2)

if date1 == date2:
    print 0
else:
    print abs(int(str(date2-date1).split()[0]))

from datetime import date
a = map(int,raw_input().split(":"))
d = []
d.append(date(a[0],a[1],a[2]))
a = map(int,raw_input().split(":"))
d.append(date(a[0],a[1],a[2]))
d.sort()
dels = d[1]-d[0]
print dels.days

import datetime

y, m, d = map(int, raw_input().split(':'))
d1 = datetime.date(y, m, d)
y, m, d = map(int, raw_input().split(':'))
d2 = datetime.date(y, m, d)
d = d2-d1
print abs(d.days)

import sys
from datetime import datetime

data = sys.stdin.readlines()
start = datetime.strptime(data[0].strip(), '%Y:%m:%d')
end = datetime.strptime(data[1].strip(), '%Y:%m:%d')
print(abs((end - start).days))

from datetime import timedelta, date

def solve():
    y1,m1,d1 = map(int, raw_input().strip().split(':'))
    y2,m2,d2 = map(int, raw_input().strip().split(':'))
    day1 = date(y1,m1,d1)
    day2 = date(y2,m2,d2)
    ans = (day2-day1).days
    if ans < 0:
        ans = -ans
    print ans

solve()

from datetime import datetime
date_format = "%Y:%m:%d"
x= raw_input()
y= raw_input()
a = datetime.strptime(x, date_format)
b = datetime.strptime(y, date_format)
delta = b - a
print abs(delta.days) # that's it

from datetime import date,timedelta
import sys

def get_input ():
  return map (int,input().split(':'))

sy,sm,sd = get_input()
ey,em,ed = get_input()

start = date (sy,sm,sd)
end = date (ey,em,ed)

print ((end-start).days)

from datetime import date
list1 = input().split(':')
list2 = input().split(':')
d0 = date(int(list1[0]),int(list1[1]),int(list1[2]))
d1 = date(int(list2[0]),int(list2[1]),int(list2[2]))
delta = d1 - d0
print(delta.days)

from collections import Counter
import string
import math
dicti={'1':31,'2':28,'3':31,'4':30,'5':31,'6':30,'7':31,'8':31
    ,'9':30,'10':31,'11':30,'12':31}
def array_int():

    return [int(i) for i in input().split()]
def vary(number_of_variables):
    if number_of_variables==1:
        return int(input())
    if number_of_variables>=2:
        return map(int,input().split())
def makedict(var):
    return dict(Counter(var))
mod=1000000007
date1=input()
date2=input()
year1=int(date1[:4])
year2=int(date2[:4])
day1=int(date1[8:])
day2=int(date2[8:])
month1=int(date1[5:7])
month2=int(date2[5:7])
class Date:
    def __init__(self, d, m, y):
        self.d = d
        self.m = m
        self.y = y
monthDays = [31, 28, 31, 30, 31, 30,
                        31, 31, 30, 31, 30, 31 ]
def countLeapYears(d):

    years = d.y
    if (d.m <= 2):
        years-= 1
    return int(years / 4 - years / 100 + years / 400 )

def getDifference(dt1, dt2) :
    n1 = dt1.y * 365 + dt1.d

    # Add days for months in given date
    for i in range(0, dt1.m - 1) :
        n1 += monthDays[i]

    # Since every leap year is of 366 days,
    # Add a day for every leap year
    n1 += countLeapYears(dt1)

    # SIMILARLY, COUNT TOTAL NUMBER OF DAYS BEFORE 'dt2'

    n2 = dt2.y * 365 + dt2.d
    for i in range(0, dt2.m - 1) :
        n2 += monthDays[i]
    n2 += countLeapYears(dt2)

    # return difference between two counts
    return (n2 - n1)

# Driver program
dt1 = Date(day1, month1, year1 )
dt2 = Date(day2, month2, year2 )

print(abs(getDifference(dt1, dt2)))

from collections import Counter
import string
import math
dicti={'1':31,'2':28,'3':31,'4':30,'5':31,'6':30,'7':31,'8':31
    ,'9':30,'10':31,'11':30,'12':31}
def array_int():

    return [int(i) for i in input().split()]
def vary(number_of_variables):
    if number_of_variables==1:
        return int(input())
    if number_of_variables>=2:
        return map(int,input().split())
def makedict(var):
    return dict(Counter(var))
mod=1000000007
date1=input()
date2=input()
year1=int(date1[:4])
year2=int(date2[:4])
day1=int(date1[8:])
day2=int(date2[8:])
month1=int(date1[5:7])
month2=int(date2[5:7])
class Date:
    def __init__(self, d, m, y):
        self.d = d
        self.m = m
        self.y = y
monthDays = [31, 28, 31, 30, 31, 30,
                        31, 31, 30, 31, 30, 31 ]
def countLeapYears(d):

    years = d.y
    if (d.m <= 2):
        years-= 1
    return int(years / 4 - years / 100 + years / 400 )

def getDifference(dt1, dt2) :
    n1 = dt1.y * 365 + dt1.d

    # Add days for months in given date
    for i in range(0, dt1.m - 1) :
        n1 += monthDays[i]

    # Since every leap year is of 366 days,
    # Add a day for every leap year
    n1 += countLeapYears(dt1)

    # SIMILARLY, COUNT TOTAL NUMBER OF DAYS BEFORE 'dt2'

    n2 = dt2.y * 365 + dt2.d
    for i in range(0, dt2.m - 1) :
        n2 += monthDays[i]
    n2 += countLeapYears(dt2)

    # return difference between two counts
    return (n2 - n1)

# Driver program
dt1 = Date(day1, month1, year1 )
dt2 = Date(day2, month2, year2 )

print(getDifference(dt1, dt2))

def getday(m,d):
    month=[31,28,31,30,31,30,31,31,30,31,30,31]
    i=0
    day=0
    while i<m-1:
        day+=month[i]
        i+=1
    return day+d
def check(x,y):
    leap=0
    c=1
    if x>y:
        t=x;
        x=y;
        y=t;
    while x<=y:
        if (x%4==0 and x%100!=0) or x%400==0:
            leap+=1
            c=4
        x+=c
    return leap

def main():
    d1=raw_input()
    d2=raw_input()
    y1,m1,d1=d1.split(':')
    y2,m2,d2=d2.split(':')
    y1=int(y1)
    d1=int(d1)
    m1=int(m1)
    y2=int(y2)
    d2=int(d2)
    m2=int(m2)
    leap=0
    x=y1
    y=y2
    if m1>2:
        if y1<y2:
            x=y1-1
        else:
            x=y1+1
    if m2>2:
        if y1<y2:
            y=y2-1
        else:
            y=y2+1
    leap=check(x,y)
    #print getday(m1,d1),getday(m2,d2)
    if y1>y2:
        print abs(y1-y2)*365+getday(m1,d1)-getday(m2,d2)+leap
    elif y1<y2:
        print abs(y1-y2)*365-getday(m1,d1)+getday(m2,d2)+leap
    else:
        print leap+abs(getday(m1,d1)-getday(m2,d2))
if __name__=='__main__':
    main()

def getday(m,d):
    month=[31,28,31,30,31,30,31,31,30,31,30,31]
    i=0
    day=0
    while i<m-1:
        day+=month[i]
        i+=1
    return day+d
def check(x,y):
    leap=0
    c=1
    #print x,y
    if x>y:
        t=x;
        x=y;
        y=t;
    while x<=y:
        if (x%4==0 and x%100!=0) or x%400==0:
            leap+=1
            c=4
            #print x
        x+=c
    #print leap
    return leap

def main():
    d1=raw_input()
    d2=raw_input()
    y1,m1,d1=d1.split(':')
    y2,m2,d2=d2.split(':')
    y1=int(y1)
    d1=int(d1)
    m1=int(m1)
    y2=int(y2)
    d2=int(d2)
    m2=int(m2)
    leap=0
    x=y1
    y=y2
    if y1<y2:
        if m1>2:
            x=y1+1
        if m2<2:
            y=y2-1
    elif y1>y2:
        if m2>2:
            x=y2+1
        if m1<2:
            y=y1-1
    if y1==y2:
        if m1<2 and m2>2:
            leap=1
        elif m1>2 and m2<2:
            leap=1
    if x!=y:
        leap=check(x,y)
    #print getday(m1,d1),getday(m2,d2)
    if y1>y2:
        print abs(y1-y2)*365+getday(m1,d1)-getday(m2,d2)+leap
    elif y1<y2:
        print abs(y1-y2)*365-getday(m1,d1)+getday(m2,d2)+leap
    else:
        print leap+abs(getday(m1,d1)-getday(m2,d2))
if __name__=='__main__':
    main()

def isleap(x):
    if (x%4==0 and x%100!=0) or x%400==0:
        return True
    else:
        return False

def getday(y,m,d):
    month=[31,28,31,30,31,30,31,31,30,31,30,31]
    i=0
    day=0
    while i<m-1:
        day+=month[i]
        i+=1
    if isleap(y):
        d+=1
    if m==2:
        return day+d-1
    else:
        return day+d

def getcday(y,m,d,p):
    leap=0
    c=1
    day=0
    x=p
    while x<y:
        if isleap(x):
            leap+=1
            c=4
        x+=c
    #print leap
    day+=(-p+y)*365+leap+getday(y,m,d)
    return day

def main():
    d1=raw_input()
    d2=raw_input()
    y1,m1,d1=d1.split(':')
    y2,m2,d2=d2.split(':')
    y1=int(y1)
    d1=int(d1)
    m1=int(m1)
    y2=int(y2)
    d2=int(d2)
    m2=int(m2)
    if y1>y2:
        print abs(getcday(y1,m1,d1,y2)-getday(y2,m2,d2))
    else:
        print abs(getcday(y2,m2,d2,y1)-getday(y1,m1,d1))

if __name__=='__main__':
    main()

def getday(m,d):
    month=[31,28,31,30,31,30,31,31,30,31,30,31]
    i=0
    day=0
    while i<m-1:
        day+=month[i]
        i+=1
    return day+d
def check(x,y):
    leap=0
    c=1
    if x>y:
        t=x;
        x=y;
        y=t;
    while x<=y:
        if (x%4==0 and x%100!=0) or x%400==0:
            leap+=1
            c=4
        x+=c
    #print leap
    return leap

def main():
    d1=raw_input()
    d2=raw_input()
    y1,m1,d1=d1.split(':')
    y2,m2,d2=d2.split(':')
    y1=int(y1)
    d1=int(d1)
    m1=int(m1)
    y2=int(y2)
    d2=int(d2)
    m2=int(m2)
    if m1==2 and d1==29:
        d1-=1
    if m2==2 and d2==29:
        d2-=1
    leap=0
    x=y1
    y=y2
    if m1>2:
        if y1<y2:
            x=y1-1
        else:
            x=y1+1
    if m2>2:
        if y1<y2:
            y=y2-1
        else:
            y=y2+1
    leap=check(x,y)
    #print getday(m1,d1),getday(m2,d2)
    if y1>y2:
        print abs(y1-y2)*365+getday(m1,d1)-getday(m2,d2)+leap
    elif y1<y2:
        print abs(y1-y2)*365-getday(m1,d1)+getday(m2,d2)+leap
    else:
        print leap+abs(getday(m1,d1)-getday(m2,d2))
if __name__=='__main__':
    main()

def getday(m,d):
    month=[31,28,31,30,31,30,31,31,30,31,30,31]
    i=0
    day=0
    while i<m-1:
        day+=month[i]
        i+=1
    return day+d
def check(x,y):
    leap=0
    c=1
    #print x,y
    if x>y:
        t=x;
        x=y;
        y=t;
    while x<=y:
        if (x%4==0 and x%100!=0) or x%400==0:
            leap+=1
            c=4
            #print x
        x+=c
    #print leap
    return leap
def main():
    d1=raw_input()
    d2=raw_input()
    y1,m1,d1=d1.split(':')
    y2,m2,d2=d2.split(':')
    y1=int(y1)
    d1=int(d1)
    m1=int(m1)
    y2=int(y2)
    d2=int(d2)
    m2=int(m2)
    leap=0
    x=min(y1,y2)
    y=max(y1,y2)
    if y1<y2:
        if m1>2:
            x=y1+1
        if m2<2:
            y=y2-1
    elif y1>y2:
        if m2>2:
            x=y2+1
        if m1<2:
            y=y1-1
    if y1==y2:
        if m1<2 and m2>2:
            leap=1
        elif m1>2 and m2<2:
            leap=1
    if x!=y:
        leap=check(x,y)
    #print getday(m1,d1),getday(m2,d2)
    if y1>y2:
        print abs(y1-y2)*365+getday(m1,d1)-getday(m2,d2)+leap
    elif y1<y2:
        print abs(y1-y2)*365-getday(m1,d1)+getday(m2,d2)+leap
    else:
        print leap+abs(getday(m1,d1)-getday(m2,d2))
if __name__=='__main__':
    main()

def getday(m,d):
    month=[31,28,31,30,31,30,31,31,30,31,30,31]
    i=0
    day=0
    while i<m-1:
        day+=month[i]
        i+=1
    return day+d
def check(x,y):
    leap=0
    c=1
    #print x,y
    if x>y:
        t=x;
        x=y;
        y=t;
    while x<=y:
        if (x%4==0 and x%100!=0) or x%400==0:
            leap+=1
            c=4
            #print x
        x+=c
    #print leap
    return leap
def main():
    d1=raw_input()
    d2=raw_input()
    y1,m1,d1=d1.split(':')
    y2,m2,d2=d2.split(':')
    y1=int(y1)
    d1=int(d1)
    m1=int(m1)
    y2=int(y2)
    d2=int(d2)
    m2=int(m2)
    leap=0
    x=min(y1,y2)
    y=max(y1,y2)
    if y1<y2:
        if m1>2:
            x=y1+1
        if m2<2:
            y=y2-1
    elif y1>y2:
        if m2>2:
            x=y2+1
        if m1<2:
            y=y1-1
    if y1==y2:
        if m1<2 and m2>2:
            leap=1
        elif m1>2 and m2<2:
            leap=1
        elif min(m1,m2)==2 and max(m1,m2)!=2:
            leap=1
    if x!=y:
        leap=check(x,y)
    #print leap
    #print getday(m1,d1),getday(m2,d2)
    if y1>y2:
        print abs(y1-y2)*365+getday(m1,d1)-getday(m2,d2)+leap
    elif y1<y2:
        print abs(y1-y2)*365-getday(m1,d1)+getday(m2,d2)+leap
    else:
        print leap+abs(getday(m1,d1)-getday(m2,d2))
if __name__=='__main__':
    main()

def getday(m,d):
    month=[31,28,31,30,31,30,31,31,30,31,30,31]
    i=0
    day=0
    while i<m-1:
        day+=month[i]
        i+=1
    return day+d
def check(x,y):
    leap=0
    c=1
    print x,y
    if x>y:
        t=x;
        x=y;
        y=t;
    while x<=y:
        if (x%4==0 and x%100!=0) or x%400==0:
            leap+=1
            c=4
            #print x
        x+=c
    print leap
    return leap
def main():
    d1=raw_input()
    d2=raw_input()
    y1,m1,d1=d1.split(':')
    y2,m2,d2=d2.split(':')
    y1=int(y1)
    d1=int(d1)
    m1=int(m1)
    y2=int(y2)
    d2=int(d2)
    m2=int(m2)
    leap=0
    x=min(y1,y2)
    y=max(y1,y2)
    if y1<y2:
        if m1>2:
            x=y1+1
        if m2<2:
            y=y2-1
    elif y1>y2:
        if m2>2:
            x=y2+1
        if m1<2:
            y=y1-1
    if y1==y2:
        if m1<2 and m2>2:
            leap=1
        elif m1>2 and m2<2:
            leap=1
    if x!=y:
        leap=check(x,y)
    #print getday(m1,d1),getday(m2,d2)
    if y1>y2:
        print abs(y1-y2)*365+getday(m1,d1)-getday(m2,d2)+leap
    elif y1<y2:
        print abs(y1-y2)*365-getday(m1,d1)+getday(m2,d2)+leap
    else:
        print leap+abs(getday(m1,d1)-getday(m2,d2))
if __name__=='__main__':
    main()

import datetime
d1=apply(datetime.date,map(int,raw_input().split(':')))
d2=apply(datetime.date,map(int,raw_input().split(':')))
print (d2-d1).days

from datetime import date
d1=[]
d2=[]
for x in raw_input().split(":"):
    d1.append(int(x))

for x in raw_input().split(":"):
    d2.append(int(x))
print (date(d2[0], d2[1], d2[2]) - date(d1[0], d1[1], d1[2])).days

import sys
import datetime

i1 = sys.stdin.readline()
i2 = sys.stdin.readline()

[y1, m1, d1] = map(int, i1.split(":"))
[y2, m2, d2] = map(int, i2.split(":"))

d1 = datetime.date(y1, m1, d1)
d2 = datetime.date(y2, m2, d2)

print (d2 - d1).days

from datetime import date

a = map(int, raw_input().split(":"))
b = map(int, raw_input().split(":"))

a = date(a[0], a[1], a[2])
b = date(b[0], b[1], b[2])

print (b-a).days

from datetime import date

a = map(int, raw_input().split(":"))
b = map(int, raw_input().split(":"))

a = date(a[0], a[1], a[2])
b = date(b[0], b[1], b[2])

print (a-b).days

from datetime import datetime

while True:
	try:
		ano1,mes1,dia1 = map(int,raw_input().split(":"))
		ano2,mes2,dia2 = map(int,raw_input().split(":"))

	except:
		break

	print (datetime(ano1,mes1,dia1) - datetime(ano2,mes2,dia2)).days

from datetime import date
x = raw_input()
y = raw_input()
s = [int(i) for i in x.split(':')]
t = [int(i) for i in y.split(':')]

a = date(s[0],s[1],s[2])
b = date(t[0],t[1],t[2])
print abs(a-b)

from datetime import datetime
import re

def parse(s):
    [y, m, d] = re.findall("\\d+", s)
    return datetime(int(y), int(m), int(d))

def days_between(d1, d2):
    delta = d2 - d1
    return delta.days

d1 = parse(str(raw_input()))
d2 = parse(str(raw_input()))

print days_between(d1, d2)

m = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
class date():
    def __init__(self,d):
        b = map(int, d.split(':'))
        self.year = b[0]
        self.month = b[1]
        self.date = b[2]
    def isGreater(self, d):
        if d.year>self.year: return False
        if d.year<self.year: return True
        if d.month>self.month: return False
        if d.month<self.month: return True
        if d.date>self.date: return False
        else: return True
def isLeapYear(year):
    if year%100==0: return True if year%400==0 else False
    return True if year%4==0 else False

date1 = date(raw_input())
date2 = date(raw_input())
if date1.isGreater(date2):
    date3 = date1
    date1 = date2
    date2 = date3
days = 0
for i in xrange(date1.year+1, date2.year):
    days += 366 if isLeapYear(i) else 365

for i in xrange(date1.month, 12 if date1.year!=date2.year else date2.month-1):
    days += m[i]

if date1.year!=date2.year:
    for i in xrange(0, date2.month-1):
        days += m[i]
if date1.year==date2.year and isLeapYear(date1.year) and date1.month<2 and date2.month>2:
    days+=1
else:
    if isLeapYear(date1.year) and date1.month<2: days+=1
    if isLeapYear(date2.year) and date2.month>2: days+=1

if date1.year==date2.year and date1.month==date2.month:
    days += (date2.date-date1.date)
else:
    if date1.month==2:
        if isLeapYear(date1.year): days += 29-date1.date
        else: days+= 28-date1.date
    if date1.month!=2: days += m[date1.month-1] - date1.date
    days += date2.date

print days

m = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
class date():
    def __init__(self,d):
        b = map(int, d.split(':'))
        self.year = b[0]
        self.month = b[1]
        self.date = b[2]
    def isGreater(self, d):
        if d.year>self.year: return False
        if d.year<self.year: return True
        if d.month>self.month: return False
        if d.month<self.month: return True
        if d.date>self.date: return False
        else: return True
def isLeapYear(year):
    if year%100==0: return True if year%400==0 else False
    return True if year%4==0 else False

date1 = date(raw_input())
date2 = date(raw_input())
if date1.isGreater(date2):
    date3 = date1
    date1 = date2
    date2 = date3
days = 0
for i in xrange(date1.year+1, date2.year):
    days += 366 if isLeapYear(i) else 365

for i in xrange(date1.month, 12 if date1.year!=date2.year else date2.month-1):
    days += m[i]

if date1.year!=date2.year:
    for i in xrange(0, date2.month-1):
        days += m[i]
if date1.year==date2.year and isLeapYear(date1.year):
    days+=1
else:
    if isLeapYear(date1.year): days+=1
    if isLeapYear(date2.year): days+=1

if date1.year==date2.year and date1.month==date2.month:
    days += (date2.date-date1.date)
else:
    if date1.month==2:
        if isLeapYear(date1.year): days += 29-date1.date
        else: days+= 28-date1.date
    if date2.month==2:
        if isLeapYear(date2.year): days += 29-date2.date
        else: days+= 28-date2.date
    if date1.month!=2: days += m[date1.month-1] - date1.date
    if date2.month!=2: days += date2.date

print days

from datetime import *
print -(datetime.strptime(raw_input(), "%Y:%m:%d")-datetime.strptime(raw_input(), "%Y:%m:%d")).days

def main():
	d1=map(int,raw_input().split(":",3));
	d2=map(int,raw_input().split(":",3));
	ans=0;
	y1=d1[0];
	y2=d2[0];
	m1=d1[1];
	m2=d2[1];
	day1=d1[2];
	day2=d2[2];
	if y1<y2:
		if m1==12:
			ans=ans+(31-day1);
		else:
			dinm=daysofmonth(m1,islp(y1));
			ans=ans+(dinm-day1);
			m1=m1+1;
			while(m1<=12):
				ans=ans+daysofmonth(m1,islp(y1));
				m1=m1+1;
		years=y1+1;
		while(years<y2):
			ans=ans+daysofyear(years,islp(years));
			years=years+1;
		i=1;
		while(i<m2):
			ans=ans+(daysofmonth(i,islp(y2)));
			i=i+1;
		ans=ans+day2;
		print ans;

	else:
		if m2==12:
			ans=ans+(31-day2);
		else:
			dinm=daysofmonth(m2,islp(y2));
			ans=ans+(dinm-day2);
			m2=m2+1;
			while(m2<=12):
				ans=ans+daysofmonth(m2,islp(y2));
				m2=m2+1;
		years=y2+1;
		while(years<y1):
			ans=ans+daysofyear(years,islp(years));
			years=years+1;
		i=1;
		while(i<m1):
			ans=ans+(daysofmonth(i,islp(y1)));
			i=i+1;
		ans=ans+day1;
		print ans;

def islp(y1):
	if (y1%4==0 and y1%100!=0) or (y1%400==0):
		return True;
	else:
		return False;
def daysofyear(y,lp):
	if lp:
		return 366;
	else:
		return 365;
def daysofmonth(m,lp):
	if m==1:
		return 31;
	elif m==2:
		if lp:
			return 29;
		else:
			return 28;
	elif m==3:
		return 31;
	elif m==4:
		return 30;
	elif m==5:
		return 31;
	elif m==6:
		return 30;
	elif m==7:
		return 31;
	elif m==8:
		return 31;
	elif m==9:
		return 30;
	elif m==10:
		return 31;
	elif m==11:
		return 30;
	elif m==12:
		return 31;
if __name__=="__main__":main();

from __future__ import division;
from bisect import *;
from fractions import Fraction;
import sys;
from math import *;
from fractions import *;
import io;

INF = 987654321987654321987654321;

def readint(delimiter=' ') :
	return map(int, raw_input().split(delimiter));

def readstr(delimiter=' ') :
	return raw_input().split(delimiter);

def readfloat(delimiter=' ') :
	return map(float, raw_input().split(delimiter));

def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    raise ValueError

def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect_left(a, x)
    if i:
        return a[i-1]
    raise ValueError

def find_le(a, x):
    'Find rightmost value less than or equal to x'
    i = bisect_right(a, x)
    if i:
        return a[i-1]
    raise ValueError

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect_right(a, x)
    if i != len(a):
        return a[i]
    raise ValueError

def find_ge(a, x):
    'Find leftmost item greater than or equal to x'
    i = bisect_left(a, x)
    if i != len(a):
        return a[i]
    raise ValueError

def bin_search(a, x, left, right) :

    while left<=right :
        mid = (left + right)//2;

        if a[mid] == x :
            return mid;
        elif a[mid] < x :
            left = mid + 1;
        elif a[mid] > x :
            right = mid - 1;

        pass

    return -1;
    pass

def printf(format, *args):
    """Format args with the first argument as format string, and write.
    Return the last arg, or format itself if there are no args."""
    sys.stdout.write(str(format) % args)
    return if_(args, lambda: args[-1], lambda: format)

from datetime import date;
if __name__ == '__main__':

    s = readint(':');
    e = readint(':');
    start = date(s[0], s[1], s[2]);
    end = date(e[0], e[1], e[2]);
    print str((end-start).days);

    pass

import datetime

t1 = map(int, raw_input().split(':'))
t2 = map(int, raw_input().split(':'))

print t1
print t2
d1 = datetime.datetime(t1[0], t1[1], t1[2])
d2 = datetime.datetime(t2[0], t2[1], t2[2])

print abs((d2 - d1).days)

# encoding: utf-8

days = [None, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def num_days(year, month):
    if month == 2 and is_leap(year):
        return 29
    else:
        return days[month]

def is_leap(year):
    if year % 4 == 0:
        if year % 100 == 0:
            if year % 400 == 0:
                return True
            else:
                return False
        else:
            return True
    return False

if __name__ == '__main__':
    dates = []
    dates.append(raw_input().rstrip())
    dates.append(raw_input().rstrip())
    dates.sort()

    year1, month1, day1 = [int(x) for x in dates[0].split(':')]
    year2, month2, day2 = [int(x) for x in dates[1].split(':')]

    ans = 0

    if year1 == year2:
        if month1 == month2:
            ans = day2 - day1
        else:
            ans += num_days(year1, month1) - day1
            for month in range(month1 + 1, month2):
                ans += num_days(year1, month)
            ans += day2
    else:
        ans += num_days(year1, month1) - day1
        month1 += 1
        if month1 == 12:
            year1 += 1
            month = 1
        for month in range(month1, 12 + 1):
            ans += num_days(year1, month)
        for year in range(year1 + 1, year2):
            for month in range(1, 12 + 1):
                ans += num_days(year, month)
        for month in range(1, month2):
            ans += num_days(year2, month)
        ans += day2

    print ans

import datetime
import math

a = raw_input()
b = raw_input()
a = a.split(':')
b = b.split(':')
aa = datetime.date(int(a[0]),int(a[1]),int(a[2]))
bb = datetime.date(int(b[0]),int(b[1]),int(b[2]))
cc = aa-bb
print cc.days

import datetime

a = raw_input()
b = raw_input()
a = a.split(':')
b = b.split(':')
aa = datetime.date(int(a[0]),int(a[1]),int(a[2]))
bb = datetime.date(int(b[0]),int(b[1]),int(b[2]))
cc = aa-bb
dd = str(cc)
print dd.split()[0][1:]

import datetime

x=raw_input()
y=raw_input()

x=x.split(':')
y=y.split(':')

x[0]=int(x[0])
x[1]=int(x[1])
x[2]=int(x[2])

y[0]=int(y[0])
y[1]=int(y[1])
y[2]=int(y[2])

a=datetime.date(x[0],x[1],x[2])
b=datetime.date(y[0],y[1],y[2])

if a>=b:
        ans=a-b
else:
        ans=b-a

ans=str(ans)
ans=ans.split()

print ans[0]

import sys
from datetime import datetime

data = sys.stdin.readlines()
start = datetime.strptime(data[0].strip(), '%Y:%m:%d')
end = datetime.strptime(data[1].strip(), '%Y:%m:%d')
print((end - start).days)

from datetime import *

line = raw_input()
y, m, d = line.split(':')
p = date(int(y), int(m), int(d))
line = raw_input()
y, m, d = line.split(':')
t = date(int(y), int(m), int(d))
print (t - p).days

from datetime import date
i0 = input().split(':')
i1 = input().split(':')
d0 = date(int(i0[0]), int(i0[1]), int(i0[2]))
d1 = date(int(i1[0]), int(i1[1]), int(i1[2]))
delta = d1 - d0
print(delta.days)

from datetime import date

a = list(map(int, input().split(':')))
b = list(map(int, input().split(':')))

f_date = date(a[0],a[1],a[2])
l_date = date(b[0], b[1], b[2])
delta = l_date - f_date
print(delta.days)

import time
import datetime
import calendar

if __name__ == '__main__':

    date1 = input().split(":")
    date1 = [int(x) for x in date1]
    date2 = input().split(":")
    date2 = [int(x) for x in date2]
    #print(date2)
    if date1[0] > date2[0]:
        tmp = date1.copy()
        date1 = date2
        date2 = tmp

    sum = 0
    for i in range(date1[0]+1, date2[0]):
        if i % 4 == 0:
            if i % 100 != 0:
                sum += 366
                continue
            if i % 400 == 0:
                sum += 366
                continue
        sum += 365
        continue

    if date1[0] != date2[0]:
        sumdays = 0
        for i in range(date1[1], 13):
            sumdays += calendar.monthrange(date1[0], i)[1]
        sumdays -= date1[2]

        sumdays2 = 0
        for i in range(1, date2[1]):
            sumdays2 += calendar.monthrange(date2[0], i)[1]
        sumdays2 += date2[2]
        sum += sumdays + sumdays2
    else:
        sumdays = 0
        for i in range(min(date1[1], date2[1]), max(date1[1], date2[1])):
            sumdays += calendar.monthrange(date1[0], i)[1]

        if date1[1] < date2[1]:
            sumdays += -date1[2] + date2[2]
        else:
            sumdays += -date2[2] + date1[2]
        sum += sumdays

    if date2[0] == date1[0] and date2[1] == date1[1] and date2[2] == date1[2]:
        sum = 0
    print(sum)

import time
import datetime
import calendar

if __name__ == '__main__':

    date1 = input().split(":")
    date1 = [int(x) for x in date1]
    date2 = input().split(":")
    date2 = [int(x) for x in date2]
    #print(date2)
    if date1[0] > date2[0]:
        tmp = date1.copy()
        date1 = date2
        date2 = tmp

    sum = 0
    for i in range(date1[0]+1, date2[0]):
        if i % 4 == 0:
            if i % 100 != 0:
                sum += 366
                continue
            if i % 400 == 0:
                sum += 366
                continue
        sum += 365
        continue

    sumdays = 0
    for i in range(date1[1], 13):
        sumdays += calendar.monthrange(date1[0], i)[1]
    sumdays -= date1[2]

    sumdays2 = 0
    for i in range(1, date2[1]):
        sumdays2 += calendar.monthrange(date2[0], i)[1]
    sumdays2 += date2[2]

    sum += sumdays + sumdays2

    if date2[0] == date1[0] and date2[1] == date1[1] and date2[2] == date1[2]:
        sum = 0
    print(sum)

import time
import datetime
import calendar

if __name__ == '__main__':

    date1 = input().split(":")
    date1 = [int(x) for x in date1]
    date2 = input().split(":")
    date2 = [int(x) for x in date2]
    #print(date2)
    if date1[0] > date2[0]:
        tmp = date1.copy()
        date1 = date2
        date2 = tmp

    sum = 0
    for i in range(date1[0]+1, date2[0]):
        if i % 4 == 0:
            if i % 100 != 0:
                sum += 366
                continue
            if i % 400 == 0:
                sum += 366
                continue
        sum += 365
        continue

    sumdays = 0
    for i in range(date1[1], 13):
        sumdays += calendar.monthrange(date1[0], i)[1]
    sumdays -= date1[2]

    sumdays2 = 0
    for i in range(1, date2[1]):
        sumdays2 += calendar.monthrange(date2[0], i)[1]
    sumdays2 += date2[2]

    sum += sumdays + sumdays2
    print(sum)

from datetime import date

a = str(input())
b = str(input())

adate = a.split(":")
bdate = b.split(":")

da = date(int(adate[0]),int(adate[1]),int(adate[2]))
db = date(int(bdate[0]),int(bdate[1]),int(bdate[2]))

print((db-da).days)

y1, m1, d1 = map(int, input().split(':'))
y2, m2, d2 = map(int, input().split(':'))
from datetime import  date
a = date(y1, m1, d1)
b = date(y2, m2, d2)
#datetime.timedelta(7)
print((b-a).days)

from datetime import date
y1,m1,d1 = map(int,input().split(':'))
y2,m2,d2 = map(int,input().split(':'))
date1 = date(y1,m1,d1)
date2 = date(y2,m2,d2)
print((date2-date1).days)

year1,month1,day1 = map(int,input().split(':'))
year2,month2,day2 = map(int,input().split(':'))

if(year2 < year1):
	year1,year2 = year2,year1
	month1,month2 = month2,month1
	day1,day2 = day2,day1

#dim = {1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}
dim =[31,28,31,30,31,30,31,31,30,31,30,31]
years = 0
leapdays = 0
for i in range(year1+1,year2) :
	years += 1
	if (i % 100 == 0) :
		if(i % 400 == 0 ) :
			leapdays += 1
	else :
		if(i%4 == 0):
			leapdays += 1

days = leapdays+(years*365)
#print(days)

for i in range(month1+1,13) :
	days = (days+ dim[i-1])

for i in range(1,month2):
	days = (days + dim[i-1])

eday1 = (dim[month1-1]-day1)
days = days + eday1+(day2-1)

if(month1 <= 2) :
	if(year1 % 100== 0) :
		if(year1 % 400==0) :
			days += 1
	else :
		if (year1 % 4 == 0) :
			days += 1
if(month2>=3):
	if(year2 % 100== 0) :
		if(year2 % 400==0) :
			days += 1
	else :
		if year2 % 4 == 0:
			days += 1

print (days+1)

def ifLeap(year):
	if(year %100 == 0):
		if(year%400 == 0):
			return True
	elif(year%4 == 0):
		return True
	return False
year1,month1,day1 = map(int,input().split(':'))
year2,month2,day2 = map(int,input().split(':'))

month =[]
jan = []
for i in range(1,32):
	jan.append(i)
month.append(jan)
feb = []
for i in range(32,61):
	feb.append(i)
month.append(feb)
mar = []
for i in range(61,92):
	mar.append(i)
month.append(mar)
apr =[]
for i in range(92,122):
	apr.append(i)
month.append(apr)
may = []
for i in range(122,153):
	may.append(i)
month.append(may)
jun = []
for i in range(153,183):
	jun.append(i)
month.append(jun)
jul = []
for i in range(183,214):
	jul.append(i)
month.append(jul)
aug = []
for i in range(214,245):
	aug.append(i)
month.append(aug)
sep =[]
for i in range(245,275):
	sep.append(i)
month.append(sep)
oct = []
for i in range(275,306):
	oct.append(i)
month.append(oct)
nov = []
for i in range(306,336):
	nov.append(i)
month.append(nov)
dec = []
for i in range(336,367):
	dec.append(i)
month.append(dec)

rday1 = month[month1-1][day1-1]
rday2 = month[month2-1][day2-1]

if(year2 < year1):
	year1,year2 = year2,year1
	rday1,rday2 = rday2,rday1
elif(year2 == year1):
	if(rday2 < rday1):
		year1,year2 = year2,year1
		rday1,rday2 = rday2,rday1
difday = 0
difyear = year2 - year1
if(rday2 < rday1):
	difday = 366-rday1 + rday2
	difyear -= 1
else :
	difday = rday2 - rday1
if(not ifLeap(year1)):
	if rday1<60 and rday2 > 60 :
		difday -= 1
	elif(rday1 > rday2 and rday1 <60):
		difday -= 1
elif(not ifLeap(year2)):
	if(rday2 < rday1 and rday2 > 60):
		difday -= 1
difday += difyear * 365
for i in range(year1+1,year2):
	if(ifLeap(i)) :
		difday += 1
print (difday)

year1,month1,day1 = map(int,input().split(':'))
year2,month2,day2 = map(int,input().split(':'))

if(year2 < year1):
	year1,year2 = year2,year1
	month1,month2 = month2,month1
	day1,day2 = day2,day1

#dim = {1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}
dim =[31,28,31,30,31,30,31,31,30,31,30,31]
years = 0
leapdays = 0
for i in range(year1+1,year2) :
	years += 1
	if (i % 100 == 0) :
		if(i % 400 == 0 ) :
			leapdays += 1
	else :
		if(i%4 == 0):
			leapdays += 1

days = leapdays+(years*365)

for i in range(month1+1,13) :
	days = (days+ dim[i-1])

for i in range(1,month2):
	days = (days + dim[i-1])

eday1 = 1+(dim[month1-1]-day1)
days = days + eday1+day2

if(month1 >= 2) :
	if(year1 % 100== 0) :
		if(year1 % 400==0) :
			days += 1
	else :
		if (year1 % 4 == 0) :
			days += 1
if(month2>=3):
	if(year2 % 100== 0) :
		if(year2 % 400==0) :
			days += 1
	else :
		if year2 % 4 == 0:
			days += 1

print (days-1)

def ifLeap(year):
	if(year %100 == 0):
		if(year%400 == 0):
			return True
	elif(year%4 == 0):
		return True
	return False
year1,month1,day1 = map(int,input().split(':'))
year2,month2,day2 = map(int,input().split(':'))

month =[]
jan = []
for i in range(1,32):
	jan.append(i)
month.append(jan)
feb = []
for i in range(32,61):
	feb.append(i)
month.append(feb)
mar = []
for i in range(61,92):
	mar.append(i)
month.append(mar)
apr =[]
for i in range(92,122):
	apr.append(i)
month.append(apr)
may = []
for i in range(122,153):
	may.append(i)
month.append(may)
jun = []
for i in range(153,183):
	jun.append(i)
month.append(jun)
jul = []
for i in range(183,214):
	jul.append(i)
month.append(jul)
aug = []
for i in range(214,245):
	aug.append(i)
month.append(aug)
sep =[]
for i in range(245,275):
	sep.append(i)
month.append(sep)
oct = []
for i in range(275,306):
	oct.append(i)
month.append(oct)
nov = []
for i in range(306,336):
	nov.append(i)
month.append(nov)
dec = []
for i in range(336,367):
	dec.append(i)
month.append(dec)

rday1 = month[month1-1][day1-1]
rday2 = month[month2-1][day2-1]

if(year2 < year1):
	year1,year2 = year2,year1
	rday1,rday2 = rday2,rday1
elif(year2 == year1):
	if(rday2 < rday1):
		year1,year2 = year2,year1
		rday1,rday2 = rday2,rday1
difday = 0
difyear = year2 - year1
if(rday2 < rday1):
	difday = 366-rday1 + rday2
	difyear -= 1
else :
	difday = rday2 - rday1
if((not ifLeap(year1)) or (not ifLeap(year2))):
	if(rday1 < 60 and rday2 > 60):
		difday -= 1
	elif((rday2<rday1 and rday1 <60)):
		difday -= 1
	elif(rday2 < rday1 and rday2 > 60):
		difday -= 1
difday += difyear * 365
for i in range(year1+1,year2):
	if(ifLeap(i)) :
		difday += 1
print (difday)

year1,month1,day1 = map(int,input().split(':'))
year2,month2,day2 = map(int,input().split(':'))
if(year1 == year2 and day1 == day2 and month1 == month2) :
	print (0)
	exit()

if(year2 < year1):
	year1,year2 = year2,year1
	month1,month2 = month2,month1
	day1,day2 = day2,day1

#dim = {1:31,2:28,3:31,4:30,5:31,6:30,7:31,8:31,9:30,10:31,11:30,12:31}
dim =[31,28,31,30,31,30,31,31,30,31,30,31]
years = 0
leapdays = 0
for i in range(year1+1,year2) :
	years += 1
	if (i % 100 == 0) :
		if(i % 400 == 0 ) :
			leapdays += 1
	else :
		if(i%4 == 0):
			leapdays += 1

days = leapdays+(years*365)
#print(days)

for i in range(month1+1,13) :
	days = (days+ dim[i-1])

for i in range(1,month2):
	days = (days + dim[i-1])

eday1 = (dim[month1-1]-day1)
days = days + eday1+(day2-1)

if(month1 <= 2) :
	if(year1 % 100== 0) :
		if(year1 % 400==0) :
			days += 1
	else :
		if (year1 % 4 == 0) :
			days += 1
if(month2>=3):
	if(year2 % 100== 0) :
		if(year2 % 400==0) :
			days += 1
	else :
		if year2 % 4 == 0:
			days += 1

print (days+1)

def ifLeap(year):
	if(year %100 == 0):
		if(year%400 == 0):
			return True
	elif(year%4 == 0):
		return True
	return False
year1,month1,day1 = map(int,input().split(':'))
year2,month2,day2 = map(int,input().split(':'))

month =[]
jan = []
for i in range(1,32):
	jan.append(i)
month.append(jan)
feb = []
for i in range(32,61):
	feb.append(i)
month.append(feb)
mar = []
for i in range(61,92):
	mar.append(i)
month.append(mar)
apr =[]
for i in range(92,122):
	apr.append(i)
month.append(apr)
may = []
for i in range(122,153):
	may.append(i)
month.append(may)
jun = []
for i in range(153,183):
	jun.append(i)
month.append(jun)
jul = []
for i in range(183,214):
	jul.append(i)
month.append(jul)
aug = []
for i in range(214,245):
	aug.append(i)
month.append(aug)
sep =[]
for i in range(245,275):
	sep.append(i)
month.append(sep)
oct = []
for i in range(275,306):
	oct.append(i)
month.append(oct)
nov = []
for i in range(306,336):
	nov.append(i)
month.append(nov)
dec = []
for i in range(336,367):
	dec.append(i)
month.append(dec)

rday1 = month[month1-1][day1-1]
rday2 = month[month2-1][day2-1]

if(year2 < year1):
	year1,year2 = year2,year1
	rday1,rday2 = rday2,rday1
elif(year2 == year1):
	if(rday2 < rday1):
		year1,year2 = year2,year1
		rday1,rday2 = rday2,rday1
difday = 0
difyear = year2 - year1
if(rday2 < rday1):
	difday = 366-rday1 + rday2
	difyear -= 1
else :
	difday = rday2 - rday1
if((not ifLeap(year1)) or (not ifLeap(year2))):
	if(rday1 < 60 and rday2 > 60):
		difday -= 1
elif(not ifLeap(year1)):
	if((rday2<rda1 and rday1 <60)):
		difday -= 1
elif(not ifLeap(year2)):
	if(rday2 < rday1 and rday2 > 60):
		difday -= 1
difday += difyear * 365
for i in range(year1+1,year2):
	if(ifLeap(i)) :
		difday += 1
print (difday)

import sys

begin = [int(x) for x in sys.stdin.readline().strip().split(":")]
end = [int(x) for x in sys.stdin.readline().strip().split(":")]

year1 = begin[0] if begin[1] <= 2 else begin[0] + 1
year2 = end[0] - 1 if end[1] <= 2 else end[0]

leaps = 0
for i in range(year1, year2 + 1):
  if((i % 4 == 0 and i % 100 != 0) or i % 400 == 0):
    print(i)
    leaps += 1

days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

sums = 0
b = 0
for i in range(begin[1], 12):
  b += days[i]
b += (days[begin[1]] - begin[2])

a = 0
for i in range(0, end[1] - 1):
  a += days[i]
a += end[2]

sums = sums + a + b
sums += 365 * ((end[0]) - (begin[0] + 1))
sums += leaps
print(sums - 1)

from datetime import date
d0 = raw_input()
d1 = raw_input()
d0=d0.split(':')
d1=d1.split(':')
a1=int(d0[0])
a2=int(d0[1])
a3=int(d0[2])
b1=int(d1[0])
b2=int(d1[1])
b3=int(d1[2])
o1=date(a1,a2,a3)
o2=date(b1,b2,b3)
delta = o2 - o1
print delta.days

def isLeapYear(y):
    if y % 4 == 0:
        if y % 400 == 0:
            return True
        elif y % 100 == 0:
            return False
        return True
    return False

y1, m1, d1 = map(int, input().split(':'))
y2, m2, d2 = map(int, input().split(':'))
year = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
leap_year = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if y1 > y2:
    y1, m1, d1, y2, m2, d2 = y2, m2, d2, y1, m1, d1
elif y1 == y2:
    if m1 > m2:
        m1, d1, m2, d2 = m2, d2, m1, d1
    elif m1 == m2:
        if d1 > d2:
            d1, d2 = d2, d1
s = 0
if isLeapYear(y1):
    s += sum(leap_year[m1 - 1:]) - d1
else:
    s += sum(year[m1 - 1:]) - d1
for i in range(y1 + 1, y2):
    if isLeapYear(i):
        s += sum(leap_year)
    else:
        s += sum(year)
if isLeapYear(y2):
    s += sum(leap_year[:m2 - 1]) + d2
else:
    s += sum(year[:m2 - 1]) + d2
print(s)

def is_leap(x):
    if x % 4 == 0:
        if x % 100 == 0:
            if x % 400 == 0:
                return True
            else:
                return False
        else:
            return True
    else:
        return False

from collections import OrderedDict
from operator import itemgetter

year = sorted([[int(x) for x in input().split(':')] for i in range(2)], key=itemgetter(0, 1, 2))
dic = OrderedDict({1: 31, 2: 28, 3: 31, 4: 30, 5: 31, 6: 30, 7: 31, 8: 31, 9: 30, 10: 31, 11: 30, 12: 31})

ans = 0
for i in range(year[0][0], year[1][0] + 1):
    days = 365
    if is_leap(i):
        days = 366
        dic[2] = 29
    else:
        dic[2] = 28

    if i == year[0][0]:
        for k, j in dic.items():
            if k == year[0][1]:
                days -= year[0][2]
                ans+=days
                break
            else:
                days -= j

    elif i == year[1][0]:
        for k, j in dic.items():
            if k == year[1][1]:
                ans += year[1][2]
                break
            else:
                ans += j
    else:
        ans += days

print(ans)