import java.awt.*;
import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.*;
import java.util.List;

import static java.lang.Math.max;
import static java.lang.Math.min;

public class E implements Runnable{

    // SOLUTION!!!
    // HACK ME PLEASE IF YOU CAN!!!
    // PLEASE!!!
    // PLEASE!!!
    // PLEASE!!!

    private final static Random rnd = new Random();
    private final static String fileName = "";

    final static long MODULO = 1000 * 1000 * 1000 + 7;

    long inverseNMinus1Factorial;

    private void solve() {
        int n = readInt();
        long s = readLong();

        long[] f = readLongArray(n);

        Map<Long, Long> coeffs = new HashMap<>();
        coeffs.put(0L, 1L);

        class Pair {
            long power, coeff;

            public Pair(long power, long coeff) {
                this.power = power;
                this.coeff = coeff;
            }
        }

        for (long size : f) {
            List<Pair> coeffEntries = new ArrayList<>();
            for (Map.Entry<Long, Long> coeffEntry : coeffs.entrySet()) {
                long power = coeffEntry.getKey();
                long coeff = coeffEntry.getValue();

                long nextPower = power + size + 1;
                coeffEntries.add(
                    new Pair(
                        nextPower, -coeff
                    )
                );
            }

            for (Pair coeffEntry : coeffEntries) {
                coeffs.put(coeffEntry.power,
                        add(coeffs.getOrDefault(coeffEntry.power, 0L), coeffEntry.coeff)
                );
            }
        }

        long nMinus1Factorial = multSequence(1, n - 1);
        this.inverseNMinus1Factorial = inverse(nMinus1Factorial);

        long answer = 0;
        for (Map.Entry<Long, Long> coeffEntry : coeffs.entrySet()) {
            long power = coeffEntry.getKey();
            long coeff = coeffEntry.getValue();

            if (s >= power) {
                long need = s - power;
                answer = add(answer, mult(binom(n + need - 1, need), coeff));
            }
        }

        out.println(answer);
    }

    long multSequence(long start, long end) {
        long res = 1;
        for (long i = start; i <= end; ++i) {
            res = mult(res, i);
        }

        return res;
    }

    long inverse(long x) {
        return binpow(x, MODULO - 2);
    }

    long binpow(long base, long power) {
        if (power == 0) return 1;

        if ((power & 1) == 0) {
            long half = binpow(base, power >> 1);
            return mult(half, half);
        } else {
            long prev = binpow(base, power - 1);
            return mult(prev, base);
        }
    }

    long binom(long n, long k) {
        return mult(
                multSequence(k + 1, n),
                inverseNMinus1Factorial
        );
    }

    long add(long a, long b) {
        return ((a % MODULO + b % MODULO) % MODULO + MODULO) % MODULO;
    }

    long mult(long a, long b) {
        return (a % MODULO) * (b % MODULO) % MODULO;
    }

    /////////////////////////////////////////////////////////////////////

    private final static boolean FIRST_INPUT_STRING = false;
    private final static boolean MULTIPLE_TESTS = true;
    private final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    private final static int MAX_STACK_SIZE = 128;

    private final static boolean OPTIMIZE_READ_NUMBERS = true;

    /////////////////////////////////////////////////////////////////////

