#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define inf 1e18
const int mod=1e9+7;
const int N=2e5+5;
int n,m;
int a[N];
void solve(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
}
string s;
cin>>s;
int ans=0,t=1;
for(auto i:s){
if(i=='L'){
if(t>1) t--;
}
else{
if(t<n) t++;
}
ans=(ans+a[t])%mod;
}
cout<<ans;
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int tt=1;
// cin>>tt;
while(tt--) solve();
return 0;
}
小红的数组移动(模拟)--牛客周赛 Round 42-B
最新推荐文章于 2024-07-24 15:50:22 发布