Pasha got a very beautiful string s for his birthday, the string consists of lowercase Latin letters. The letters in the string are numbered from 1 to |s| from left to right, where |s| is the length of the given string.

Pasha didn't like his present very much so he decided to change it. After his birthday Pasha spent m days performing the following transformations on his string — each day he chose integer a_{i} and reversed a piece of string (a segment) from position a_{i} to position |s| - a_{i} + 1. It is guaranteed that 2·a_{i} ≤ |s|.

You face the following task: determine what Pasha's string will look like after m days.


-----Input-----

The first line of the input contains Pasha's string s of length from 2 to 2·10^5 characters, consisting of lowercase Latin letters.

The second line contains a single integer m (1 ≤ m ≤ 10^5) —  the number of days when Pasha changed his string.

The third line contains m space-separated elements a_{i} (1 ≤ a_{i}; 2·a_{i} ≤ |s|) — the position from which Pasha started transforming the string on the i-th day.


-----Output-----

In the first line of the output print what Pasha's string s will look like after m days.


-----Examples-----
Input
abcdef
1
2

Output
aedcbf

Input
vwxyz
2
2 2

Output
vwxyz

Input
abcdef
3
1 2 3

Output
fbdcea

Difficulty: interview

Starter code:

Solutions:
s = list(input())
n = len(s) // 2
m = int(input())
a = [int(x) for x in input().split()]
sums = [0] * (n + 1)
for i in a:
    sums[i - 1] += 1
for i in range(1, len(sums)):
    sums[i] += sums[i-1]

for i in range(n):
    if (sums[i] % 2 == 1):
        s[i], s[-i-1] = s[-i-1], s[i]

print("".join(s))



wc = input()
n = len(wc)
w = [wc[i] for i in range(n)]
m = int(input())



cnt = [0 for i in range(n+3)]
y = [int(x) for x in input().split()]
for i in range(m):
    x = y[i]
    cnt[x]+=1
    cnt[n-x+2]-=1

for i in range(n+1):
    if i>0:
        cnt[i] += cnt[i-1]

for i in range(1, n+1, 1):
    if n-i+1 <= i:
        break

    if cnt[i] % 2 == 1:
        a = i - 1
        b = n - i
        tmp = w[a]
        w[a] = w[b]
        w[b] = tmp

for i in range(n):
    print(w[i], end="")
print()


