Problem: Grigoriy, like the hero of one famous comedy film, found a job as a night security guard at the museum. At first night he received embosser and was to take stock of the whole exposition.

Embosser is a special devise that allows to "print" the text of a plastic tape. Text is printed sequentially, character by character. The device consists of a wheel with a lowercase English letters written in a circle, static pointer to the current letter and a button that print the chosen letter. At one move it's allowed to rotate the alphabetic wheel one step clockwise or counterclockwise. Initially, static pointer points to letter 'a'. Other letters are located as shown on the picture:

<image>

After Grigoriy add new item to the base he has to print its name on the plastic tape and attach it to the corresponding exhibit. It's not required to return the wheel to its initial position with pointer on the letter 'a'.

Our hero is afraid that some exhibits may become alive and start to attack him, so he wants to print the names as fast as possible. Help him, for the given string find the minimum number of rotations of the wheel required to print it.

Input

The only line of input contains the name of some exhibit — the non-empty string consisting of no more than 100 characters. It's guaranteed that the string consists of only lowercase English letters.

Output

Print one integer — the minimum number of rotations of the wheel, required to print the name given in the input.

Examples

Input

zeus


Output

18


Input

map


Output

35


Input

ares


Output

34

Note

<image>

To print the string from the first sample it would be optimal to perform the following sequence of rotations: 

  1. from 'a' to 'z' (1 rotation counterclockwise), 
  2. from 'z' to 'e' (5 clockwise rotations), 
  3. from 'e' to 'u' (10 rotations counterclockwise), 
  4. from 'u' to 's' (2 counterclockwise rotations). 

In total, 1 + 5 + 10 + 2 = 18 rotations are required.

Solution (in PYTHON3):

Solution:
#чётные индексы
'''
a = list(map(int,input().split()))
for i in range(len(a)):
	if a[i] == ' ':
		a.remove(' ')
	elif i % 2== 0:
		print(a[i] , end = ' ')
'''
#чётные элементы
'''
a = list(map(int,input().split()))
for i in range(len(a)):
	if a[i] % 2 == 0:
		print(a[i] ,end = ' ')
'''
#Kolichestvo polojitelnih
'''
a = list(map(int,input().split())) 
for i in range(len(a)):
	if a[i] <= 0:
		a.remove(a[i])
print(len(a))
'''
#Bolshe predidushego 
'''
a = list(map(int,input().split()))
for i in range(len(a)-1):
	if a[i]>a[i+1]:
		print( a [ i ] , end = ' ')
'''
#sosedi odnogo znaka
'''
a = list(map(int,input().split()))
for i in range(len(a)):
	if ????????????????????????????
	????????????????????????
	???????????
'''
#Bolshe svoih sosedey
'''
a = list (map (int , input () . split()))
b = 0
for i in range(len(a)-2):
	if a[i+1] > a[i] and a[i+1] > a[i+2]:
		b+=1
print(b)
'''
#Наибольший элемент
'''
a = list(map(int,input().split()))
b = 0
c = 0
for i in range(len(a)-1):
	if a[i]>a[i+1]:
		b = a[i]
		c = i
print(b,c)
'''
#Наименьший положительный
'''
a = list(map(int,input().split()))
for i in range(len(a)):
	try:
		if a[i] <= 0:
			 del a[i]
	except IndexError:
		pass
print(min(a))
'''
#naimenshiy nechotniy???
'''
a = list(map(int,input().split()))
b = 0
for i in range(len(a)): 
 if a[i] <= 0:
	 del a[i]
 elif a[i] % 2 == 0:
	 del a[i]
print(min(a))	  
'''
#Sherenga
'''
a = list(map(int,input().split(' ')))
e = list(map(int,input().split(' ')))
b = 1
for i in range(len(a)):
	if e[0] >a[i]:
		b+=1
print(b)
'''
#kolichestvo razlichnih elementov
'''
print(4-len(set(input().split(' '))))
'''
#Вывести в обратном порядке
'''
a = list(map(int,input().split()))
a.reverse()
print(*a,sep = ' ' )
'''
#Переставить в обратном порядке
'''
a = list(map(int,input().split()))
a.reverse()
print(*a,sep = ' ' )
'''
'''
import pdb 
a = list(map(int,input().split()))
pdb.set_trace()
for i in range(len(a)):
	a[i] = a[i]
print(a)	
'''
'''
a = list(map(int,input().split(' ')))
for i in range(len(a)):
	c = max(a)
	b = min(a)
	
'''
'''
a = list(map(int,input().split(' ')))
b = int(input())
for i in range(len(a)):
	if i == b:
		a.remove(a[i])
print(* a , sep = ' ')		
'''
'''
a = list(map(int,input().split(' ')))
b,c = map(int,input().split())
for i in range(len(a)):
	if i == b:
		'''
'''
a = int(input())
b = list(map(int,input().split(' ')))
seroga = 0
dima = 0
c = True
for i in range(len(b)):
	if b[0] >= b[-1]:
		dima += b[0]
		c = False
		del b[0]
		if len(b) == 0:
			break
	if c == False:
		seroga += b[-1]
		c = True
		del b[-1]
		if len(b) == 0:
			break 
print(seroga, dima)
'''
'''
a = input()
a.lower()
b = 0
for i in a :
	if a[b] == 'a' or a[b] == 'o' or a[b] == 'y' or a[b] == 'e' or a[b] == 'u' or a[b] == 'i':
		'''
'''		
n = int(input()) # n<= 10^5
b = list(map(int,input().split())) #-1 , 1 , 2 ,3... ,10
c = 0 #crimes
for i in range(a-1): 
	if b[i] < 0 and b[i+1] > 0 or b[i] < 0 and b[i+1] < 0:
		c += 1
	else:
'''
'''
a,b = map(int,input().split())
c =  list(map(int,input().split()))
cumka = list(set(c))
if len(cumka)>= b:
	print("YES")
	for i in range(b):
		print(c.index(cumka[i])+1,end = ' ')
else:
	print("NO")
'''
'''
l=[2,1,0,1,2]
for i in l:
	s=input()
	if "1" in s:
		print(i+l[s.find("1")//2])
'''
c=97
s=0
f = map(ord,input())
for x in f:
	i=abs(c-x)
	s+=min(i,26-i)
	c=x
print(s)