Calendars in widespread use today include the Gregorian calendar, which is the de facto international standard, and is used almost everywhere in the world for civil purposes. The Gregorian reform modified the Julian calendar's scheme of leap years as follows:

 Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100; the centurial years that are exactly divisible by 400 are still leap years. For example, the year 1900 is not a leap year; the year 2000 is a leap year.  [Image] 

In this problem, you have been given two dates and your task is to calculate how many days are between them. Note, that leap years have unusual number of days in February.

Look at the sample to understand what borders are included in the aswer.


-----Input-----

The first two lines contain two dates, each date is in the format yyyy:mm:dd (1900 ≤ yyyy ≤ 2038 and yyyy:mm:dd is a legal date).


-----Output-----

Print a single integer — the answer to the problem.


-----Examples-----
Input
1900:01:01
2038:12:31

Output
50768

Input
1996:03:09
1991:11:12

Output
1579

Difficulty: EASY

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


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


import datetime
tA = datetime.datetime.strptime(input(), '%Y:%m:%d')
tB = datetime.datetime.strptime(input(), '%Y:%m:%d')
print(abs((tB - tA).days))


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


import sys
a = [int(x) for x in sys.stdin.readline().strip().split(':')]
b = [int(x) for x in sys.stdin.readline().strip().split(':')]
stuff = [a, b]
stuff = sorted(stuff)
begin = stuff[0]
end = stuff[1]
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:
		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] - 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)


import datetime
a = datetime.datetime.strptime(input(), '%Y:%m:%d')
b = datetime.datetime.strptime(input(), '%Y:%m:%d')
print(abs((a - b).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)


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


def get(y, m, d):
	if m < 3:
		y -= 1
		m += 12
	return 365 * y + y // 4 - y // 100 + y // 400 + (153 * m - 457) // 5 + d - 306
a1 = input().split(':')
a2 = input().split(':')
print(abs(get(int(a1[0]), int(a1[1]), int(a1[2])) - get(int(a2[0]), int(a2[1]), int(a2[2]))))


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
from datetime import date
print(abs((date(*map(int, input().split(':'))) - date(*map(int, input().split(':')))).days))


from datetime import date
a = date(*map(int, input().split(':')))
b = date(*map(int, input().split(':')))
print(abs(a - b).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)))


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:
		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]))


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


from datetime import date
(a, b, c) = input().split(':')
(d, e, f) = input().split(':')
a = int(a)
b = int(b)
c = int(c)
d = int(d)
e = int(e)
f = int(f)
g = date(a, b, c)
h = date(d, e, f)
if g > h:
	(g, h) = (h, g)
n = h - g
n = n.days
print(n)


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
import sys
import datetime
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
s1 = input()
s2 = input()
(y1, m1, d1) = ('', '', '')
(y2, m2, d2) = ('', '', '')
for i in range(4):
	y1 += s1[i]
	y2 += s2[i]
for i in range(5, 7):
	m1 += s1[i]
	m2 += s2[i]
for i in range(8, len(s1)):
	d1 += s1[i]
	d2 += s2[i]
(y1, m1, d1) = (int(y1), int(m1), int(d1))
(y2, m2, d2) = (int(y2), int(m2), int(d2))
dt1 = datetime.date(y1, m1, d1)
dt2 = datetime.date(y2, m2, d2)
print(abs(dt1 - dt2).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))


t = [0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]

def g(y, m):
	return int(m > 2 and y % 4 == 0 and (y % 100 != 0 or y % 400 == 0))

def h(y):
	return y // 4 - y // 100 + y // 400

def f(y, m, d):
	nonlocal t
	return 365 * y + t[m] + d + h(y - 1) + g(y, m)
print(abs(f(*map(int, input().split(':'))) - f(*map(int, input().split(':')))))


import datetime

def solve(date1, date2):
	d1 = datetime.datetime(int(date1[0]), int(date1[1]), int(date1[2]))
	d2 = datetime.datetime(int(date2[0]), int(date2[1]), int(date2[2]))
	print(abs((d2 - d1).days))
date1 = input()
date2 = input()
solve(date1.split(':'), date2.split(':'))