    public void run(){
        try{
            timeInit();
            Locale.setDefault(Locale.US);

            init();

            if (ONLINE_JUDGE) {
                solve();
            } else {
                do {
                    try {
                        timeInit();
                        solve();
                        time();

                        out.println();
                    } catch (NumberFormatException e) {
                        break;
                    } catch (NullPointerException e) {
                        if (FIRST_INPUT_STRING) break;
                        else throw e;
                    }
                } while (MULTIPLE_TESTS);
            }

            out.close();
            time();
        }catch (Exception e){
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    /////////////////////////////////////////////////////////////////////

    private BufferedReader in;
    private OutputWriter out;
    private StringTokenizer tok = new StringTokenizer("");

    public static void main(String[] args){
        new Thread(null, new E(), "", MAX_STACK_SIZE * (1L << 20)).start();
    }

    /////////////////////////////////////////////////////////////////////

    private void init() throws FileNotFoundException{
        Locale.setDefault(Locale.US);

        if (ONLINE_JUDGE){
            if (fileName.isEmpty()) {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new OutputWriter(System.out);
            } else {
                in = new BufferedReader(new FileReader(fileName + ".in"));
                out = new OutputWriter(fileName + ".out");
            }
        }else{
            in = new BufferedReader(new FileReader("input.txt"));
            out = new OutputWriter("output.txt");
        }
    }

    ////////////////////////////////////////////////////////////////

    private long timeBegin;

    private void timeInit() {
        this.timeBegin = System.currentTimeMillis();
    }

    private void time(){
        long timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    private void debug(Object... objects){
        if (ONLINE_JUDGE){
            for (Object o: objects){
                System.err.println(o.toString());
            }
        }
    }

    /////////////////////////////////////////////////////////////////////

    private String delim = " ";

    private String readLine() {
        try {
            return in.readLine();
        } catch (IOException e) {
            throw new RuntimeIOException(e);
        }
    }

    private String readString() {
        try {
            while(!tok.hasMoreTokens()){
                tok = new StringTokenizer(readLine());
            }

            return tok.nextToken(delim);
        } catch (NullPointerException e) {
            return null;
        }
    }

    /////////////////////////////////////////////////////////////////

    private final char NOT_A_SYMBOL = '\0';

    private char readChar() {
        try {
            int intValue = in.read();

            if (intValue == -1){
                return NOT_A_SYMBOL;
            }

            return (char) intValue;
        } catch (IOException e) {
            throw new RuntimeIOException(e);
        }
    }

    private char[] readCharArray() {
        return readLine().toCharArray();
    }

    private char[][] readCharField(int rowsCount) {
        char[][] field = new char[rowsCount][];
        for (int row = 0; row < rowsCount; ++row) {
            field[row] = readCharArray();
        }

        return field;
    }

    /////////////////////////////////////////////////////////////////

    private long optimizedReadLong() {
        int sign = 1;
        long result = 0;
        boolean started = false;
        while (true) {
            try {
                int j = in.read();
                if (-1 == j) {
                    if (started) return sign * result;
                    throw new NumberFormatException();
                }

                if (j == '-') {
                    if (started) throw new NumberFormatException();
                    sign = -sign;
                }

                if ('0' <= j && j <= '9') {
                    result = result * 10 + j - '0';
                    started = true;
                } else if (started) {
                    return sign * result;
                }
            } catch (IOException e) {
                throw new RuntimeIOException(e);
            }
        }
    }

    private int readInt() {

        if (!OPTIMIZE_READ_NUMBERS) {
            return Integer.parseInt(readString());
        } else {
            return (int) optimizedReadLong();
        }
    }

    private int[] readIntArray(int size) {
        int[] array = new int[size];

        for (int index = 0; index < size; ++index){
            array[index] = readInt();
        }

        return array;
    }

    private int[] readSortedIntArray(int size) {
        Integer[] array = new Integer[size];

        for (int index = 0; index < size; ++index) {
            array[index] = readInt();
        }
        Arrays.sort(array);

        int[] sortedArray = new int[size];
        for (int index = 0; index < size; ++index) {
            sortedArray[index] = array[index];
        }

        return sortedArray;
    }

    private int[] readIntArrayWithDecrease(int size) {
        int[] array = readIntArray(size);

        for (int i = 0; i < size; ++i) {
            array[i]--;
        }

        return array;
    }

    ///////////////////////////////////////////////////////////////////

    private int[][] readIntMatrix(int rowsCount, int columnsCount) {
        int[][] matrix = new int[rowsCount][];

        for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {
            matrix[rowIndex] = readIntArray(columnsCount);
        }

        return matrix;
    }

    private int[][] readIntMatrixWithDecrease(int rowsCount, int columnsCount) {
        int[][] matrix = new int[rowsCount][];

        for (int rowIndex = 0; rowIndex < rowsCount; ++rowIndex) {
            matrix[rowIndex] = readIntArrayWithDecrease(columnsCount);
        }

        return matrix;
    }

    ///////////////////////////////////////////////////////////////////

    private long readLong() {
        if (!OPTIMIZE_READ_NUMBERS) {
            return Long.parseLong(readString());
        } else {
            return optimizedReadLong();
        }
    }

    private long[] readLongArray(int size) {
        long[] array = new long[size];

        for (int index = 0; index < size; ++index){
            array[index] = readLong();
        }

        return array;
    }

    ////////////////////////////////////////////////////////////////////

    private double readDouble() {
        return Double.parseDouble(readString());
    }

    private double[] readDoubleArray(int size) {
        double[] array = new double[size];

        for (int index = 0; index < size; ++index){
            array[index] = readDouble();
        }

        return array;
    }

    ////////////////////////////////////////////////////////////////////

    private BigInteger readBigInteger() {
        return new BigInteger(readString());
    }

    private BigDecimal readBigDecimal() {
        return new BigDecimal(readString());
    }

    /////////////////////////////////////////////////////////////////////

    private Point readPoint() {
        int x = readInt();
        int y = readInt();
        return new Point(x, y);
    }

    private Point[] readPointArray(int size) {
        Point[] array = new Point[size];

        for (int index = 0; index < size; ++index){
            array[index] = readPoint();
        }

        return array;
    }

    /////////////////////////////////////////////////////////////////////

    @Deprecated
    private List<Integer>[] readGraph(int vertexNumber, int edgeNumber) {
        @SuppressWarnings("unchecked")
        List<Integer>[] graph = new List[vertexNumber];

        for (int index = 0; index < vertexNumber; ++index){
            graph[index] = new ArrayList<>();
        }

        while (edgeNumber-- > 0){
            int from = readInt() - 1;
            int to = readInt() - 1;

            graph[from].add(to);
            graph[to].add(from);
        }

        return graph;
    }

    private static class GraphBuilder {

        final int size;
        final List<Integer>[] edges;

        static GraphBuilder createInstance(int size) {
            List<Integer>[] edges = new List[size];
            for (int v = 0; v < size; ++v) {
                edges[v] = new ArrayList<>();
            }

            return new GraphBuilder(edges);
        }

        private GraphBuilder(List<Integer>[] edges) {
            this.size = edges.length;
            this.edges = edges;
        }

        public void addEdge(int from, int to) {
            addDirectedEdge(from, to);
            addDirectedEdge(to, from);
        }

        public void addDirectedEdge(int from, int to) {
            edges[from].add(to);
        }

        public int[][] build() {
            int[][] graph = new int[size][];
            for (int v = 0; v < size; ++v) {
                List<Integer> vEdges = edges[v];
                graph[v] = castInt(vEdges);
            }

            return graph;
        }
    }

    /////////////////////////////////////////////////////////////////////

    private static class IntIndexPair {

        static Comparator<IntIndexPair> increaseComparator = new Comparator<E.IntIndexPair>() {

            @Override
            public int compare(E.IntIndexPair indexPair1, E.IntIndexPair indexPair2) {
                int value1 = indexPair1.value;
                int value2 = indexPair2.value;

                if (value1 != value2) return value1 - value2;

                int index1 = indexPair1.index;
                int index2 = indexPair2.index;

                return index1 - index2;
            }
        };

        static Comparator<IntIndexPair> decreaseComparator = new Comparator<E.IntIndexPair>() {

            @Override
            public int compare(E.IntIndexPair indexPair1, E.IntIndexPair indexPair2) {
                int value1 = indexPair1.value;
                int value2 = indexPair2.value;

                if (value1 != value2) return -(value1 - value2);

                int index1 = indexPair1.index;
                int index2 = indexPair2.index;

                return index1 - index2;
            }
        };

        int value, index;

        IntIndexPair(int value, int index) {
            super();
            this.value = value;
            this.index = index;
        }

        int getRealIndex() {
            return index + 1;
        }
    }

    private IntIndexPair[] readIntIndexArray(int size) {
        IntIndexPair[] array = new IntIndexPair[size];

        for (int index = 0; index < size; ++index) {
            array[index] = new IntIndexPair(readInt(), index);
        }

        return array;
    }

    /////////////////////////////////////////////////////////////////////

    private static class OutputWriter extends PrintWriter {

        final int DEFAULT_PRECISION = 12;

        private int precision;
        private String format, formatWithSpace;

        {
            precision = DEFAULT_PRECISION;

            format = createFormat(precision);
            formatWithSpace = format + " ";
        }

        OutputWriter(OutputStream out) {
            super(out);
        }

        OutputWriter(String fileName) throws FileNotFoundException {
            super(fileName);
        }

        int getPrecision() {
            return precision;
        }

        void setPrecision(int precision) {
            precision = max(0, precision);
            this.precision = precision;

            format = createFormat(precision);
            formatWithSpace = format + " ";
        }

        String createFormat(int precision){
            return "%." + precision + "f";
        }

        @Override
        public void print(double d){
            printf(format, d);
        }

        void printWithSpace(double d){
            printf(formatWithSpace, d);
        }

        void printAll(double...d){
            for (int i = 0; i < d.length - 1; ++i){
                printWithSpace(d[i]);
            }

            print(d[d.length - 1]);
        }

        @Override
        public void println(double d){
            printlnAll(d);
        }

        void printlnAll(double... d){
            printAll(d);
            println();
        }
    }

    /////////////////////////////////////////////////////////////////////

    private static class RuntimeIOException extends RuntimeException {

        /**
         *
         */
        private static final long serialVersionUID = -6463830523020118289L;

        RuntimeIOException(Throwable cause) {
            super(cause);
        }
    }

    /////////////////////////////////////////////////////////////////////
    //////////////// Some useful constants and functions ////////////////
    /////////////////////////////////////////////////////////////////////

    private static final int[][] steps = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
    private static final int[][] steps8 = {
            {-1, 0}, {1, 0}, {0, -1}, {0, 1},
            {-1, -1}, {1, 1}, {1, -1}, {-1, 1}
    };

    private static boolean checkCell(int row, int rowsCount, int column, int columnsCount) {
        return checkIndex(row, rowsCount) && checkIndex(column, columnsCount);
    }

    private static boolean checkIndex(int index, int lim){
        return (0 <= index && index < lim);
    }

    /////////////////////////////////////////////////////////////////////

    private static boolean checkBit(int mask, int bit){
        return (mask & (1 << bit)) != 0;
    }
    private static boolean checkBit(long mask, int bit){
        return (mask & (1L << bit)) != 0;
    }

    /////////////////////////////////////////////////////////////////////

    private static long getSum(int[] array) {
        long sum = 0;
        for (int value: array) {
            sum += value;
        }

        return sum;
    }

    private static Point getMinMax(int[] array) {
        int min = array[0];
        int max = array[0];

        for (int index = 0, size = array.length; index < size; ++index, ++index) {
            int value = array[index];

            if (index == size - 1) {
                min = min(min, value);
                max = max(max, value);
            } else {
                int otherValue = array[index + 1];

                if (value <= otherValue) {
                    min = min(min, value);
                    max = max(max, otherValue);
                } else {
                    min = min(min, otherValue);
                    max = max(max, value);
                }
            }
        }

        return new Point(min, max);
    }

    /////////////////////////////////////////////////////////////////////

    private static int[] getPrimes(int n) {
        boolean[] used = new boolean[n];
        used[0] = used[1] = true;

        int size = 0;
        for (int i = 2; i < n; ++i) {
            if (!used[i]) {
                ++size;
                for (int j = 2 * i; j < n; j += i) {
                    used[j] = true;
                }
            }
        }

        int[] primes = new int[size];
        for (int i = 0, cur = 0; i < n; ++i) {
            if (!used[i]) {
                primes[cur++] = i;
            }
        }

        return primes;
    }

    /////////////////////////////////////////////////////////////////////

    private static long lcm(long a, long b) {
        return a / gcd(a, b) * b;
    }

    private static long gcd(long a, long b) {
        return (a == 0 ? b : gcd(b % a, a));
    }

    /////////////////////////////////////////////////////////////////////

    private static class MultiSet<ValueType> {

        public static <ValueType> MultiSet<ValueType> createMultiSet() {
            Map<ValueType, Integer> multiset = new HashMap<>();
            return new MultiSet<>(multiset);
        }

        private final Map<ValueType, Integer> multiset;
        private int size;

        public MultiSet(Map<ValueType, Integer> multiset) {
            this.multiset = multiset;
            this.size = 0;
        }

        public int size() {
            return size;
        }

        public void inc(ValueType value) {
            int count = get(value);
            multiset.put(value, count + 1);

            ++size;
        }

        public void dec(ValueType value) {
            int count = get(value);
            if (count == 0) return;

            if (count == 1) multiset.remove(value);
            else multiset.put(value, count - 1);

            --size;
        }

        public int get(ValueType value) {
            Integer count = multiset.get(value);
            return (count == null ? 0 : count);
        }
    }

    /////////////////////////////////////////////////////////////////////

    private static class IdMap<KeyType> extends HashMap<KeyType, Integer> {

        /**
         *
         */
        private static final long serialVersionUID = -3793737771950984481L;

        public IdMap() {
            super();
        }

        int getId(KeyType key) {
            Integer id = super.get(key);
            if (id == null) {
                super.put(key, id = size());
            }

            return id;
        }
    }

    /////////////////////////////////////////////////////////////////////

    private static int[] castInt(List<Integer> list) {
        int[] array = new int[list.size()];
        for (int i = 0; i < array.length; ++i) {
            array[i] = list.get(i);
        }

        return array;
    }

    private static long[] castLong(List<Long> list) {
        long[] array = new long[list.size()];
        for (int i = 0; i < array.length; ++i) {
            array[i] = list.get(i);
        }

        return array;
    }
}


import java.io.*;
import java.math.*;
import java.util.*;

public class Main{
    FastScanner in;
    PrintWriter out;

    public long mod = 1000000000+7;
    long[] fact;

    public long bin_pow(long d, long step) {
        if (step == 0) return 1;
        if (step == 1) return d % mod;
        long x = bin_pow(d, step/2);
        x = (x * x) % mod;
        if (step % 2 == 1)
            x = (x * d) % mod;
        return x;
    }

    public long bC(int n, int k) {
        long res = fact[n];
        res *= bin_pow(fact[k], mod-2);
        res %= mod;
        res *= bin_pow(fact[n-k], mod-2);
        res %= mod;
        return res;
    }

    public long C(long n, int k) {
        if (n <= k)
            return bC((int)n, k);

        long res = 1;
        for (int p = 0; p < k ; p++) {
            res *= (n-p) % mod;
            res %= mod;
        }

        res *= bin_pow(fact[k], mod-2);
        res %= mod;

        return res;
    }

    public void solve()
    {
        int n = in.nextInt();
        long s = in.nextLong();
        long[] f = new long[n];
        long sum = 0;
        for (int i = 0; i < n; i++) {
            f[i] = in.nextLong();
            sum += f[i];
        }

        fact = new long[n+10];
        fact[0] = 1;
        for (int i = 1; i < n+10; i++) {
            fact[i] = i * fact[i-1];
            fact[i] %= mod;
        }

        long ans = 0;
        long sg;
        for(int mask = 0; mask < (1<<n); mask++) {
            int cnt = 0;
            sum = s;
            for (int i = 0; i < n; i++)
            if ((mask >> i) % 2 == 1)
            {
                cnt++;
                sum -= f[i]+1;
            }

            if (sum < 0) continue;

            if (cnt % 2 == 1)
                sg = -1;
            else
                sg = 1;

            long tmp_ans = 0;

            tmp_ans = C(sum + n - 1, n - 1);

            ans += sg * tmp_ans;
            ans += 2*mod;
            ans %= mod;
        }

        out.println(ans);
    }

    public void run()
    {
        in = new FastScanner();
        out = new PrintWriter(System.out);

        solve();

        out.close();
    }

    public static void main(String[] args) {
        new Main().run();
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}


import java.util.Scanner;

public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int r = sc.nextInt();
        int v = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int s = sc.nextInt();
            int f = sc.nextInt();
            double d = f - s;
            double p = 2 * Math.PI * r;
            d %= p;
            double min = 0, max = 2 * Math.PI;
            for (int j = 0; j < 100; j++) {
                double mid = (min + max) / 2;
                double dis = (mid + Math.sin(mid)) * r * 2;
                if (dis < d)
                    min = mid;
                else
                    max = mid;
            }
            double t1 = (f - s - d) / v;
            double t2 = (min + max) * r / v;
            System.out.println(t1 + t2);
        }
        sc.close();
    }
}


import java.util.Scanner;

public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int r = sc.nextInt();
        int v = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int s = sc.nextInt();
            int f = sc.nextInt();
            double d = f - s;
            double p = 2 * Math.PI * r;
            d %= p;
            double min = 0, max = 2 * Math.PI;
            for (int j = 0; j < 100; j++) {
                double mid = (min + max) / 2;
                double dis = (mid + Math.sin(mid)) * r * 2;
                if (dis < d)
                    min = mid;
                else
                    max = mid;
            }
            double t1 = (f - s - d) / v;
            double t2 = (min + max) * r / v;
            if ((min + max) / 2 > Math.PI)
                System.out.println(" = " + (min + max) / 2);
            System.out.println(t1 + t2);
        }
        sc.close();
    }
}


