human
A and B are preparing themselves for programming contests.

After several years of doing sports programming and solving many problems that require calculating all sorts of abstract objects, A and B also developed rather peculiar tastes.

A likes lowercase letters of the Latin alphabet. He has assigned to each letter a number that shows how much he likes that letter (he has assigned negative numbers to the letters he dislikes). 

B likes substrings. He especially likes the ones that start and end with the same letter (their length must exceed one).

Also, A and B have a string s. Now they are trying to find out how many substrings t of a string s are interesting to B (that is, t starts and ends with the same letter and its length is larger than one), and also the sum of values of all letters (assigned by A), except for the first and the last one is equal to zero.

Naturally, A and B have quickly found the number of substrings t that are interesting to them. Can you do it? 

Input

The first line contains 26 integers xa, xb, ..., xz ( - 105 ≤ xi ≤ 105) — the value assigned to letters a, b, c, ..., z respectively.

The second line contains string s of length between 1 and 105 characters, consisting of Lating lowercase letters— the string for which you need to calculate the answer. 

Output

Print the answer to the problem. 

Examples

Input

1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 8 1 1 1 1 1 1
xabcab

Output

2

Input

1 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 8 1 1 1 1 1 1
aaa

Output

2

Note

In the first sample test strings satisfying the condition above are abca and bcab.

In the second sample test strings satisfying the condition above are two occurences of aa.

Give me a Python code to find out how many substrings t of a string s are interesting to B (that is, t starts and ends with the same letter and its length is larger than one), and also the sum of values of all letters (assigned by A), except for the first and the last one is equal to zero?
assistant
#Here is Python code to find out how many substrings t of a string s are interesting to B (that is, t starts and ends with the same letter and its length is larger than one), and also the sum of values of all letters (assigned by A), except for the first and the last one is equal to zero.

"""Template for Python Competitive Programmers prepared by pa.n.ik and Kabeer seth """

# to use the print and division function of Python3
from __future__ import division, print_function

"""value of mod"""
MOD = 998244353
mod = 10**9 + 7

"""use resource"""
# import resource
# resource.setrlimit(resource.RLIMIT_STACK, [0x100000000, resource.RLIM_INFINITY])

"""for factorial"""

# def prepare_factorial():
#     fact = [1]
#     for i in range(1, 2005):
#         fact.append((fact[-1] * i) % mod)
#     ifact = [0] * 2005
#     ifact[2004] = pow(fact[2004], mod - 2, mod)
#     for i in range(2004, 0, -1):
#         ifact[i - 1] = (i * ifact[i]) % mod
#
#     return fact, ifact

"""uncomment next 4 lines while doing recursion based question"""
# import threading
# threading.stack_size(1<<27)
import sys
# sys.setrecursionlimit(10000)

"""uncomment modules according to your need"""
# from bisect import bisect_left, bisect_right, insort
from itertools import repeat
# from math import floor, ceil, sqrt, degrees, atan, pi, log
# from heapq import heappop, heapify, heappush
# from random import randint as rn
# from Queue import Queue as Q
from collections import Counter, defaultdict, deque
# from copy import deepcopy
'''
def modinv(n, p):
    return pow(n, p - 2, p)
'''

#
# def ncr(n, r,  fact, ifact):  # for using this uncomment the lines calculating fact and ifact
#     t = (fact[n] * (ifact[r]*ifact[n-r]) % mod)% mod
#     return t


def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def input(): return sys.stdin.readline().strip()

"""*****************************************************************************************"""

# def GCD(x, y):
#     while (y):
#         x, y = y, x % y
#     return x

# def lcm(x, y):
#     return (x*y)//(GCD(x, y))

# def get_xor(n):
#     return [n,1,n+1,0][n%4]

# def pow(a, b, d):
#     # print(a, b, d)
#     res = 1
#     while b:
#         if b&1:
#             res = (res%d *...