Fox Ciel is playing a game with numbers now. 

Ciel has *n* positive integers: *x*<sub class="lower-index">1</sub>, *x*<sub class="lower-index">2</sub>, ..., *x*<sub class="lower-index">*n*</sub>. She can do the following operation as many times as needed: select two different indexes *i* and *j* such that *x*<sub class="lower-index">*i*</sub> &gt; *x*<sub class="lower-index">*j*</sub> hold, and then apply assignment *x*<sub class="lower-index">*i*</sub> = *x*<sub class="lower-index">*i*</sub> - *x*<sub class="lower-index">*j*</sub>. The goal is to make the sum of all numbers as small as possible.

Please help Ciel to find this minimal sum.
The first line contains an integer *n* (2 ≤ *n* ≤ 100). Then the second line contains *n* integers: *x*<sub class="lower-index">1</sub>, *x*<sub class="lower-index">2</sub>, ..., *x*<sub class="lower-index">*n*</sub> (1 ≤ *x*<sub class="lower-index">*i*</sub> ≤ 100).
# -*- coding: utf-8 -*-
"""
Created on Sat May  7 10:46:00 2016

@author: Alex
"""
import heapq, sys
n = int(input())
sex = input()
r = [i+1 for i in range(n)]
l = [i-1 for i in range(n)]
skill = list(map(int,input().split()))
result = []
answer = []
cnt = 0
for i in range(n-1):
    if sex[i]!=sex[i+1]:
        heapq.heappush(result,(abs(skill[i]-skill[i+1]),i,i+1))
        cnt+=1
while cnt>0:
    s,i,j = heapq.heappop(result)
    cnt-=1
    if r[i]==-1 or r[j]==-1:
        continue
    answer.append(str(i+1)+" "+str(j+1))
    u = l[i]
    v = r[j]
    r[i]=r[j]=-1
    if u>=0:
        r[u]=v
    if v<n:
        l[v]=u
    if u>=0 and v<n and sex[u]!=sex[v]:
        heapq.heappush(result,(abs(skill[v]-skill[u]),u,v))
        cnt+=1

sys.stdout.write(str(len(answer)) + '\n' + '\n'.join(answer) + '\n')   
    
    
            
    