import java.util.Scanner;

/**
 *
 * @author sarthak
 */
public class rnd330_D {
    public static void main(String[] args)
    {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int r=s.nextInt();
        int v=s.nextInt();
        while(n!=0)
        {
            int st=s.nextInt();
            int en=s.nextInt();
            double half_dis=(double)(en-st)/2;

            double st_angle=0;
            double end_angle=Math.PI;
            //dealing for one half
            int cmplete_revolutions=(int)((en-st)/(2*Math.PI*r));
            double left_dis=(double)(en-st- (double)cmplete_revolutions*2*Math.PI*(double)r);
            left_dis=left_dis/2;

            double dis=0.0;double mid_angle=0;

     for(int i=0;i<=100;i++)
            {
                mid_angle=(st_angle+end_angle)/2.0;
                dis=mid_angle*r +(double)r* Math.sin(mid_angle);
                if(dis<left_dis)
                    st_angle=mid_angle;
                else
                    end_angle=mid_angle;

            }
            double ans=(cmplete_revolutions*2*Math.PI*(double)r  +  2*mid_angle*(double)r);
            ans=(double)ans/(double)v;
            System.out.println(ans);

            n--;
        }

    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.text.NumberFormat;

public class P595D {
    private static final double TWO_PI = Math.PI * 2;

    private static double newton(double x) {
        double t = x/2;
        double nt = t - (t + Math.sin(t) - x)/(1 + Math.cos(t));
        while (Math.abs(nt-t) >= 1e-7) {
            t = nt;
            nt = t - (t + Math.sin(t) - x)/(1 + Math.cos(t));
        }
        return nt;
    }

    private static double minTime(long d, int r, int v) {
        final double th = d / (double)r;
        final double k = Math.floor(th/TWO_PI);
        final double x = th % TWO_PI;
        final double t = newton(x/2);
        return (2*t + k*TWO_PI) * r / v;
    }

    public static void main(String[] args) throws IOException {
        final NumberFormat formatter = new DecimalFormat("#.#######");

        final BufferedReader in = new BufferedReader(
            new InputStreamReader(System.in));

        String[] s = in.readLine().split(" ");
        final int n = Integer.parseInt(s[0]);
        final int r = Integer.parseInt(s[1]);
        final int v = Integer.parseInt(s[2]);
        for (int i = 0; i<n; i++) {
            s = in.readLine().split(" ");
            final int si = Integer.parseInt(s[0]);
            final int fi = Integer.parseInt(s[1]);
            System.out.println(formatter.format(minTime(fi-si, r, v)));
        }
    }
}


import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
    public void solve() {
	FastScanner scanner = new FastScanner();
	int N = scanner.nextInt();
	final int R = scanner.nextInt();
	final double V = scanner.nextInt();
	final double cycle = 2.0 * Math.PI * R;

	StringBuilder builder = new StringBuilder();
	for (int i = 0; i < N; i++) {
	    int start = scanner.nextInt();
	    int finish = scanner.nextInt();
	    final int L = finish - start;

	    int A = (int) (L / cycle);
	    double rest = L - cycle * A;
	    rest /= 2.0;
	    double theta = 0.0;
	    double low = 0, high = Math.PI;
	    double plow = low, phigh = high;
	    while (low < high) {
		theta = (high + low) / 2.0;
		double x = R * theta + R * Math.sin(theta);
		if (x > rest) {
		    high = theta;
		} else {
		    low = theta;
		}
		if (plow == low && phigh == high) {
		    break;
		}
		plow = low;
		phigh = high;
	    }

	    double dist = cycle * A + R * 2 * theta;
	    dist /= V;
	    builder.append(dist);
	    builder.append("\n");
	}
	System.out.println(builder.toString());
    }

    public static void main(String[] args) {
	new Main().solve();
    }

}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
	if (ptr < buflen) {
	    return true;
	} else {
	    ptr = 0;
	    try {
		buflen = in.read(buffer);
	    } catch (IOException e) {
		e.printStackTrace();
	    }
	    if (buflen <= 0) {
		return false;
	    }
	}
	return true;
    }

    private int readByte() {
	if (hasNextByte())
	    return buffer[ptr++];
	else
	    return -1;
    }

    private static boolean isPrintableChar(int c) {
	return 33 <= c && c <= 126;
    }

    private void skipUnprintable() {
	while (hasNextByte() && !isPrintableChar(buffer[ptr]))
	    ptr++;
    }

    public boolean hasNext() {
	skipUnprintable();
	return hasNextByte();
    }

    public String next() {
	if (!hasNext())
	    throw new NoSuchElementException();
	StringBuilder sb = new StringBuilder();
	int b = readByte();
	while (isPrintableChar(b)) {
	    sb.appendCodePoint(b);
	    b = readByte();
	}
	return sb.toString();
    }

    public long nextLong() {
	if (!hasNext())
	    throw new NoSuchElementException();
	long n = 0;
	boolean minus = false;
	int b = readByte();
	if (b == '-') {
	    minus = true;
	    b = readByte();
	}
	if (b < '0' || '9' < b) {
	    throw new NumberFormatException();
	}
	while (true) {
	    if ('0' <= b && b <= '9') {
		n *= 10;
		n += b - '0';
	    } else if (b == -1 || !isPrintableChar(b)) {
		return minus ? -n : n;
	    } else {
		throw new NumberFormatException();
	    }
	    b = readByte();
	}
    }

    public int nextInt() {
	return (int) nextLong();

    }
}


import java.util.Scanner;
import java.lang.Math;

public class D {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int r = scanner.nextInt();
        int v = scanner.nextInt();
        for(int i=0; i<n; ++i) {
          int s = scanner.nextInt();
          int f = scanner.nextInt();
          double d = f - s;
          int cycle = (int)(d/(2*Math.PI*r));
          d -= cycle*(2*Math.PI*r);
          System.out.println((cycle*(2*Math.PI*r) + r*D.bs(d, r))/v);
        }
    }

    public static double bs(double d, int r) {
      double l = 0;
      double u = Math.PI * 2;
      double middle=0;
      while(l<u) {
        middle = (l+u)/2;
        double value = D.eval(middle, r);
        if(value < d) {
          l = middle;
        }
        else {
          u = middle;
        }
        if(Math.abs(value-d) < 0.000001) return middle;
      }
      return middle;
    }
    public static double eval(double theta, double r) {
      return r*theta + 2 * r * Math.sin(theta/2);
    }
}


import java.io.*;
import java.util.*;

public class C329D
{

private static StringTokenizer st;

    public static void nextLine(BufferedReader br) throws IOException
    {
        st = new StringTokenizer(br.readLine());
    }

    public static int nextInt()
    {
        return Integer.parseInt(st.nextToken());
    }

    public static String next()
    {
        return st.nextToken();
    }

    public static long nextLong()
    {
        return Long.parseLong(st.nextToken());
    }

    public static double nextDouble()
    {
        return Double.parseDouble(st.nextToken());
    }

    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        /*
        for (double d = 0; d < 0.0001; d += 0.000001)
        {
            System.out.println(d + " " + test(d));
            System.out.println((Math.PI - d) + " " + test(Math.PI - d));
        }
        */

