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

public class gagarincup_dk {
	BufferedReader br;
	PrintWriter out;
	StringTokenizer stok;

	String nextToken() throws IOException {
		while (stok == null || !stok.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null) {
				return null;
			}
			stok = new StringTokenizer(s);
		}
		return stok.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	char nextChar() throws IOException {
		return (char) (br.read());
	}

	String nextLine() throws IOException {
		return br.readLine();
	}

        double a, b, c, d;
	int x, y;

	double gen(int x1, int y1,  double tek) {
		if (x == x1 && y == y1) return tek;
		if (x1 > x || y1 > y) return 0;
		if (x1 == 4 || y1 == 4) return 0;
		if (x1 + y1 + 1 == 1 || x1 + y1 + 1 == 2 || x1 + y1 + 1 == 5 ||
		    x1 + y1 + 1 == 7) {
			return gen(x1 + 1, y1, tek * a) +
			       gen(x1, y1 + 1, tek * b);
		} else {
			return gen(x1 + 1, y1, tek * c) +
			       gen(x1, y1 + 1, tek * d);
		} 
		
	}
	
	void solve() throws IOException {
		a = nextDouble();
		b = nextDouble();
		c = nextDouble();
		d = nextDouble();
		char score1, defis, score2;
		score1 = nextChar();
		defis = nextChar();
		score2 = nextChar();
		x = score1 - 48;
		y = score2 - 48;    
		out.println(gen(0, 0, 1));
	}
	void run() throws IOException {
		 br = new BufferedReader(new FileReader("gagarincup.in"));
		 out = new PrintWriter("gagarincup.out");
		// br = new BufferedReader(new InputStreamReader(System.in));
		// out = new PrintWriter(System.out);
		solve();
		br.close();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		// Localea.setDefault(Locale.US);
		new gagarincup_dk().run();
	}
}