#include<bits/stdc++.h>
using namespace std;
int n,x1,y,x2,y2,ee,ss,ww,nn,ans;
int main(){
cin>>x1>>y>>x2>>y2>>n;
for(int i=1;i<=n;i++){
char x;
cin>>x;
if(x=='e')ee++;
else if(x=='s')ss++;
else if(x=='w')ww++;
else if(x=='n')nn++;
}
// if(abs(y)!=abs(y2)){
// cout<<-1;
// return 0;
// }
// if(abs(x1)!=abs(x2)){
// cout<<-1;
// return 0;
// }
if(y2>y){
if(abs(y2-y)<nn){
cout<<-1;
}else if(abs(y2-y)>nn){
ans+=abs(y2-y);
}
}
if(y2<y){
if(abs(y2-y)<nn){
cout<<-1;
}else if(abs(y2-y)>nn){
ans+=abs(y2-y);
}
}
if(x2>x1){
if(abs(x2-x1)<nn){
cout<<-1;
}else if(abs(x2-x1)>nn){
ans+=abs(x2-x1);
}
}
if(x2<x1){
if(abs(x1-x2)<nn){
cout<<-1;
}else if(abs(x1-x2)>nn){
ans+=abs(x1-x2);
}
}
cout<<ans;
return 0;
}
80分,只有第一个测试点没过,结果调了之后,第一个过了,后面的都没过,已注释了。