        nextLine(br);
        int n = nextInt();
        double r = nextInt();
        double v = nextInt();
        StringBuffer sb = new StringBuffer();
        for (int i = 0; i < n; i++)
        {
            nextLine(br);
            int start = nextInt();
            int finish = nextInt();
            double diff = finish - start;
            double ans = solve(diff, v, r);
            sb.append(String.valueOf(ans) + "\n");
        }
        System.out.println(sb.toString());

    }

    public static double test(double in)
    {
        double left = 0;
        double right = 1;
        double rem = in;
        for (int i = 0; i < 100; i++)
        {
            double mid = (left + right) / 2;
            double temp = Math.PI * mid;
            double k = temp + Math.sin(temp);
            //if (in > 3.14) System.out.println("M" + mid + " " + k);
            if (k > rem)
            {
                right = mid;
            }
            else
            {
                left = mid;
            }
        }
        return (left + right) / 2;
    }

    public static double solve(double d, double v, double r)
    {
        d = d / r;
        v = v / r;
        double circ = 2 * Math.PI;
        double rounds = Math.floor(d / circ);
        double rem = (d - rounds * circ) / 2;
        double left = 0;
        double right = 1;
        for (int i = 0; i < 100; i++)
        {
            double mid = (left + right) / 2;
            double temp = Math.PI * mid;
            double k = temp + Math.sin(temp);
            if (k > rem)
            {
                right = mid;
            }
            else
            {
                left = mid;
            }
        }
        //System.out.println(rounds + " " + rem + " " + left);

        double ans = ((left + rounds) * circ) / v;
        return ans;
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.StringTokenizer;

/*

 */
/**
 *
 * @author Andy Phan
 */
public class d {
    public static void main(String[] args) {
        FS in = new FS(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int n = in.nextInt();
        double r = in.nextInt();
        double v = in.nextInt()/r;

        while(n-->0) {
            double dist = (-in.nextDouble()+in.nextDouble())/r;
            double a = 0;

            for(double pow = 1e9; pow >= 1e-7; pow /= 2) {
                if(v*(a+pow)+2*Math.abs(Math.sin((v*(a+pow))%(2*Math.PI)/2)) <= dist) a += pow;
            }
            System.out.println(a);
        }

        out.close();
    }

    static class FS {

        BufferedReader in;
        StringTokenizer token;

        public FS(InputStream str) {
            in = new BufferedReader(new InputStreamReader(str));
        }

        public String next() {
            if (token == null || !token.hasMoreElements()) {
                try {
                    token = new StringTokenizer(in.readLine());
                } catch (IOException ex) {
                }
                return next();
            }
            return token.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }
}


import java.util.Arrays;
import java.util.Scanner;
import java.util.function.Function;

public class WarriorAndArcher {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner input = new Scanner(System.in);
		int numberOfComp = input.nextInt();
		int radius = input.nextInt();
		int v = input.nextInt();
		int[] compStart = new int[numberOfComp];
		int[] compEnd = new int[numberOfComp];
		for (int a = 0; a < numberOfComp; a++) {
			compStart[a] = input.nextInt();
			compEnd[a] = input.nextInt();
		}
		for (int a = 0; a < numberOfComp; a++) {
			double turnfrac = (compEnd[a] - compStart[a])
					/ (2 * Math.PI * radius);
			int totalTurns = (int) turnfrac;
			double extraDistance = (turnfrac - totalTurns)
					* (2 * Math.PI * radius);
			double x0 = binarySearch((x) -> radius * x + 2 * Math.sin(x/2.0) * radius, 0, 2*Math.PI, extraDistance);
			double totalTurnsAnswer = x0/(2*Math.PI) + totalTurns;
			double fakeDistance = totalTurnsAnswer * 2 * Math.PI * radius;
			double time = fakeDistance/v;
			System.out.println(time);
		}
	}

	static double binarySearch(Function<Double, Double> f, double low,
			double high, double y) {
		while (Math.ulp(low) < (high - low)) {
			double mid = (low + high) / 2.0;
			double midVal = f.apply(mid);

			if (midVal == y) // unlikely, but possible
				return mid;
			else if (midVal < y)
				low = mid;
			else if (midVal > y)
				high = mid;
		}
		return (low + high) / 2.0;
	}

	/* Outputs 10.000000 */

	// System.out.printf("%.6f%n", x0);

}


import java.util.Scanner;

public class D {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int r = sc.nextInt();
        int v = sc.nextInt();
        for (int i = 0; i < n; i++) {
            int s = sc.nextInt();
            int f = sc.nextInt();
            double d = f - s;
            double p = 2 * Math.PI * r;
            d %= p;
            double min = 0, max = Math.PI;
            for (int j = 0; j < 100; j++) {
                double mid = (min + max) / 2;
                double dis = (mid + Math.sin(mid)) * r * 2;
                if (dis < d)
                    min = mid;
                else
                    max = mid;
            }
            double t1 = (f - s - d) / v;
            double t2 = (min + max) * r / v;
            System.out.println(t1 + t2);
        }
        sc.close();
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author cunbidun
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DPetyaAndColoring solver = new DPetyaAndColoring();
        solver.solve(1, in, out);
        out.close();
    }

    static class DPetyaAndColoring {
        private static final int MOD = (int) 1e9 + 7;
        private int[] fac = new int[1000030];

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int k = in.nextInt();
            if (m == 1) {
                out.println(Op.powMod(k, n, MOD));
                return;
            }
            int ans = 0;
            fac[0] = 1;
            for (int i = 1; i <= 1000010; i++) {
                fac[i] = Op.mulMod(fac[i - 1], i, MOD);
            }
            int[][] C = MathAlgorithm.binomialTable(2010, MOD);
            int[][] f = new int[n + 1][n + 1];
            f[1][1] = 1;
            for (int i = 2; i <= n; i++) {
                for (int j = 1; j <= i; j++) {
                    f[i][j] = Op.addMod(Op.mulMod(f[i - 1][j], j, MOD), f[i - 1][j - 1], MOD);
                }
            }
            for (int j = 0; j <= n; j++) {
                for (int i = j; i <= n; i++)
                    if (2 * i - j <= k) {
                        int tmp = C(k, 2 * i - j);
                        tmp = Op.mulMod(tmp, C[2 * i - j][i - j], MOD);
                        tmp = Op.mulMod(tmp, C[i][i - j], MOD);
                        tmp = Op.mulMod(tmp, fac[i], MOD);
                        tmp = Op.mulMod(tmp, fac[i], MOD);
                        tmp = Op.mulMod(tmp, f[n][i], MOD);
                        tmp = Op.mulMod(tmp, f[n][i], MOD);
                        tmp = Op.mulMod(tmp, Op.powMod(j, n * (m - 2), MOD), MOD);
                        ans = Op.addMod(tmp, ans, MOD);
                    }
            }
            out.println(ans);
        }

        private int C(int n, int k) {
            return Op.mulMod(Op.mulMod(fac[n], Op.inv(fac[k], MOD), MOD), Op.inv(fac[n - k], MOD), MOD);
        }

    }

    static class Op {
        public static int addMod(int x, int y, int MOD) {
            return ((x + y) >= MOD ? x + y - MOD : x + y);
        }

        public static int mulMod(int x, int y, int MOD) {
            return (int) (((long) x * y) % MOD);
        }

        public static int powMod(int x, long p, int MOD) {
            if (p == 0) return 1;
            int t = powMod(x, p / 2, MOD);
            if ((p & 1) == 1)
                return mulMod(mulMod(t, t, MOD), x, MOD);
            return mulMod(t, t, MOD);
        }

        public static int inv(int x, int MOD) {
            return powMod(x, MOD - 2, MOD);
        }

    }

    static class MathAlgorithm {
        public static int[][] binomialTable(int n, int MOD) {
            int[][] c = new int[n + 1][n + 1];
            for (int i = 0; i <= n; i++)
                for (int j = 0; j <= i; j++)
                    c[i][j] = (j == 0) ? 1 : Op.addMod(c[i - 1][j - 1], c[i - 1][j], MOD);
            return c;
        }

    }

    static class InputReader extends InputStream {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private static boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}


// package QS.AA.NetworkFlow;

// F. Anti-Palindromize
// https://codeforces.com/contest/884/problem/F

import java.io.*;
import java.util.*;
public class CF_884F {

	public static final int MOD = 1000_000_000 + 7;
	public static final double EPS = 1e-6;
	public static final boolean DEBUG = true;

	public static void main(String[] args) throws java.io.IOException {
		final java.io.BufferedReader br = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));

		int n = Integer.parseInt(br.readLine());
		char[] s = br.readLine().trim().toCharArray();
		String[] tokens = br.readLine().trim().split("\\s");
		int[] beauty = new int[n];

		int ans = 0;
		int m = 0, x = 0, t = 0;
		int[] b = new int[101];
		int[] count = new int[26];

		for (int i = 0; i < n; i++) {
			beauty[i] = Integer.parseInt(tokens[i]);
			ans += beauty[i];
		}

		for (int i = 0; i < n / 2; i++) {
			if (s[i] == s[n-i-1]) {
				t++;
				count[(int)(s[i] - 'a')]++;
				ans -= Math.min(beauty[i], beauty[n-i-1]);
			}
		}

		for (int i = 0; i < 26 ; i++) {
			if (m < count[i]) {
				m = count[i];
				x = i;
			}
		}

		if (2 * m <= t) {
			System.out.println(ans);
			return;
		}
		ArrayList<Integer> list = new ArrayList<Integer>();

		for (int i = 0; i < n/2; i++) {
			if ((int)(s[i] - 'a') != x && (int)(s[n-i-1] - 'a') != x && s[i] != s[n-i-1]) {
				list.add(Math.min(beauty[i], beauty[n-i-1]));
			}
		}

		Collections.sort(list);
		for (int i = 0; i < 2 * m - t; i++) {
			ans -= list.get(i);
		}
		System.out.print(ans);
	}
}


// practice with rainboy
import java.io.*;
import java.util.*;

