Greenhouse Growth

Given n sunflower heights and an m-day schedule of left or right lamps, compute every height after daily growth toward the taller neighbor.

Hard8Segment treeStackBinary searchSimulationNo attempts yetTime limit6sMemory limit512 MB

Problem

You have left computer science for agriculture, and your new job is growing sunflowers in an underground greenhouse. The greenhouse holds nn sunflowers planted in a straight line, numbered 11 through nn from left to right. Two lamps supply the light and heat the sunflowers need. Lamp AA is at the left end of the line, lamp BB is at the right end.

Every day exactly one of the two lamps is on. All the sunflowers turn towards the light, and some of them grow. A sunflower grows if and only if the sunflower directly in front of it, towards the light, is taller. The growth is continuous at a uniform rate of exactly 11 centimeter per day. When a sunflower starts to grow, the sunflower directly behind it can start to grow at that same instant.

On a day with lamp AA, the sunflower directly in front of sunflower kk is sunflower k1k-1. On a day with lamp BB it is sunflower k+1k+1. The sunflower at the end next to the lit lamp has nothing in front of it, so it does not grow that day.

Growth during the first three days of the period for one example input

You are given the initial heights of the sunflowers and the lamp schedule for the next mm days. Find the height of every sunflower after the last day.

Input

The first line contains two integers nn and mm (1n,m3000001 \le n, m \le 300\,000), the number of sunflowers and the number of days in the period.

The second line contains nn integers h1,h2,,hnh_1, h_2, \dots, h_n (1hk1091 \le h_k \le 10^9), the initial heights of the sunflowers in centimeters, from left to right.

The third line contains a string of exactly mm characters A or B. The ii-th character is the lamp that is on during day ii, counting from the first day of the period.

Output

Print one line with nn integers, the heights of the sunflowers after the last day, from left to right, separated by single spaces.