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

Solution:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using si = set<int>;
using sl = set<ll>;
using vpi = vector<pi>;
using vpl = vector<pl>;
const int primeN = 5;
const int graphN = 5;
ll K = 1e9 + 7;
ll N = 1e5 + 5;
ll res = 0, tmp = 0;
ll a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;
ll add(ll a, ll b) { return (a + b) % K; }
ll gcd(ll a, ll b) {
  while (a) swap(a %= b, b);
  return b;
}
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }
bool is_prime(ll n) {
  for (ll i = sqrt(n) + 1; i > 1; --i)
    if (!(n % i)) return 0;
  return 1;
}
bool is_number(char c) { return ((c >= '0') && (c <= '9')); }
bool is_letter(char c) {
  return (((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')));
}
int c2i(char c) {
  if ((c >= 'a') && (c <= 'z')) return (c - 'a') + 1;
  if ((c >= 'A') && (c <= 'Z')) return (c - 'A') + 1;
  return 0;
}
int i2i(char c) {
  if ((c >= '0') && (c <= '9')) return (c - '0');
  return 0;
}
void partition(vl &a, int l, int r, int &m1, int &m2) {
  ll xa = a[l];
  for (int i = l + 1, m1 = l, m2 = l; i <= r; ++i)
    if (a[i] == xa)
      swap(a[i], a[++m2]);
    else if (a[i] < xa) {
      swap(a[i], a[++m2]);
      swap(a[m1++], a[m2]);
    }
}
void sort(vl &a, int l, int r) {
  int m1, m2, k = l + rand() % (r - l + 1);
  if (l >= r) return;
  swap(a[l], a[k]);
  partition(a, l, r, m1, m2);
  sort(a, l, m1 - 1);
  sort(a, m2 + 1, r);
}
void partition2(vl &a, vl &b, int l, int r, int &m1, int &m2) {
  ll xa = a[l], xb = b[l];
  for (int i = l + 1, m1 = l, m2 = l; i <= r; ++i)
    if ((a[i] == xa) && (b[i] == xb)) {
      swap(a[i], a[++m2]);
      swap(b[i], b[m2]);
    } else if ((a[i] < xa) || ((a[i] == xa) && (b[i] < xb))) {
      swap(a[i], a[++m2]);
      swap(a[m1], a[m2]);
      swap(b[i], b[m2]);
      swap(b[m1++], b[m2]);
    }
}
void sort2(vl &a, vl &b, int l, int r) {
  int m1, m2, k = l + rand() % (r - l + 1);
  if (l >= r) return;
  swap(a[l], a[k]);
  swap(b[l], b[k]);
  partition2(a, b, l, r, m1, m2);
  sort2(a, b, l, m1 - 1);
  sort2(a, b, m2 + 1, r);
}
vi prime(primeN);
void set_primes() {
  ll i, j;
  for (i = 1; i <= primeN; i++) prime[i] = 1;
  for (i = 2; i <= primeN; i++)
    if (prime[i])
      for (j = i + i; j <= primeN; j += i) prime[j] = 0;
}
void set_primes_prev() {
  ll i, j;
  for (i = 2; i < primeN; i++)
    if (!prime[i])
      for (j = i; j < primeN; j += i) prime[j] = i;
}
void set_primes_counts() {
  ll i, j;
  for (prime[1] = 0, i = 2; i < primeN; i++) prime[i] = prime[i / prime[i]] + 1;
}
vector<int> graph[graphN];
set<int> graph2[graphN];
vector<int> graph_colors(graphN);
vector<int> graph_parents(graphN);
int color_graph(int n, int i = -1, int color = 0) {
  if (i == -1) {
    for (int j = 1; j <= n; j++)
      if (!graph_colors[j]) color_graph(n, j, ++color);
  } else {
    graph_colors[i] = color;
    int m = graph[i].size();
    for (int j = 0; j < m; j++) {
      int k = graph[i][j];
      if (!graph_colors[k]) color_graph(n, k, color);
    }
  }
  return color;
}
int level_graph(int n, int i0 = 0, int i = 1, int color = 0) {
  if (graph_colors[i])
    return color;
  else {
    color++;
    graph_colors[i] = color;
    graph_parents[i] = i0;
    int m = graph[i].size();
    int tmp = color;
    for (int j = 0; j < m; j++) {
      tmp = level_graph(n, i, graph[i][j], color);
      if (tmp > color) tmp = color;
    }
    return tmp;
  }
}
int color_graph_chess_fail = 0;
int color_graph_chess_colors = 0;
void color_graph_chess(int i = 1, int color = 1) {
  graph_colors[i] = color;
  int m = graph[i].size();
  for (int j = 0; j < m; j++) {
    int k = graph[i][j];
    if (!graph_colors[k])
      color_graph_chess(k, 3 - color);
    else if (graph_colors[k] == color)
      color_graph_chess_fail = 1;
  }
}
void color_graph_chess2(int i0 = 0, int i = 1, int color0 = 0, int color = 1) {
  if (i == 1) {
    k = 0;
    graph_colors[i] = color;
  }
  int m = graph[i].size();
  if (m >= k) k = m + 1;
  int tmp = 1;
  for (int j = 0; j < m; j++) {
    if (tmp == color0 || tmp == color) tmp++;
    if (tmp == color0 || tmp == color) tmp++;
    l = graph[i][j];
    if (l != i0) {
      graph_colors[l] = tmp;
      color_graph_chess2(i, l, color, tmp);
      tmp++;
    }
  }
}
vl S(graphN), I(graphN), L(graphN), F(graphN);
ll SN = 0, II = 0, color = 0;
ll scc(int i = -1) {
  if (i == -1)
    for (i = 1; i <= n; i++) {
      if (!I[i]) scc(i);
    }
  else {
    L[i] = I[i] = ++II;
    S[SN++] = i;
    F[i] = 1;
    int j, k, m = graph[i].size();
    for (j = 0; j < m; j++) {
      k = graph[i][j];
      if (!I[k]) {
        scc(k);
        L[i] = min(L[i], L[k]);
      } else if (F[k])
        L[i] = min(L[i], I[k]);
    }
    if (L[i] == I[i]) {
      color++;
      do {
        k = S[--SN];
        F[k] = 0;
        graph_colors[k] = color;
      } while (k != i);
    }
  }
  return color;
}
int bfs(int i) {
  vi a(n + 1), b(n + 1);
  int ai = 0, am, an = 0, bi = 1, j, m, l, p, res = 0;
  a[an++] = i;
  b[i] = bi;
  while (bi < k) {
    bi++;
    for (am = an; ai < am; ai++) {
      j = a[ai];
      m = graph[j].size();
      for (l = 0; l < m; l++) {
        p = graph[j][l];
        if (!b[p]) {
          a[an++] = p;
          b[p] = bi;
          if (bi == k) res++;
        }
      }
    }
  }
  return res;
}
int main() {
  char c;
  string s;
  cin >> s;
  n = s.length();
  c = 'a';
  res = 0;
  for (i = 0; i < n; i++) {
    tmp = abs(s[i] - c);
    if (tmp > 13) tmp = 26 - tmp;
    res += tmp;
    c = s[i];
  }
  cout << res;
  return 0;
}