public class CF884F extends PrintWriter {
	CF884F() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF884F o = new CF884F(); o.main(); o.flush();
	}

	static final int A = 26, INF = 0x3f3f3f3f;
	int[] oo, oh; int __ = 1;
	int link(int o, int h) {
		oo[__] = o; oh[__] = h;
		return __++;
	}
	int[] ii, jj, cc, ww, ww_; int m_;
	int[] ae, dd, kk, ff; int n_;
	int[] pq, iq; int cnt;
	void init() {
		oo = new int[1 + m_ * 2]; oh = new int[1 + m_ * 2];
		ii = new int[m_]; jj = new int[m_];
		cc = new int[m_ << 1];
		ww = new int[m_]; ww_ = new int[m_];
		ae = new int[n_];
		dd = new int[n_]; kk = new int[n_]; ff = new int[n_];
		pq = new int[1 + n_]; iq = new int[n_];
		m_ = 0;
	}
	void link_(int i, int j, int c, int w) {
		int h = m_++;
		ii[h] = i; jj[h] = j; cc[h << 1] = c; ww[h] = w;
		ae[i] = link(ae[i], h << 1);
		ae[j] = link(ae[j], h << 1 | 1);
	}
	boolean less(int u, int v) {
		return dd[u] < dd[v] || dd[u] == dd[v] && kk[u] < kk[v];
	}
	int i2(int i) {
		return (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;
	}
	void pq_up(int u) {
		int i, j, v;
		for (i = iq[u]; (j = i / 2) > 0 && less(u, v = pq[j]); i = j)
			pq[iq[v] = i] = v;
		pq[iq[u] = i] = u;
	}
	void pq_dn(int u) {
		int i, j, v;
		for (i = iq[u]; (j = i2(i)) > 0 && less(v = pq[j], u); i = j)
			pq[iq[v] = i] = v;
		pq[iq[u] = i] = u;
	}
	void pq_add_last(int u) {
		pq[iq[u] = ++cnt] = u;
	}
	int pq_remove_first() {
		int u = pq[1], v = pq[cnt--];
		if (v != u) {
			iq[v] = 1; pq_dn(v);
		}
		iq[u] = 0;
		return u;
	}
	boolean dijkstra(int s, int t) {
		Arrays.fill(dd, INF);
		dd[s] = 0; pq_add_last(s);
		while (cnt > 0) {
			int i = pq_remove_first();
			int k = kk[i] + 1;
			for (int o = ae[i]; o != 0; o = oo[o]) {
				int h_ = oh[o];
				if (cc[h_] > 0) {
					int h = h_ >> 1;
					int j = i ^ ii[h] ^ jj[h];
					int d = dd[i] + ((h_ & 1) == 0 ? ww_[h] : -ww_[h]);
					if (dd[j] > d || dd[j] == d && kk[j] > k) {
						if (dd[j] == INF)
							pq_add_last(j);
						dd[j] = d; kk[j] = k; ff[j] = h_;
						pq_up(j);
					}
				}
			}
		}
		return dd[t] != INF;
	}
	int trace(int s, int t) {
		while (t != s) {
			int h_ = ff[t], h = h_ >> 1;
			cc[h_]--; cc[h_ ^ 1]++;
			t ^= ii[h] ^ jj[h];
		}
		return 1;
	}
	int edmonds_karp(int s, int t) {
		for (int h = 0; h < m_; h++) {
			int i = ii[h], j = jj[h];
			dd[j] = Math.min(dd[j], dd[i] + ww[h]);
		}
		for (int h = 0; h < m_; h++) {
			int i = ii[h], j = jj[h];
			ww_[h] = ww[h] + dd[i] - dd[j];
		}
		int f = 0;
		while (dijkstra(s, t)) {
			f += trace(s, t);
			for (int h = 0; h < m_; h++) {
				int i = ii[h], j = jj[h];
				if (dd[i] != INF && dd[j] != INF) {
					// dd[j] <= dd[i] + ww_[h]
					// ww_[h] + dd[i] - dd[j] >= 0
					ww_[h] += dd[i] - dd[j];
				}
			}
		}
		int cost = 0;
		for (int h = 0; h < m_; h++)
			cost += ww[h] * cc[h << 1 | 1];
		return cost;
	}
	void main() {
		int n = sc.nextInt() / 2;
		n_ = 1 + n + A + 1;
		m_ = n + n * A + A;
		init();
		byte[] cc = sc.next().getBytes();
		int[] bb = new int[n * 2];
		for (int i = 0; i < n * 2; i++)
			bb[i] = sc.nextInt();
		for (int i = 0; i < n; i++)
			link_(0, 1 + i, 2, 0);
		for (int i = 0; i < n; i++) {
			int j = n * 2 - 1 - i;
			int ai = cc[i] - 'a';
			int aj = cc[j] - 'a';
			for (int a = 0; a < A; a++) {
				int b;
				if (a == ai && a == aj)
					b = Math.max(bb[i], bb[j]);
				else if (a == ai)
					b = bb[i];
				else if (a == aj)
					b = bb[j];
				else
					b = 0;
				link_(1 + i, 1 + n + a, 1, -b);
			}
		}
		int[] kk = new int[A];
		for (int i = 0; i < n * 2; i++) {
			int a = cc[i] - 'a';
			kk[a]++;
		}
		for (int a = 0; a < A; a++)
			link_(1 + n + a, n_ - 1, kk[a], 0);
		println(-edmonds_karp(0, n_ - 1));
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.OutputStreamWriter;
import java.util.NoSuchElementException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Iterator;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Junior
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskF solver = new TaskF();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskF {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            String s = in.nextString();
            int[] a = new int[n];
            int[] cnt = new int[26];
            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
                cnt[(int) s.charAt(i) - 'a']++;
            }
            Graph g = new Graph(n + 100);
            int source = n + 100 - 2, target = source + 1;
            for (int i = 0; i * 2 < n; ++i) g.addFlowWeightedEdge(i, target, 0, 2);
            for (int i = 0; i < 26; ++i) {
                g.addFlowWeightedEdge(source, i + n, 0, cnt[i]);
                for (int j = 0; j * 2 < n; ++j) {
                    if (s.charAt(j) == s.charAt(n - j - 1)) {
                        int w = 0;
                        if (s.charAt(j) == i + 'a') w = -Math.max(a[j], a[n - j - 1]);
                        g.addFlowWeightedEdge(i + n, j, w, 1);
                    } else {
                        int w = 0;
                        if (s.charAt(j) == i + 'a') w -= a[j];
                        if (s.charAt(n - j - 1) == i + 'a') w -= a[n - j - 1];
                        g.addFlowWeightedEdge(i + n, j, w, 1);
                    }
                }
            }
            MinCostFlow mcmf = new MinCostFlow(g, source, target, true);
            out.println(-mcmf.minCostMaxFlow().first);

        }

    }

    static interface IntComparator {
        public static final IntComparator DEFAULT = (first, second) -> {
            if (first < second) {
                return -1;
            }
            if (first > second) {
                return 1;
            }
            return 0;
        };

        public int compare(int first, int second);

    }

    static interface IntStream extends Iterable<Integer>, Comparable<IntStream> {
        public IntIterator intIterator();

        default public Iterator<Integer> iterator() {
            return new Iterator<Integer>() {
                private IntIterator it = intIterator();

                public boolean hasNext() {
                    return it.isValid();
                }

                public Integer next() {
                    int result = it.value();
                    it.advance();
                    return result;
                }
            };
        }

        default public int compareTo(IntStream c) {
            IntIterator it = intIterator();
            IntIterator jt = c.intIterator();
            while (it.isValid() && jt.isValid()) {
                int i = it.value();
                int j = jt.value();
                if (i < j) {
                    return -1;
                } else if (i > j) {
                    return 1;
                }
                it.advance();
                jt.advance();
            }
            if (it.isValid()) {
                return 1;
            }
            if (jt.isValid()) {
                return -1;
            }
            return 0;
        }

    }

    static class Graph {
        public static final int REMOVED_BIT = 0;
        protected int vertexCount;
        protected int edgeCount;
        private int[] firstOutbound;
        private int[] firstInbound;
        private Edge[] edges;
        private int[] nextInbound;
        private int[] nextOutbound;
        private int[] from;
        private int[] to;
        private long[] weight;
        public long[] capacity;
        private int[] reverseEdge;
        private int[] flags;

        public Graph(int vertexCount) {
            this(vertexCount, vertexCount);
        }

        public Graph(int vertexCount, int edgeCapacity) {
            this.vertexCount = vertexCount;
            firstOutbound = new int[vertexCount];
            Arrays.fill(firstOutbound, -1);

            from = new int[edgeCapacity];
            to = new int[edgeCapacity];
            nextOutbound = new int[edgeCapacity];
            flags = new int[edgeCapacity];
        }

        public int addEdge(int fromID, int toID, long weight, long capacity, int reverseEdge) {
            ensureEdgeCapacity(edgeCount + 1);
            if (firstOutbound[fromID] != -1) {
                nextOutbound[edgeCount] = firstOutbound[fromID];
            } else {
                nextOutbound[edgeCount] = -1;
            }
            firstOutbound[fromID] = edgeCount;
            if (firstInbound != null) {
                if (firstInbound[toID] != -1) {
                    nextInbound[edgeCount] = firstInbound[toID];
                } else {
                    nextInbound[edgeCount] = -1;
                }
                firstInbound[toID] = edgeCount;
            }
            this.from[edgeCount] = fromID;
            this.to[edgeCount] = toID;
            if (capacity != 0) {
                if (this.capacity == null) {
                    this.capacity = new long[from.length];
                }
                this.capacity[edgeCount] = capacity;
            }
            if (weight != 0) {
                if (this.weight == null) {
                    this.weight = new long[from.length];
                }
                this.weight[edgeCount] = weight;
            }
            if (reverseEdge != -1) {
                if (this.reverseEdge == null) {
                    this.reverseEdge = new int[from.length];
                    Arrays.fill(this.reverseEdge, 0, edgeCount, -1);
                }
                this.reverseEdge[edgeCount] = reverseEdge;
            }
            if (edges != null) {
                edges[edgeCount] = createEdge(edgeCount);
            }
            return edgeCount++;
        }

        protected final GraphEdge createEdge(int id) {
            return new GraphEdge(id);
        }

        public final int addFlowWeightedEdge(int from, int to, long weight, long capacity) {
            if (capacity == 0) {
                return addEdge(from, to, weight, 0, -1);
            } else {
                int lastEdgeCount = edgeCount;
                addEdge(to, from, -weight, 0, lastEdgeCount + entriesPerEdge());
                return addEdge(from, to, weight, capacity, lastEdgeCount);
            }
        }

        protected int entriesPerEdge() {
            return 1;
        }

        public final int vertexCount() {
            return vertexCount;
        }

        public final int firstOutbound(int vertex) {
            int id = firstOutbound[vertex];
            while (id != -1 && isRemoved(id)) {
                id = nextOutbound[id];
            }
            return id;
        }

        public final int nextOutbound(int id) {
            id = nextOutbound[id];
            while (id != -1 && isRemoved(id)) {
                id = nextOutbound[id];
            }
            return id;
        }

        public final int source(int id) {
            return from[id];
        }

        public final int destination(int id) {
            return to[id];
        }

        public final long weight(int id) {
            if (weight == null) {
                return 0;
            }
            return weight[id];
        }

        public final long capacity(int id) {
            if (capacity == null) {
                return 0;
            }
            return capacity[id];
        }

        public final long flow(int id) {
            if (reverseEdge == null) {
                return 0;
            }
            return capacity[reverseEdge[id]];
        }

        public final void pushFlow(int id, long flow) {
            if (flow == 0) {
                return;
            }
            if (flow > 0) {
                if (capacity(id) < flow) {
                    throw new IllegalArgumentException("Not enough capacity");
                }
            } else {
                if (flow(id) < -flow) {
                    throw new IllegalArgumentException("Not enough capacity");
                }
            }
            capacity[id] -= flow;
            capacity[reverseEdge[id]] += flow;
        }

        public final boolean flag(int id, int bit) {
            return (flags[id] >> bit & 1) != 0;
        }

        public final boolean isRemoved(int id) {
            return flag(id, REMOVED_BIT);
        }

        protected void ensureEdgeCapacity(int size) {
            if (from.length < size) {
                int newSize = Math.max(size, 2 * from.length);
                if (edges != null) {
                    edges = resize(edges, newSize);
                }
                from = resize(from, newSize);
                to = resize(to, newSize);
                nextOutbound = resize(nextOutbound, newSize);
                if (nextInbound != null) {
                    nextInbound = resize(nextInbound, newSize);
                }
                if (weight != null) {
                    weight = resize(weight, newSize);
                }
                if (capacity != null) {
                    capacity = resize(capacity, newSize);
                }
                if (reverseEdge != null) {
                    reverseEdge = resize(reverseEdge, newSize);
                }
                flags = resize(flags, newSize);
            }
        }

        protected final int[] resize(int[] array, int size) {
            int[] newArray = new int[size];
            System.arraycopy(array, 0, newArray, 0, array.length);
            return newArray;
        }

        private long[] resize(long[] array, int size) {
            long[] newArray = new long[size];
            System.arraycopy(array, 0, newArray, 0, array.length);
            return newArray;
        }

        private Edge[] resize(Edge[] array, int size) {
            Edge[] newArray = new Edge[size];
            System.arraycopy(array, 0, newArray, 0, array.length);
            return newArray;
        }

        public final boolean isSparse() {
            return vertexCount == 0 || edgeCount * 20 / vertexCount <= vertexCount;
        }

        protected class GraphEdge implements Edge {
            protected int id;

            protected GraphEdge(int id) {
                this.id = id;
            }

        }

    }

    static interface IntCollection extends IntStream {
    }

    static class MinCostFlow {
        private final Graph graph;
        private final int source;
        private final int destination;
        private final long[] phi;
        private final long[] dijkstraResult;
        private final int[] lastEdge;
        private final Heap heap;
        private final int vertexCount;
        private final int[] visited;
        private int visitIndex;

        public MinCostFlow(Graph graph, int source, int destination, boolean hasNegativeEdges) {
            this.graph = graph;
            this.source = source;
            this.destination = destination;
            vertexCount = graph.vertexCount();
            phi = new long[vertexCount];
            if (hasNegativeEdges) {
                fordBellman();
            }
            dijkstraResult = new long[vertexCount];
            lastEdge = new int[vertexCount];
            if (graph.isSparse()) {
                heap = new Heap(vertexCount, new IntComparator() {
                    public int compare(int first, int second) {
                        return IntegerUtils.longCompare(dijkstraResult[first], dijkstraResult[second]);
                    }
                }, vertexCount);
                visited = null;
            } else {
                heap = null;
                visited = new int[vertexCount];
            }
        }

        private void fordBellman() {
            Arrays.fill(phi, Long.MAX_VALUE);
            phi[source] = 0;
            boolean[] inQueue = new boolean[vertexCount];
            int[] queue = new int[vertexCount + 1];
            queue[0] = source;
            inQueue[source] = true;
            int stepCount = 0;
            int head = 0;
            int end = 1;
            int maxSteps = 2 * vertexCount * vertexCount;
            while (head != end) {
                int vertex = queue[head++];
                if (head == queue.length) {
                    head = 0;
                }
                inQueue[vertex] = false;
                int edgeID = graph.firstOutbound(vertex);
                while (edgeID != -1) {
                    long total = phi[vertex] + graph.weight(edgeID);
                    int destination = graph.destination(edgeID);
                    if (graph.capacity(edgeID) != 0 && phi[destination] > total) {
                        phi[destination] = total;
                        if (!inQueue[destination]) {
                            queue[end++] = destination;
                            inQueue[destination] = true;
                            if (end == queue.length) {
                                end = 0;
                            }
                        }
                    }
                    edgeID = graph.nextOutbound(edgeID);
                }
                if (++stepCount > maxSteps) {
                    throw new IllegalArgumentException("Graph contains negative cycle");
                }
            }
        }

        public Pair<Long, Long> minCostMaxFlow() {
            return minCostMaxFlow(Long.MAX_VALUE);
        }

        public Pair<Long, Long> minCostMaxFlow(long maxFlow) {
            long cost = 0;
            long flow = 0;
            while (maxFlow != 0) {
                if (graph.isSparse()) {
                    dijkstraAlgorithm();
                } else {
                    dijkstraAlgorithmFull();
                }
                if (lastEdge[destination] == -1) {
                    return Pair.makePair(cost, flow);
                }
                for (int i = 0; i < dijkstraResult.length; i++) {
                    if (dijkstraResult[i] != Long.MAX_VALUE) {
                        phi[i] += dijkstraResult[i];
                    }
                }
                int vertex = destination;
                long currentFlow = maxFlow;
                long currentCost = 0;
                while (vertex != source) {
                    int edgeID = lastEdge[vertex];
                    currentFlow = Math.min(currentFlow, graph.capacity(edgeID));
                    currentCost += graph.weight(edgeID);
                    vertex = graph.source(edgeID);
                }
                maxFlow -= currentFlow;
                cost += currentCost * currentFlow;
                flow += currentFlow;
                vertex = destination;
                while (vertex != source) {
                    int edgeID = lastEdge[vertex];
                    graph.pushFlow(edgeID, currentFlow);
                    vertex = graph.source(edgeID);
                }
            }
            return Pair.makePair(cost, flow);
        }

        private void dijkstraAlgorithm() {
            Arrays.fill(dijkstraResult, Long.MAX_VALUE);
            Arrays.fill(lastEdge, -1);
            dijkstraResult[source] = 0;
            heap.add(source);
            while (!heap.isEmpty()) {
                int current = heap.poll();
                int edgeID = graph.firstOutbound(current);
                while (edgeID != -1) {
                    if (graph.capacity(edgeID) != 0) {
                        int next = graph.destination(edgeID);
                        long total = graph.weight(edgeID) - phi[next] + phi[current] + dijkstraResult[current];
                        if (dijkstraResult[next] > total) {
                            dijkstraResult[next] = total;
                            if (heap.getIndex(next) == -1) {
                                heap.add(next);
                            } else {
                                heap.shiftUp(heap.getIndex(next));
                            }
                            lastEdge[next] = edgeID;
                        }
                    }
                    edgeID = graph.nextOutbound(edgeID);
                }
            }
        }

        private void dijkstraAlgorithmFull() {
            visitIndex++;
            Arrays.fill(dijkstraResult, Long.MAX_VALUE);
            lastEdge[destination] = -1;
            dijkstraResult[source] = 0;
            for (int i = 0; i < vertexCount; i++) {
                int index = -1;
                long length = Long.MAX_VALUE;
                for (int j = 0; j < vertexCount; j++) {
                    if (visited[j] != visitIndex && dijkstraResult[j] < length) {
                        length = dijkstraResult[j];
                        index = j;
                    }
                }
                if (index == -1) {
                    return;
                }
                visited[index] = visitIndex;
                int edgeID = graph.firstOutbound(index);
                while (edgeID != -1) {
                    if (graph.capacity(edgeID) != 0) {
                        int next = graph.destination(edgeID);
                        if (visited[next] != visitIndex) {
                            long total = graph.weight(edgeID) - phi[next] + phi[index] + length;
                            if (dijkstraResult[next] > total) {
                                dijkstraResult[next] = total;
                                lastEdge[next] = edgeID;
                            }
                        }
                    }
                    edgeID = graph.nextOutbound(edgeID);
                }
            }
        }

    }

    static interface Edge {
    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(long i) {
            writer.println(i);
        }

    }

    static interface IntQueue extends IntCollection {
    }

    static interface IntIterator {
        public int value() throws NoSuchElementException;

        public boolean advance();

        public boolean isValid();

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                if (Character.isValidCodePoint(c)) {
                    res.appendCodePoint(c);
                }
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }

    static class IntegerUtils {
        public static int longCompare(long a, long b) {
            if (a < b) {
                return -1;
            }
            if (a > b) {
                return 1;
            }
            return 0;
        }

    }

    static class Pair<U, V> implements Comparable<Pair<U, V>> {
        public final U first;
        public final V second;

        public static <U, V> Pair<U, V> makePair(U first, V second) {
            return new Pair<U, V>(first, second);
        }

        private Pair(U first, V second) {
            this.first = first;
            this.second = second;
        }

        public boolean equals(Object o) {
            if (this == o) {
                return true;
            }
            if (o == null || getClass() != o.getClass()) {
                return false;
            }

            Pair pair = (Pair) o;

            return !(first != null ? !first.equals(pair.first) : pair.first != null) &&
                    !(second != null ? !second.equals(pair.second) : pair.second != null);
        }

        public int hashCode() {
            int result = first != null ? first.hashCode() : 0;
            result = 31 * result + (second != null ? second.hashCode() : 0);
            return result;
        }

        public String toString() {
            return "(" + first + "," + second + ")";
        }

        @SuppressWarnings({"unchecked"})
        public int compareTo(Pair<U, V> o) {
            int value = ((Comparable<U>) first).compareTo(o.first);
            if (value != 0) {
                return value;
            }
            return ((Comparable<V>) second).compareTo(o.second);
        }

    }

    static class Heap implements IntQueue {
        private IntComparator comparator;
        private int size = 0;
        private int[] elements;
        private int[] at;

        public Heap(int maxElement) {
            this(10, maxElement);
        }

        public Heap(IntComparator comparator, int maxElement) {
            this(10, comparator, maxElement);
        }

        public Heap(int capacity, int maxElement) {
            this(capacity, IntComparator.DEFAULT, maxElement);
        }

        public Heap(int capacity, IntComparator comparator, int maxElement) {
            this.comparator = comparator;
            elements = new int[capacity];
            at = new int[maxElement];
            Arrays.fill(at, -1);
        }

        public boolean isEmpty() {
            return size == 0;
        }

        public void add(int element) {
            ensureCapacity(size + 1);
            elements[size] = element;
            at[element] = size;
            shiftUp(size++);
        }

        public void shiftUp(int index) {
            //		if (index < 0 || index >= size)
            //			throw new IllegalArgumentException();
            int value = elements[index];
            while (index != 0) {
                int parent = (index - 1) >>> 1;
                int parentValue = elements[parent];
                if (comparator.compare(parentValue, value) <= 0) {
                    elements[index] = value;
                    at[value] = index;
                    return;
                }
                elements[index] = parentValue;
                at[parentValue] = index;
                index = parent;
            }
            elements[0] = value;
            at[value] = 0;
        }

        public void shiftDown(int index) {
            if (index < 0 || index >= size) {
                throw new IllegalArgumentException();
            }
            while (true) {
                int child = (index << 1) + 1;
                if (child >= size) {
                    return;
                }
                if (child + 1 < size && comparator.compare(elements[child], elements[child + 1]) > 0) {
                    child++;
                }
                if (comparator.compare(elements[index], elements[child]) <= 0) {
                    return;
                }
                swap(index, child);
                index = child;
            }
        }

        public int getIndex(int element) {
            return at[element];
        }

        private void swap(int first, int second) {
            int temp = elements[first];
            elements[first] = elements[second];
            elements[second] = temp;
            at[elements[first]] = first;
            at[elements[second]] = second;
        }

        private void ensureCapacity(int size) {
            if (elements.length < size) {
                int[] oldElements = elements;
                elements = new int[Math.max(2 * elements.length, size)];
                System.arraycopy(oldElements, 0, elements, 0, this.size);
            }
        }

        public int poll() {
            if (isEmpty()) {
                throw new IndexOutOfBoundsException();
            }
            int result = elements[0];
            at[result] = -1;
            if (size == 1) {
                size = 0;
                return result;
            }
            elements[0] = elements[--size];
            at[elements[0]] = 0;
            shiftDown(0);
            return result;
        }

        public IntIterator intIterator() {
            return new IntIterator() {
                private int at;

                public int value() throws NoSuchElementException {
                    return elements[at];
                }

                public boolean advance() throws NoSuchElementException {
                    return ++at < size;
                }

                public boolean isValid() {
                    return at < size;
                }

                public void remove() throws NoSuchElementException {
                    throw new UnsupportedOperationException();
                }
            };
        }

    }
}


