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:
# cook your dish here
#!/usr/bin/env python
import os
from math import ceil
import sys
from io import BytesIO, IOBase
import sys,bisect,copyreg,copy,statistics,os

def inp(): return sys.stdin.readline().strip()
def IIX(): return (int(x) for x in sys.stdin.readline().split())
def II(): return (int(inp()))
def LI(): return list(map(int, inp().split()))
def LS(): return list(map(str, inp().split()))
def L(x):return list(x)
def out(var): return sys.stdout.write(str(var))

#Graph using Ajdacency List

class GraphAL:
    def __init__(self,Nodes,isDirected=False):
        self.nodes=[x for x in range(Nodes+1) ]
        self.adj_list={}
        self.isDirected=isDirected
        for node in self.nodes:
            self.adj_list[node]=[]
    
    def add_edge(self,x,y):
        self.adj_list[x].append(y)
        if self.isDirected==False:
            self.adj_list[y].append(x)
    
    def return_graph(self):
        return(self.adj_list)

#Graph using Ajdacency Matrix

class GraphAM:
    def __init__(self,Nodes,isDirected=False):
        self.adj_matrix=[ [0]*(Nodes+1) for x in range(Nodes+1)]
        self.isDirected=isDirected

    def add_edge(self,x,y):
        if self.isDirected:
            self.adj_matrix[x][y]=1
        elif self.isDirected==False:
            self.adj_matrix[x][y]=1
            self.adj_matrix[y][x]=1
    
    def delete_edge(self,x,y):
        if self.isDirected:
            self.adj_matrix[x][y]=0
        if self.isDirected==False:
            self.adj_matrix[x][y]=0
            self.adj_matrix[y][x]=0
    
    def degree(self,x):
        l=self.adj_matrix[x]
        return l.count(1)

    def return_graph(self):
        return self.adj_matrix



'''
nodes=II() 
edges=II() 
graph=GraphAL(nodes) #Add 'True' to the Graph method, for directed graph
connections=[]
for i in range(edges):
    l=LI()
    connections.append(l)

for connect in connections:
    graph.add_edge(connect[0],connect[1])

grp=graph.return_graph()
'''

#Code goes here


def solve():
    st=inp()
    alph='abcdefghijklmnopqrstuvwxyz'
    start='a'
    cost=0
    for x in st:
        i=alph.index(start)
        j=alph.index(x)
        diff=abs(j-i)
        cost+=abs(min(diff,26-diff))
        start=x
    out(cost)
            
        
# region fastio

BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    try:
        t=1
        for _ in range(t): 
            solve()
    except EOFError as e:
        out('')
    except RuntimeError as r:
        out('')