from math import ceil, sqrt, gcd, log, floor
from collections import deque

def ii():
	return int(input())

def si():
	return input()

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

def li():
	return list(mi())

def msi():
	return map(str, input().strip().split(' '))

def lsi():
	return list(msi())
month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def Date_calculation(d1, m1, y1):
	c1 = 0
	for i in range(1900, y1):
		if i % 400 == 0 or (i % 4 == 0 and i % 100 != 0):
			c1 += 366
		else:
			c1 += 365
	f = 0
	if y1 % 400 == 0 or (y1 % 4 == 0 and y1 % 100 != 0):
		f = 1
	for i in range(1, m1):
		if i == 2:
			if f == 1:
				c1 += 29
			else:
				c1 += 28
			continue
		c1 += month[i - 1]
	c1 += d1
	return c1
(y1, m1, d1) = mi()
(y2, m2, d2) = mi()
c1 = Date_calculation(d1, m1, y1)
c2 = Date_calculation(d2, m2, y2)
print(abs(c2 - c1))


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
import sys
import datetime
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
d1 = datetime.datetime.strptime(input(), '%Y:%m:%d')
d2 = datetime.datetime.strptime(input(), '%Y:%m:%d')
print(abs(d1 - d2).days)


import datetime
(a, b, c) = map(int, input().split(':'))
d1 = datetime.date(a, b, c)
(a, b, c) = map(int, input().split(':'))
d2 = datetime.date(a, b, c)
d3 = abs(d2 - d1)
print(d3.days)


import datetime as d
t1 = d.datetime.strptime(input(), '%Y:%m:%d')
t2 = d.datetime.strptime(input(), '%Y:%m:%d')
print(abs((t2 - t1).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))


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)


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

def isn(yyyy):
	if yyyy == 1900:
		return False
	return yyyy % 4 == 0

def toint(date):
	(yyyy, mm, dd) = date
	res = 0
	for y in range(1900, yyyy):
		res += 365 + isn(y)
	for m in range(1, mm):
		res += month[m] + (m == 2 and isn(yyyy))
	return res + dd
first = tuple(map(int, input().strip().split(':')))
last = tuple(map(int, input().strip().split(':')))
if last < first:
	(last, first) = (first, last)
print(toint(last) - toint(first))


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


import datetime
import sys

def __starting_point():
	for l in sys.stdin:
		a = tuple((int(i) for i in l.strip().split(':')))
		s = datetime.date(*a)
		break
	for l in sys.stdin:
		a = tuple((int(i) for i in l.strip().split(':')))
		e = datetime.date(*a)
		break
	print(abs((e - s).days))
__starting_point()


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)


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))


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))


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()


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(abs((db - da).days))