import java.util.*;

import static java.util.Arrays.stream;
import static java.util.stream.Collectors.toMap;

public class Main {
    static int n;
    static char[] chars;
    static int[] vals;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        n = sc.nextInt();
        sc.nextLine();
        String s = sc.nextLine().trim();
        chars = s.toCharArray();

        vals = new int[n];
        for (int i = 0; i < n; i ++) {
            vals[i] = sc.nextInt();
        }
        sc.nextLine();

        List<Char> wrongChars = new ArrayList<>();
        List<Char> chars1 = new ArrayList<>();
        for (int i = 0; i < n / 2; i++) {
            if (vals[i] > vals[n - i - 1]) {
                swap(i);
            }

            Char chr = new Char(chars[i], vals[i], i);
            if (chars[i] == chars[n - i - 1]) {
                wrongChars.add(chr);
            }
            chars1.add(chr);
        }
        chars1.sort(Comparator.comparing(c -> c.val));

        int diff = 0;
//        int[] vals1 = Arrays.copyOf(vals, n/2);
        if (!isAntiPalindrome(chars)) {
            if (wrongChars.size() == 1) {
                Char wrongChar = wrongChars.get(0);
                for (int i = 0; i < n/2; i++) {
                    Char chr = chars1.get(i);
                    if (chr.chr != wrongChar.chr && chars[n - chr.idx - 1] != wrongChar.chr) {
                        diff = wrongChar.val + chr.val;
                        break;
                    }
                }
            } else if (wrongChars.size() > 1) {
                Map<Character, Integer> map = wrongChars.stream().collect(toMap(n -> n.chr, n -> 1, (a, b) -> a+1, TreeMap::new));
                Map.Entry<Character, Integer> max = map.entrySet().stream().max(Comparator.comparing(Map.Entry::getValue)).get();
                List<Char> append = new ArrayList<>();
                while (max.getValue() * 2 > wrongChars.size() + append.size()) {
                    Character maxChar = max.getKey();
                    for (int i = 0; i < n/2; i++) {
                        Char chr = chars1.get(i);
                        if (chr.chr != maxChar && chars[n - chr.idx - 1] != maxChar && !wrongChars.contains(chr) && !append.contains(chr)) {
                            append.add(chr);
                            break;
                        }
                    }
                }
                diff = wrongChars.stream().mapToInt(chr -> chr.val).sum() + append.stream().mapToInt(chr -> chr.val).sum();
            }
        }

