@n = gets.split(' ').map(&:to_i)
s = gets.chomp.split('')

def throw(a, b)
	temp = @n[0]
	@n[0] = @n[a]
	@n[a] = @n[5]
	@n[5] = @n[b]
	@n[b] = temp
end

s.size.times{|i|
	case s[i]
	when 'E'
		throw(3, 2)
	when 'N'
		throw(1, 4)
	when 'S'
		throw(4, 1)
	else
		throw(2, 3)
	end
}

puts @n[0]