def f(y, m, d):
	return 365 * y + 31 * m + d + ((y - 1) // 4 - (y - 1) // 100 + (y - 1) // 400) - ((2 + int(y % 4 != 0 or (y % 100 == 0 and y % 400 != 0))) * (m > 2) + (m > 4) + (m > 6) + (m > 9) + (m > 11))
print(abs(f(*map(int, input().split(':'))) - f(*map(int, input().split(':')))))


start = input().split(':')
end = input().split(':')
(start[0], start[1], start[2]) = (int(start[0]), int(start[1]), int(start[2]))
(end[0], end[1], end[2]) = (int(end[0]), int(end[1]), int(end[2]))
if start[0] > end[0] or (start[0] == end[0] and start[1] > end[1]) or (start[0] == end[0] and start[1] == end[1] and (start[2] > end[2])):
	e = list(start)
	s = list(end)
else:
	e = list(end)
	s = list(start)
days = 0
for i in range(s[0] + 1, e[0]):
	if i % 400 == 0:
		days += 366
	elif i % 100 == 0:
		days += 365
	elif i % 4 == 0:
		days += 366
	else:
		days += 365
month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if s[0] % 400 == 0:
	month[1] += 1
elif s[0] % 100 == 0:
	month[1] = 28
elif s[0] % 4 == 0:
	month[1] += 1
for i in range(s[1] + 1, 13):
	days += month[i - 1]
month[1] = 28
if e[0] % 400 == 0:
	month[1] += 1
elif e[0] % 100 == 0:
	month[1] = 28
elif e[0] % 4 == 0:
	month[1] += 1
for i in range(0, e[1] - 1):
	days += month[i]
month[1] = 28
if s[0] % 400 == 0:
	month[1] += 1
elif s[0] % 100 == 0:
	month[1] = 28
elif s[0] % 4 == 0:
	month[1] += 1
days += e[2]
days += month[s[1] - 1] - s[2]
if s[0] == e[0]:
	days = 0
	for i in range(s[1] + 1, e[1]):
		days += month[i - 1]
	days += e[2]
	days += month[s[1] - 1] - s[2]
if s[0] == e[0] and s[2] == e[2]:
	days = 0
	for i in range(s[1], e[1]):
		days += month[i - 1]
if s[0] == e[0] and s[1] == e[1]:
	days = e[2] - s[2]
if s[0] == e[0] and s[1] == e[1] and (s[2] == e[2]):
	days = 0
print(days)


import datetime
a = input()
b = input()
ta = datetime.datetime.strptime(a, '%Y:%m:%d')
tb = datetime.datetime.strptime(b, '%Y:%m:%d')
d = abs(tb - ta).total_seconds() / 3600 / 24
print(round(d))


is_leap = {}
for year in range(1900, 2039):
	is_leap[year] = year % 400 == 0 or (year % 100 != 0 and year % 4 == 0)
DAYS_MONTH = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
(ya, ma, da) = map(int, input().split(':'))
(yb, mb, db) = map(int, input().split(':'))
if (ya, ma, da) > (yb, mb, db):
	(ya, ma, da, yb, mb, db) = (yb, mb, db, ya, ma, da)
ans = 0
if ya != yb:
	if is_leap[ya]:
		DAYS_MONTH[2] += 1
	ans += DAYS_MONTH[ma] - da + 1
	for m in range(ma + 1, 13):
		ans += DAYS_MONTH[m]
	if is_leap[ya]:
		DAYS_MONTH[2] -= 1
	for y in range(ya + 1, yb):
		ans += 366 if is_leap[y] else 365
	(ya, ma, da) = (yb, 1, 1)
if ma != mb:
	if is_leap[ya]:
		DAYS_MONTH[2] += 1
	ans += DAYS_MONTH[ma] - da + 1
	for m in range(ma + 1, mb):
		ans += DAYS_MONTH[m]
	if is_leap[ya]:
		DAYS_MONTH[2] -= 1
	(ma, da) = (mb, 1)
if da != db:
	ans += db - da
print(ans)


import math
from datetime import date

def main():
	a = input().split(':')
	b = input().split(':')
	d1 = date(int(a[0]), int(a[1]), int(a[2]))
	d2 = date(int(b[0]), int(b[1]), int(b[2]))
	print(abs((d1 - d2).days))
main()


def isLeep(year):
	if year % 400 == 0:
		return 1
	else:
		if year % 4 == 0 and year % 100 != 0:
			return 1
		return 0

def cmp(y1, m1, d1, y2, m2, d2):
	if y1 > y2:
		return 0
	elif y1 == y2 and m1 > m2:
		return 0
	else:
		if y1 == y2 and m1 == m2 and (d1 > d2):
			return 0
		return 1
(y1, m1, d1) = list(map(int, input().split(':')))
(y2, m2, d2) = list(map(int, input().split(':')))
days = [31, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
if cmp(y1, m1, d1, y2, m2, d2) == 0:
	t = y1
	y1 = y2
	y2 = t
	t = m1
	m1 = m2
	m2 = t
	t = d1
	d1 = d2
	d2 = t
res = 0
while True:
	res = res + 1
	if y1 == y2 and m1 == m2 and (d1 == d2):
		break
	d1 = d1 + 1
	if d1 <= days[m1]:
		continue
	elif d1 == 29:
		if isLeep(y1):
			continue
		else:
			m1 = 3
			d1 = 1
	elif d1 == 30:
		m1 = 3
		d1 = 1
	elif d1 == 31:
		m1 = m1 + 1
		d1 = 1
	elif d1 == 32:
		if m1 == 12:
			y1 = y1 + 1
			m1 = 1
			d1 = 1
		else:
			m1 = m1 + 1
			d1 = 1
print(res - 1)


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))


