Scrooge McDuck keeps his most treasured savings in a home safe with a combination lock. Each time he wants to put there the treasures that he's earned fair and square, he has to open the lock.

The combination lock is represented by *n* rotating disks with digits from 0 to 9 written on them. Scrooge McDuck has to turn some disks so that the combination of digits on the disks forms a secret combination. In one move, he can rotate one disk one digit forwards or backwards. In particular, in one move he can go from digit 0 to digit 9 and vice versa. What minimum number of actions does he need for that?
The first line contains a single integer *n* (1 ≤ *n* ≤ 1000) — the number of disks on the combination lock.

The second line contains a string of *n* digits — the original state of the disks.

The third line contains a string of *n* digits — Scrooge McDuck's combination that opens the lock.
import time

n = int(input())
d = list(input())
d1 = list(map(int, d))
d2 = list(input())
d2 = list(map(int, d2))
v = d
v = list(map(int, v))
s = 0
x = 0
c = 0
#print(d1, d2, v)
#print("   1 2 x")
for i in range(n):
    while d1[i] != d2[i]:
        if d1[i] < d2[i]:
            d1[i] += 1
            x += 1
            #print("KL", d1[i], d2[i], x)
        elif d1[i] > d2[i]:
            d1[i] -= 1
            x += 1
            #print("GR", d1[i], d2[i], x)
        if x > 5:
            #print("XXXXX")
            #print(d1[i], v[i], d2[i])
            while v[i] < d2[i]:
                if v[i] != -1:
                    v[i] -= 1
                    s+=1
                    #print("K",v[i], s)
                    d1[i] = v[i]
                elif v[i] == -1:
                    v[i] = 9
                    #print(v[i], s)
                    d1[i] = v[i]
                #print(d1[i])
                x=s
            
print(x)