        int sum = stream(vals).sum();
        System.out.println(sum - diff);
    }

    private static void swap(int i) {
        char tmp = chars[i];
        chars[i] = chars[n - i - 1];
        chars[n - i - 1] = tmp;

        int tmpVal = vals[i];
        vals[i] = vals[n - i - 1];
        vals[n - i - 1] = tmpVal;
    }

    private static void swap(int i, int j) {
        char tmp = chars[i];
        chars[i] = chars[j];
        chars[j] = tmp;

        int tmpVal = vals[i];
        vals[i] = vals[n - i - 1];
        vals[n - i - 1] = tmpVal;
    }

    private static boolean isAntiPalindrome(char[] chars) {
        int n = chars.length;
        for (int i = 0; i < n/2; i++) {
            if (chars[i] == chars[n - i - 1]) {
                return false;
            }
        }
        return true;
    }

    static class Char {
        char chr;
        int val;
        int idx;

        Char(char chr, int val, int idx) {
            this.chr = chr;
            this.val = val;
            this.idx = idx;
        }

        @Override
        public String toString() {
            return "Char{" +
                    "chr=" + chr +
                    ", val=" + val +
                    ", idx=" + idx +
                    '}';
        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        AntiPalindrome solver = new AntiPalindrome();
        solver.solve(1, in, out);
        out.close();
    }

    static class AntiPalindrome {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int N = in.nextInt();
            int[] cnt = new int[26];
            int move = 0;
            char[] str = in.next().toCharArray();
            int[] b = new int[N];
            int res = 0;
            for (int i = 0; i < b.length; i++) {
                b[i] = in.nextInt();
                res += b[i];
            }
            for (int i = 0; i < N / 2; i++) {
                if (str[i] == str[N - i - 1]) {
                    cnt[str[i] - 'a']++;
                    move++;
                    res -= Math.min(b[i], b[N - i - 1]);
                }
            }
            for (int i = 0; i < 26; i++) {
                if (cnt[i] > move / 2) {
                    int left = cnt[i] * 2 - move;
                    ArrayList<Integer> pos = new ArrayList<>();
                    for (int j = 0; j < N / 2; j++) {
                        if (str[j] != str[N - j - 1]) {
                            if (str[N - j - 1] - 'a' == i || str[j] - 'a' == i) {
//                            if (str[j] -'a' == i) {
//                                pos.add(b[j]);
//                            }
//                            else {
//                                pos.add(b[N-j-1]);
//                            }
                            } else {
                                pos.add(Math.min(b[N - j - 1], b[j]));
                            }
                        }
                    }
                    Collections.sort(pos);
                    for (int j = 0; j < left; j++) {
                        res -= pos.get(j);
                    }
                }
            }
            out.println(res);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.List;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Collections;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author svilen.marchev@gmail.com
 */
public class Main {
  public static void main(String[] args) {
    InputStream inputStream = System.in;
    OutputStream outputStream = System.out;
    InputReader in = new InputReader(inputStream);
    PrintWriter out = new PrintWriter(outputStream);
    TaskF solver = new TaskF();
    solver.solve(1, in, out);
    out.close();
  }

  static class TaskF {
    int n;
    char[] s;
    int[] beauty;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
      n = in.readInt();
      s = in.readString().toCharArray();
      beauty = new int[n];
      int totalBeauty = 0;
      for (int i = 0; i < n; ++i) {
        beauty[i] = in.readInt();
        totalBeauty += beauty[i];
      }

      // Find all pairs of indices (i, n-1-i) for which s[i]=s[n-1-i] and the most common char among those pairs.
      List<Integer> equalPairs = new ArrayList<>(n / 2);
      int[] charOccurrencesInEqualPairs = new int[128];
      char mostCommonCharInEqualPairs = 'a';
      for (int i = 0; i < n / 2; ++i) {
        if (s[i] == s[n - 1 - i]) {
          equalPairs.add(i);
          if (++charOccurrencesInEqualPairs[s[i]] > charOccurrencesInEqualPairs[mostCommonCharInEqualPairs]) {
            mostCommonCharInEqualPairs = s[i];
          }
        }
      }

      // These pairs must be broken up in any case, so account for them in the answer.
      int ans = totalBeauty;
      for (int equalPair : equalPairs) {
        ans -= Math.min(beauty[equalPair], beauty[n - 1 - equalPair]);
      }

      // If more than half of the pairs are with the same char, then we would not be able to reshuffle
      // the chars within the pairs, so we would need to break up some of the pairs with non-equal chars.
      // We would need to consider only pairs for which the chars are different AND neither of the two
      // chars is equal to the most common char in the "equal" pairs (otherwise swapping that char with
      // either of the chars in the "non-equal" pair would result in a non-palindromic pair).
      if (charOccurrencesInEqualPairs[mostCommonCharInEqualPairs] > equalPairs.size() / 2) {
        List<Integer> nonEqualPairsMinBeautyPenalties = new ArrayList<>(n / 2);
        for (int i = 0; i < n / 2; ++i) {
          if (s[i] != s[n - 1 - i] && s[i] != mostCommonCharInEqualPairs && s[n - 1 - i] != mostCommonCharInEqualPairs) {
            nonEqualPairsMinBeautyPenalties.add(Math.min(beauty[i], beauty[n - 1 - i]));
          }
        }
        Collections.sort(nonEqualPairsMinBeautyPenalties);
        int rem = 2 * charOccurrencesInEqualPairs[mostCommonCharInEqualPairs] - equalPairs.size();
        for (int i = 0; i < rem; ++i) {
          ans -= nonEqualPairsMinBeautyPenalties.get(i);
        }
      }

      out.println(ans);
    }

  }

  static class InputReader {
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private InputReader.SpaceCharFilter filter;

    public InputReader(InputStream stream) {
      this.stream = stream;
    }

    public int read() {
      if (numChars == -1) {
        throw new InputMismatchException();
      }
      if (curChar >= numChars) {
        curChar = 0;
        try {
          numChars = stream.read(buf);
        } catch (IOException e) {
          throw new InputMismatchException();
        }
        if (numChars <= 0) {
          return -1;
        }
      }
      return buf[curChar++];
    }

    public int readInt() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      int sgn = 1;
      if (c == '-') {
        sgn = -1;
        c = read();
      }
      int res = 0;
      do {
        if (c < '0' || c > '9') {
          throw new InputMismatchException();
        }
        res *= 10;
        res += c - '0';
        c = read();
      } while (!isSpaceChar(c));
      return res * sgn;
    }

    public String readString() {
      int c = read();
      while (isSpaceChar(c)) {
        c = read();
      }
      StringBuilder res = new StringBuilder();
      do {
        if (Character.isValidCodePoint(c)) {
          res.appendCodePoint(c);
        }
        c = read();
      } while (!isSpaceChar(c));
      return res.toString();
    }

    public boolean isSpaceChar(int c) {
      if (filter != null) {
        return filter.isSpaceChar(c);
      }
      return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
      return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public interface SpaceCharFilter {
      public boolean isSpaceChar(int ch);

    }

  }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.*;

/**
 * Created by nadya on 28/10/17.
 */
public class Educational {
    public static void main(String[] args) throws IOException {
        Educational c = new Educational();
        c.start();
    }

    private void start() throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer str = new StringTokenizer(in.readLine());
        int n = Integer.parseInt(str.nextToken());
        String s = in.readLine();
        int b[] = new int[n];
        TreeMap<Integer, Set<Integer>> w = new TreeMap<Integer, Set<Integer>>();

        str = new StringTokenizer(in.readLine());
        for (int i = 0; i < n; ++i) {
            b[i] = Integer.parseInt(str.nextToken());
        }
        char[] res = s.toCharArray();

        HashSet<Integer> waitingList = new HashSet<Integer>();
        for (int i = 0; i < n / 2; ++i) {
            if (res[i] == res[getvisavis(n, i)]) {
                if (waitingList.isEmpty()) {
                    waitingList.add(i);
                } else {
                    boolean found = false;
                    for (Integer j : waitingList) {
                        if (res[j] != res[i]) {
                            int minB1 = b[j] < b[getvisavis(n, j)] ? j : getvisavis(n, j);
                            int minB2 = b[i] < b[getvisavis(n, i)] ? i : getvisavis(n, i);
                            swap(res, minB1, minB2);
                            b[minB1] = 0;
                            b[minB2] = 0;
                            waitingList.remove(j);
                            found = true;
                            break;
                        }
                    }
                    if (! found) waitingList.add(i);
                }
            }
        }
        for (int i = 0; i < n / 2; ++i) {
            if (res[i] == res[getvisavis(n, i)]) {
               // System.out.println(res[i]);
            }
        }

        w.put(0, new HashSet<Integer>());
        for (int i = 0; i < n; ++i) {
          //  if (b[i] == 0) continue;
            if (!w.containsKey(b[i])) w.put(b[i], new HashSet<Integer>());
            w.get(b[i]).add(i);
        }

        for (int i = 0; i < n / 2; ++i) {
            if (res[i] == res[getvisavis(n, i)]) {

                boolean finished = false;

                int indexToChange = b[i] < b[getvisavis(n, i)] ? i : getvisavis(n, i);

                for (Map.Entry<Integer, Set<Integer>> l : w.entrySet()) {
                    Set<Integer> candidates = l.getValue();
                    for (Integer j : candidates) {
                        if (j == i || j == indexToChange || res[indexToChange] == res[j] || res[indexToChange] == res[getvisavis(n, j)]) {
                            continue;
                        }

                        swap(res, indexToChange, j);

                        b[j] = 0;
                        b[indexToChange] = 0;

                        w.get(0).add(j);
                        w.get(0).add(indexToChange);

                        w.get(b[indexToChange]).remove(indexToChange);
                        w.get(b[j]).remove(j);

                        finished = true;
                        break;
                    }

                    if (finished) break;
                }
                if (res[i] == res[getvisavis(n, i)]) System.out.println("alarma");
            }
        }
        for (int i = 0; i < n / 2; ++i) {
            if (res[i] == res[getvisavis(n, i)]) {
                System.out.println("FFFF");
            }
        }

        int sum = 0;
        for (int i = 0; i < n; ++i) {
            //if (!changed[i]) {
            sum += b[i];
            // }
        }

        System.out.println(sum);
    }

    public static int getvisavis(int n, int i) {
        return n - i - 1;
    }

    public static void swap(char[] a, int i, int j) {
        char t = a[i];
        a[i] = a[j];
        a[j] = t;
    }
}


// practice with rainboy
import java.io.*;
import java.util.*;

public class CF884F extends PrintWriter {
	CF884F() { super(System.out, true); }
	Scanner sc = new Scanner(System.in);
	public static void main(String[] $) {
		CF884F o = new CF884F(); o.main(); o.flush();
	}

	static final int A = 26, INF = 0x3f3f3f3f;
	int[] oo, oh; int __ = 1;
	int link(int o, int h) {
		oo[__] = o; oh[__] = h;
		return __++;
	}
	int[] ii, jj, cc, cost, cost_; int m_;
	int[] ae, pi, dd, ff; int n_;
	int[] pq, iq; int cnt;
	void init() {
		oo = new int[1 + m_ * 2]; oh = new int[1 + m_ * 2];
		ii = new int[m_]; jj = new int[m_]; cc = new int[m_ << 1];
		cost = new int[m_]; cost_ = new int[m_];
		pi = new int[n_]; dd = new int[n_]; ff = new int[n_];
		ae = new int[n_];
		pq = new int[1 + n_]; iq = new int[n_];
		m_ = 0;
	}
	void link_(int i, int j, int c, int co) {
		int h = m_++;
		ii[h] = i; jj[h] = j; cc[h << 1] = c;
		cost[h] = co;
		ae[i] = link(ae[i], h << 1);
		ae[j] = link(ae[j], h << 1 | 1);
	}
	boolean less(int u, int v) {
		return pi[u] < pi[v] || pi[u] == pi[v] && dd[u] < dd[v];
	}
	int i2(int i) {
		return (i *= 2) > cnt ? 0 : i < cnt && less(pq[i + 1], pq[i]) ? i + 1 : i;
	}
	void pq_up(int u) {
		int i, j, v;
		for (i = iq[u]; (j = i / 2) > 0 && less(u, v = pq[j]); i = j)
			pq[iq[v] = i] = v;
		pq[iq[u] = i] = u;
	}
	void pq_dn(int u) {
		int i, j, v;
		for (i = iq[u]; (j = i2(i)) > 0 && less(v = pq[j], u); i = j)
			pq[iq[v] = i] = v;
		pq[iq[u] = i] = u;
	}
	void pq_add_last(int u) {
		pq[iq[u] = ++cnt] = u;
	}
	int pq_remove_first() {
		int u = pq[1], v = pq[cnt--];
		if (v != u) {
			iq[v] = 1; pq_dn(v);
		}
		iq[u] = 0;
		return u;
	}
	boolean dijkstra(int s, int t) {
		Arrays.fill(pi, INF);
		pi[s] = 0; pq_add_last(s);
		while (cnt > 0) {
			int i = pq_remove_first();
			int d = dd[i] + 1;
			for (int o = ae[i]; o != 0; o = oo[o]) {
				int h_ = oh[o];
				if (cc[h_] > 0) {
					int h = h_ >> 1;
					int j = i ^ ii[h] ^ jj[h];
					int p = pi[i] + ((h_ & 1) == 0 ? cost_[h] : -cost_[h]);
					if (pi[j] > p || pi[j] == p && dd[j] > d) {
						if (pi[j] == INF)
							pq_add_last(j);
						pi[j] = p; dd[j] = d; ff[j] = h_;
						pq_up(j);
					}
				}
			}
		}
		return pi[t] != INF;
	}
	int trace(int s, int t) {
		while (t != s) {
			int h_ = ff[t], h = h_ >> 1;
			cc[h_]--; cc[h_ ^ 1]++;
			t ^= ii[h] ^ jj[h];
		}
		return 1;
	}
	int edmonds_karp(int s, int t) {
		for (int h = 0; h < m_; h++) {
			int i = ii[h], j = jj[h];
			pi[j] = Math.min(pi[j], pi[i] + cost[h]);
		}
		for (int h = 0; h < m_; h++) {
			int i = ii[h], j = jj[h];
			cost_[h] = cost[h] + pi[i] - pi[j];
		}
		int f = 0;
		while (dijkstra(s, t)) {
			f += trace(s, t);
			for (int h = 0; h < m_; h++) {
				int i = ii[h], j = jj[h];
				if (pi[i] != INF && pi[j] != INF) {
					// pi[j] <= pi[i] + cost_[h]
					// cost_[h] + pi[i] - pi[j] >= 0
					cost_[h] += pi[i] - pi[j];
				}
			}
		}
		int ans = 0;
		for (int h = 0; h < m_; h++)
			ans += cc[h << 1 | 1] * cost[h];
		return ans;
	}
	void main() {
		int n = sc.nextInt() / 2;
		n_ = 1 + n + A + 1;
		m_ = n + n * A + A;
		init();
		byte[] cc = sc.next().getBytes();
		int[] bb = new int[n * 2];
		for (int i = 0; i < n * 2; i++)
			bb[i] = sc.nextInt();
		for (int i = 0; i < n; i++)
			link_(0, 1 + i, 2, 0);
		for (int i = 0; i < n; i++) {
			int j = n * 2 - 1 - i;
			int ai = cc[i] - 'a';
			int aj = cc[j] - 'a';
			for (int a = 0; a < A; a++) {
				int b;
				if (a == ai && a == aj)
					b = Math.max(bb[i], bb[j]);
				else if (a == ai)
					b = bb[i];
				else if (a == aj)
					b = bb[j];
				else
					b = 0;
				link_(1 + i, 1 + n + a, 1, -b);
			}
		}
		int[] kk = new int[A];
		for (int i = 0; i < n * 2; i++) {
			int a = cc[i] - 'a';
			kk[a]++;
		}
		for (int a = 0; a < A; a++)
			link_(1 + n + a, n_ - 1, kk[a], 0);
		println(-edmonds_karp(0, n_ - 1));
	}
}