def STR():
	return list(input())

def INT():
	return int(input())

def MAP():
	return map(int, input().split())

def MAP2():
	return map(float, input().split())

def LIST():
	return list(map(int, input().split()))

def STRING():
	return input()
import string
import sys
import datetime
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]

def leap_year(y):
	if y % 4 == 0 and y % 100 != 0 or y % 400 == 0:
		return 366
	return 365
s1 = input()
s2 = input()
months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
(y1, m1, d1) = ('', '', '')
(y2, m2, d2) = ('', '', '')
for i in range(4):
	y1 += s1[i]
	y2 += s2[i]
for i in range(5, 7):
	m1 += s1[i]
	m2 += s2[i]
for i in range(8, len(s1)):
	d1 += s1[i]
	d2 += s2[i]
(y1, m1, d1) = (int(y1), int(m1), int(d1))
(y2, m2, d2) = (int(y2), int(m2), int(d2))
(res1, res2) = (d1, d2)
for i in range(y1):
	res1 = res1 + leap_year(i)
for i in range(y2):
	res2 = res2 + leap_year(i)
for i in range(0, m1 - 1):
	res1 += months[i]
	if leap_year(y1) == 366 and i == 1:
		res1 += 1
for i in range(0, m2 - 1):
	res2 += months[i]
	if leap_year(y2) == 366 and i == 1:
		res2 += 1
print(abs(res1 - res2))


from datetime import date
d = [0] * 2
for i in range(0, 2):
	a = list(map(int, input().split(':')))
	d[i] = date(a[0], a[1], a[2])
r = (d[0] - d[1]).days
print(r if r >= 0 else -r)


import datetime
kkk = datetime.datetime.strptime(input(), '%Y:%m:%d')
cz = datetime.datetime.strptime(input(), '%Y:%m:%d')
print(abs((cz - kkk).days))


def leapyear(a):
	if a % 400 == 0:
		return True
	elif a % 100 == 0:
		return False
	elif a % 4 == 0:
		return True
a1 = input()
a2 = input()
if a1 == a2:
	print(0)
else:
	if int(a1[:4]) > int(a2[:4]) or (a1[:4] == a2[:4] and int(a1[5:7]) > int(a2[5:7])):
		temp = a1
		a1 = a2
		a2 = temp
	(y1, m1, d1) = a1.split(':')
	(y2, m2, d2) = a2.split(':')
	y1 = int(y1)
	d1 = int(d1)
	y2 = int(y2)
	d2 = int(d2)
	months = {'01': 31, '02': 28, '03': 31, '04': 30, '05': 31, '06': 30, '07': 31, '08': 31, '09': 30, '10': 31, '11': 30, '12': 31}
	rem_months = {'01': 334, '02': 306, '03': 275, '04': 245, '05': 214, '06': 184, '07': 153, '08': 122, '09': 92, '10': 61, '11': 31, '12': 0}
	end_months = {'01': 0, '02': 31, '03': 59, '04': 90, '05': 120, '06': 151, '07': 181, '08': 212, '09': 243, '10': 273, '11': 304, '12': 334}
	res = 0
	if y1 != y2:
		if m1 != '02' or m1 != '01':
			res += months[m1] - d1
			res += rem_months[m1]
		else:
			if y1 % 4 == 0 and leapyear(y1) == True:
				if m1 == '01':
					res += months[str(m1)] - d1
					res += 29
				else:
					res += 29 - d1
			elif m1 == '01':
				res += months[str(m1)] - d1
				res += 28
			else:
				res += 28 - d1
			res += rem_months['03']
		y1 += 1
		while y1 < y2:
			if leapyear(y1) == True:
				res += 366
			else:
				res += 365
			y1 += 1
		if leapyear(y2) == True:
			res += end_months[m2]
			res += d2
			if m2 != '02' and m1 != '01':
				res += 1
		else:
			res += end_months[m2]
			res += d2
	elif y1 == y2 and m1 != m2:
		res += months[m1] - d1
		if res <= 0:
			res = 0
		mq = int(m1) + 1
		m2q = int(m2)
		while mq < m2q:
			if mq < 10:
				res += months['0' + str(mq)]
			else:
				res += months[str(mq)]
			mq += 1
		res += d2
	elif y1 == y2 and m1 == m2:
		res = abs(d2 - d1)
	print(res)