s = [i for i in input()]
n = int(input())
arr = [int(i) for i in input().split()]
arr.sort()
r = 0
j = 0
for i in range(len(s) // 2):
    while j < n and arr[j] <= i + 1:
        r += 1
        j += 1
    if r % 2 == 1:
        s[i], s[-i - 1] = s[-i - 1], s[i]
print(''.join(s))

s=input().strip()
k=int(input())
n=len(s)
a=[False for i in range(n)]
f=list(map(int,input().split()))
for i in range(k):
    f[i]-=1
    a[f[i]]=not(a[f[i]])
rev=False
b=[None for i in range(n)]
for i in range(n//2+1):
    if a[i]:
        rev=not(rev)
    if rev:
        b[i]=s[-i-1]
        b[-i-1]=s[i]
    else:
        b[i]=s[i]
        b[-i-1]=s[-i-1]
print(*b,sep='')

def __starting_point():
    s = list(input())
    input()
    data = sorted(map(lambda x: int(x) - 1, input().split()))
    data.append(len(s) // 2)

    tr = True
    for i in range(len(data) - 1):
        if tr:
            for j in range(data[i], data[i + 1]):
                s[j], s[-j - 1] = s[-j - 1], s[j]

        tr = not tr

    print(''.join(s))
__starting_point()

s = list(input())
m = int(input())
a = list(map(int, input().split()))
swap = False;
a.sort();
i, j = 0, 0;
for i in range( len(s) // 2):
    while j < m and a[j]-1 <= i:
        swap = not swap
        j += 1
    if swap:
        s[i], s[len(s) - i -1] = s[len(s) - i -1], s[i]
print("".join(s))


def main():
    import sys
    
    s = sys.stdin.readline().strip()
    m = int(sys.stdin.readline())
    
    d = [0 for i in range(len(s) + 1)]
    for i in sys.stdin.readline().split():
        d[int(i)] ^= 1
    
    rev = 0
    result = [i for i in s]
    for i in range(1, len(s) // 2 + 1):
        rev ^= d[i]
        if rev:
            result[i - 1], result[len(s) - i] = result[len(s) - i], result[i - 1]
    
    print(''.join(result))
        
    
    
main()


s = input()
m2 = int(input())
a = list(map(int, input().split()))

m = {}
m1 = set()
for i in range(m2):
    if a[i] not in m1:
        m1.add(a[i])
        m[a[i]] = 1
    else:
        m[a[i]] += 1
if 1 in m1:
    k = [m[1]]
else:
    k = [0]

for i in range(1, len(s)//2):
    if i + 1 in m1:
        k.append(k[-1] + m[i + 1])
    else:
        k.append(k[-1])
s1 = []
for i in range(len(s)):
    s1.append(s[i])

for i in range(len(s)//2):
    if k[i] % 2 == 1:
        t = s1[len(s) - i - 1]
        s1[len(s) - i - 1] = s[i]
        s1[i] = t

for i in range(len(s1)):
    print(s1[i], end = '')
        
    
    

import sys
import itertools

def swap_rev(x, i, rev):
    if rev:
        x[i], x[len(x) - i - 1] = x[len(x) - i - 1], x[i]

def main():
    s = sys.stdin.readline().strip()
    result = list(s)
    sys.stdin.readline()
    m = sorted(map(int, sys.stdin.readline().split()))

    rev = False
    prev = -1
    for day, elements in itertools.groupby(m):
        if len(list(elements)) % 2 == 0:
            continue

        day = day - 1
        for i in range(prev + 1, day):
            swap_rev(result, i, rev)
        rev = not rev
        swap_rev(result, day, rev)
        prev = day
    for i in range(prev + 1, int((len(result) + 1) / 2)):
            swap_rev(result, i, rev)
    print(''.join(result))


def __starting_point():
    main()

__starting_point()

#!/c/Python34/python
# coding: utf-8


def main():
    S = list(input())
    n = int(input())
    M = sorted(map(int, input().split()))
    R = [0] * len(S)
    for m in M:
        R[m-1] += 1
    for i in range(len(S)//2):
        if R[i] % 2 == 1:
            S[i], S[len(S)-i-1] = S[len(S)-i-1], S[i]
        R[(i+1)%len(S)] += R[i]
    print(''.join(S))

def __starting_point():
    main()

__starting_point()

string = input()
string = list(string)
Slen = len(string)
m = int(input())
inline = input().split()
a = []
for i in range (m):
    a.append(int(inline[i]))
a.append(Slen // 2 + 1)
a.sort()
changes = [0 for i in range(Slen)]
flag = 0
for i in range(len(a) - 1):
    if flag == 0:
        for j in range(a[i], a[i + 1]):
            string[j - 1], string[Slen - j - 1 + 1] = string[Slen - j - 1 + 1], string[j - 1]
    flag = 1 - flag
for i in range(Slen):
    print (string[i], sep = '', end = '')
        

s = input()
m = int(input())
a = list(map(int, input().split()))
n = len(s)

flip = [0 for i in range(n)]
for x in a:
    x -= 1
    flip[x] ^= 1
    if x > 0:
        flip[n - x] ^= 1

for i in range(1, n):
    flip[i] ^= flip[i - 1]

ans = ['a' for i in range(n)]
for i in range(n):
    if flip[i] == 1:
        ans[i] = s[n - i - 1]
    else:
        ans[i] = s[i]

print(''.join(ans))


s = list(input())
n = len(s)
m = int(input())
a = list(map(int,input().split()))
l = [0]*(n+1)
for i in a:
	l[i-1]+=1
	l[n-i+1]-=1
k = 0
l2 = []
for i in range(n):
	k += l[i]
	if k%2==0:
		l2.append(s[i])
	else:
		l2.append(s[n-i-1])
print("".join(l2)) 

st=str(input())
s=[]
s=list(st)
n=int(input())
b=[]
b=list(map(int,input().split()))
b.sort()
l=len(b)
k=len(s)-1
m=int((k+2)/2)
b.append(m+1)
while l:
    if l<=0:
        break
    if((l)&1==1):
        for i in range(b[l-1]-1,b[l]-1):
            tem=s[i]
            s[i]=s[k-i]
            s[k-i]=tem
    l-=1
for i in range(0,k+1):
    print(s[i], end="")


st=str(input())
s=[]
for i in range(0,1000):
    go=1
s=list(st)
n=int(input())
b=[]
for i in range(0,1000):
    go=1
b=list(map(int,input().split()))
b.sort()
l=len(b)
k=len(s)-1
for i in range(0,1000):
    go=1
m=int((k+2)/2)
for i in range(0,1000):
    go=1
b.append(m+1)
while l>=0 :
    if(l%2==1):
        for i in range(b[l-1]-1,b[l]-1):
            t=s[i]
            s[i]=s[k-i]
            s[k-i]=t
    l-=1
for i in range(0,1000):
    go=1
for i in range(0,k+1):
    print(s[i], end="")

s = list(input())
n = len(s)
m = int(input())
ai = list(map(int,input().split()))
ai.sort()
z = 0
for i in range(m):
    if i % 2 != 0:
        temp = n - ai[i]
        temp2 = n - z 
        temp3 = reversed(s[z:ai[i]-1])
        s[z:ai[i]-1] = reversed(s[temp+1:temp2])
        s[temp+1:temp2] = temp3
    z = ai[i] - 1
if m % 2 != 0:
    s[ai[-1]-1:n-ai[-1]+1] = reversed(s[ai[-1]-1:n-ai[-1]+1])
print("".join(s))


import sys

x = input()
l=len(x)
a=int(input())
b=map(int,sys.stdin.readline().split())

rv = [False] * (l//2+1)
for i in b:
    rv[i] = not rv[i]
    
sumx=[0]*len(x)+[0]
pt = 0

for i in range(1, l//2+1):

    sumx[i] = sumx[i-1]+rv[i]


for i in range(l//2):
    if sumx[i+1]%2==1:
        print(x[l-1-i], end = '')
    else:
        print(x[i], end = '')

if l%2==1:
    print(x[l//2], end = '')
for i in range(l//2, l):
    if i == l // 2 and l%2==1:
        continue
    if sumx[l-i]%2!=1:
        print(x[i], end = '')
    else:
        
        print(x[l-1-i], end = '')


s = [" "] + list(input())
n = len(s)
m = int(input())
a = [0]*(n//2+10)
for x in input().split():
    a[int(x)] += 1
for i in range(1, n//2+1):
    a[i] += a[i-1]
for i in range(n//2+1):
    if a[i] & 1:
        s[i], s[n-i] = s[n-i], s[i]
print(''.join(s[1:]))


x = input()
l=len(x)
a=int(input())
b=list(map(int,input().split(' ')))
b.sort()
sumx=[0]*len(x)+[0]
pt = 0
for i in range(1, l//2+1):
    t=0
    if pt<len(b):
        while b[pt] == i:
            pt += 1
            
            t+=1
            if not pt < len(b):
                break
    sumx[i] = sumx[i-1]+t
sumx = sumx[1:]
tt = sumx[:len(sumx)//2]
tt.reverse()
if l%2==1:
    sumx = sumx[:len(sumx)//2]+[0]+tt
else:
    sumx = sumx[:len(sumx)//2]+tt
strx=''
for i in range(l):
    if sumx[i]%2==1:
        strx+=x[l-1-i]
    else:
        strx += x[i]
print(strx)

cs = list(input())
m = int(input())
is_ = list(map(int, input().split()))

c_len = len(cs)

is_.append(c_len//2+1)
is_.sort()
for k in range(len(is_) - 1):
    if k%2 == 1: continue
    i = is_[k] - 1
    ni = is_[k+1] - 1
    for j in range(i, ni):
        cs[j], cs[c_len-j-1] = cs[c_len-j-1], cs[j]
print(''.join(cs))


cs = list(input())
m = int(input())
is_ = list(map(int, input().split()))

c_len = len(cs)

is_.append(c_len//2+1)
is_.sort()
for k in range(len(is_) - 1):
    if k%2 == 1: continue
    i = is_[k] - 1
    ni = is_[k+1] - 1
    for j in range(i, ni):
        cs[j], cs[c_len-j-1] = cs[c_len-j-1], cs[j]
print(''.join(cs))


s = input()
m2 = int(input())
a = list(map(int, input().split()))

m = {}
m1 = set()
for i in range(m2):
    if a[i] not in m1:
        m1.add(a[i])
        m[a[i]] = 1
    else:
        m[a[i]] += 1
if 1 in m1:
    k = [m[1]]
else:
    k = [0]

for i in range(1, len(s)//2):
    if i + 1 in m1:
        k.append(k[-1] + m[i + 1])
    else:
        k.append(k[-1])
s1 = []
for i in range(len(s)):
    s1.append(s[i])

for i in range(len(s)//2):
    if k[i] % 2 == 1:
        t = s1[len(s) - i - 1]
        s1[len(s) - i - 1] = s[i]
        s1[i] = t

for i in range(len(s1)):
    print(s1[i], end = '')
        
    
    

def main():
    s = input()
    s = [s[i] for i in range(len(s))]
    m = int(input())
    a = [int(x) for x in input().split()]
    b = [0 for i in range(int(len(s) / 2 + 1))]
    for i in range(m):
        b[a[i] - 1] += 1
    for i in range(0, int(len(s) / 2)):
        if i > 0:
            b[i] += b[i - 1]
        if b[i] % 2 == 1:
            s[i], s[len(s) - i - 1] = s[len(s) - i - 1], s[i]
    return "".join(s)


def __starting_point():
    print(main())
__starting_point()

s = list(input())
m = int(input())
a = list(map(int,input().split()))


x = len(s)
c = [0]*(x//2)
for i in range(m):
    c[a[i]-1]+=1
flag = 0
for i in range(1, x//2):
    c[i] += c[i-1]

for i in range(x//2):
    if c[i]%2!=0:
        s[i], s[x-i-1] = s[x-i-1], s[i]
print(''.join(map(str,s)))


s = list(input())
m = int(input())
a = list(map(int,input().split()))


x = len(s)
c = [0]*(x//2)
for i in range(m):
    c[a[i]-1]+=1
flag = 0
for i in range(1, x//2):
    c[i] += c[i-1]

for i in range(x//2):
    if c[i]%2!=0:
        s[i], s[x-i-1] = s[x-i-1], s[i]
print(''.join(map(str,s)))