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.
u=int(input())
a=input()
b=input()
n=0
n1=0
lst=[]
lst1=[]
for x in a:
    lst.append(x)
for y in b:
    lst1.append(y)
for d in range(len(a)):
    if n<=len(a):
        i=max(int(lst[n]),int(lst1[n]))-min(int(lst[n]),int(lst1[n]))
        n+=1
        if i > 5:
            if i==6:
                n1+=4
            elif i==7:
                n1+=3
            elif i==8:
                n1+=2
            else:
                n1+=1
        else:
            n1 += i
    else:
        break
print(n1)