from sys import stdin as read
from sys import stdout as out

def leap_year(y):
	if y == 1900:
		return False
	else:
		return y % 4 == 0
months = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def cur_date(date):
	res = 0
	(y, m, d) = date
	for i in range(1900, y):
		res += 365 + leap_year(i)
	for i in range(1, m):
		res += months[i] + (i == 2 and leap_year(y))
	return res + d
date_1 = tuple(map(int, read.readline().split(':')))
date_2 = tuple(map(int, read.readline().split(':')))
if date_2 < date_1:
	(date_1, date_2) = (date_2, date_1)
out.write(str(cur_date(date_2) - cur_date(date_1)) + '\n')


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


class Data:

	def __init__(self, dia, mes, ano):
		self.dia = dia
		self.mes = mes
		self.ano = ano

	def __lt__(self, other):
		if self.ano == other.ano:
			if self.mes == other.mes:
				return self.dia < other.dia
			else:
				return self.mes < other.mes
		else:
			return self.ano < other.ano

def eh_bissexto(ano):
	return ano % 4 == 0 and ano % 100 != 0 or ano % 400 == 0

def check_data(dia, mes, ano):
	qtd_dias_mes = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
	if eh_bissexto(ano):
		qtd_dias_mes[1] = 29
	if 1 <= mes <= 12:
		if 1 <= dia <= qtd_dias_mes[mes - 1]:
			return True
	return False
(ano1, mes1, dia1) = map(int, input().split(':'))
(ano2, mes2, dia2) = map(int, input().split(':'))
datas = [Data(dia1, mes1, ano1), Data(dia2, mes2, ano2)]
datas.sort()
d1 = datas[0]
d2 = datas[1]
dia1 = d1.dia
mes1 = d1.mes
ano1 = d1.ano
dia2 = d2.dia
mes2 = d2.mes
ano2 = d2.ano
qtd = 0
while ano1 != ano2 or mes1 != mes2 or dia1 != dia2:
	qtd += 1
	dia1 += 1
	if not check_data(dia1, mes1, ano1):
		dia1 = 1
		mes1 += 1
	if not check_data(dia1, mes1, ano1):
		mes1 = 1
		ano1 += 1
print(qtd)


import datetime
firsttime = datetime.datetime.strptime(input(), '%Y:%m:%d')
lasttime = datetime.datetime.strptime(input(), '%Y:%m:%d')
print(abs((lasttime - firsttime).days))


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


import time
import datetime
import calendar
date1 = input().split(':')
date1 = [int(x) for x in date1]
date2 = input().split(':')
date2 = [int(x) for x in 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 *
R = lambda : datetime(*map(int, input().split(':')))
date1 = R()
date2 = R()
print(abs(date2 - date1).days)


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


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]
				break
			else:
				days -= j
	if i == year[1][0]:
		for (k, j) in reversed(dic.items()):
			if k == year[1][1]:
				days -= j - year[1][2]
				break
			else:
				days -= j
	ans += days
print(ans)


from datetime import date
s1 = list(map(int, input().split(':')))
s2 = list(map(int, input().split(':')))
a = date(s1[0], s1[1], s1[2])
b = date(s2[0], s2[1], s2[2])
x = abs((a - b).days)
print(x)


leap = []
for i in range(1900, 2039):
	if i % 4 == 0 and i % 100 != 0:
		leap.append(i)
	elif i % 4 == 0 and i % 100 == 0 and (i % 400 == 0):
		leap.append(i)
d1 = [1900, 1, 1]
d2 = [2038, 12, 31]
date = []
date.append(d1[:])
mon = [0, 1, 2, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1]
t = 0
while d1 != d2:
	d1[2] += 1
	if d1[2] == 30 and d1[0] in leap and (mon[d1[1]] == 2):
		d1[1] += 1
		d1[2] = 1
	elif d1[2] == 29 and mon[d1[1] == 2] and (d1[0] not in leap):
		d1[1] += 1
		d1[2] = 1
	elif d1[2] == 32 and mon[d1[1]] == 1:
		if d1[1] != 12:
			d1[1] += 1
			d1[2] = 1
		else:
			d1[0] += 1
			d1[1] = 1
			d1[2] = 1
	elif d1[2] == 31 and mon[d1[1]] == 0:
		d1[2] = 1
		d1[1] += 1
	date.append(d1[:])
dt1 = list(map(int, input().split(':')))
dt2 = list(map(int, input().split(':')))
print(abs(date.index(dt2) - date.index(dt1)))


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)


m = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

def leap(yy):
	if yy % 400 == 0 or (yy % 4 == 0 and yy % 100):
		return 366
	else:
		return 365

def main():
	(y1, m1, d1) = list(map(int, input().split(':')))
	(y2, m2, d2) = list(map(int, input().split(':')))
	a = d1
	b = d2
	for i in range(0, y1):
		a = a + leap(i)
	for i in range(0, y2):
		b = b + leap(i)
	for i in range(m1 - 1):
		a = a + m[i]
		if leap(y1) == 366 and i == 1:
			a = a + 1
	for i in range(m2 - 1):
		b = b + m[i]
		if leap(y2) == 366 and i == 1:
			b = b + 1
	print(abs(a - b))

def __starting_point():
	main()
__starting_point()


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]))


import datetime
(a, b) = [input(), input()]
print(abs((datetime.date(int(a.split(':')[0]), int(a.split(':')[1]), int(a.split(':')[2])) - datetime.date(int(b.split(':')[0]), int(b.split(':')[1]), int(b.split(':')[2]))).days))


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))


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)


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

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

def dn(y, m, d):
	return d + sum((dm[i] + (i == 2 and leap(y)) for i in range(m)))
d = sorted((list(map(int, input().split(':'))) for i in range(2)))
if d[0][0] == d[1][0]:
	print(dn(*d[1]) - dn(*d[0]))
else:
	print(365 + leap(d[0][0]) - dn(*d[0]) + sum((365 + leap(i) for i in range(d[0][0] + 1, d[1][0]))) + dn(*d[1]))


def day_number(d, m, y):
	res = d
	meses = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
	if m != 1:
		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])))


def leap(i):
	s = 0
	if i % 4 == 0:
		if i % 100 == 0:
			if i % 400 == 0:
				s += 366
			else:
				s += 365
		else:
			s += 366
	else:
		s += 365
	return s
year = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
a = list(map(int, input().split(':')))
b = list(map(int, input().split(':')))
s = 0
if a[0] > b[0]:
	(a, b) = (b, a)
elif a[0] == b[0]:
	s = 0
	if a[1] > b[1]:
		(a, b) = (b, a)
	for i in range(a[1] + 1, b[1]):
		s += year[i]
	if a[1] == b[1]:
		print(abs(a[2] - b[2]))
		exit()
	s += b[2]
	s += max(0, year[a[1]] - a[2])
	if leap(a[0]) == 366 and a[1] < 2 < b[1]:
		s += 1
	print(s)
	exit()
for i in range(a[0] + 1, b[0]):
	s += leap(i)
for i in range(a[1] + 1, 13):
	s += year[i]
for i in range(b[1]):
	s += year[i]
s += b[2]
s += max(0, year[a[1]] - a[2])
if leap(a[0]) == 366 and a[1] < 2:
	s += 1
if leap(b[0]) == 366 and 2 < b[1]:
	s += 1
print(s)


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]))
if d0 < d1:
	delta = d1 - d0
else:
	delta = d0 - d1
print(delta.days)


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()
end = date(sy, sm, sd)
start = date(ey, em, ed)
print(abs((end - start).days))


from datetime import date
(a, b, c) = map(int, input().split(':'))
(d, e, f) = map(int, input().split(':'))
tmp1 = date(a, b, c)
tmp2 = date(d, e, f)
ans = tmp2 - tmp1
print(abs(ans.days))