import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 29);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            DINOIFinalContests solver = new DINOIFinalContests();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class DINOIFinalContests {
        int mod;
        Factorial fact;
        Combination comb;
        long[] f;
        long[] g;
        Debug debug = new Debug(true);

        public long g(int n) {
            if (n == 0) {
                return 0;
            }
            if (g[n] == -1) {
                long sum = 0;
                for (int i = 0; i < n; i++) {
                    int left = i;
                    int right = n - 1 - i;
                    //0.. left
                    //0.. right
                    long contrib = (g(left) * f(right) + g(right) * f(left)) % mod * (n - 1 + 2) % mod + f(left) * f(right) % mod * ((IntMath.sumOfInterval(0, left) +
                            IntMath.sumOfInterval(0, right)) % mod) % mod;
                    contrib = contrib % mod * comb.combination(n - 1, left) % mod;
                    sum += contrib;
                }
                g[n] = sum % mod;
            }
            return g[n];
        }

        public long f(int n) {
            if (n == 0) {
                return 1;
            }
            if (f[n] == -1) {
                long sum = 0;
                for (int i = 0; i < n; i++) {
                    int left = i;
                    int right = n - 1 - i;
                    sum += f(left) * comb.combination(n - 1, left) % mod * f(right) % mod * (n - 1 + 2) % mod;
                }
                f[n] = sum % mod;
            }
            return f[n];
        }

        public void solve(int testNumber, FastInput in, FastOutput out) {
            int n = in.readInt();
            int m = in.readInt();
            int p = in.readInt();
            mod = p;
            fact = new Factorial((int) 1e4, p);
            comb = new Combination(fact);

            f = new long[m + 1];
            g = new long[m + 1];
            Arrays.fill(f, -1L);
            Arrays.fill(g, -1L);

            long[][] dpWay = new long[n + 1][m + 1];
            long[][] dpSum = new long[n + 1][m + 1];
            dpWay[0][0] = 1;
            for (int i = 1; i <= n; i++) {
                for (int j = 0; j <= m && j <= i; j++) {
                    dpWay[i][j] = dpWay[i - 1][j];
                    dpSum[i][j] = dpSum[i - 1][j];
                    for (int k = 1; k <= j; k++) {
                        int prev = Math.max(i - k - 1, 0);
                        dpWay[i][j] += dpWay[prev][j - k] * comb.combination(j, k) % mod * f(k) % mod;
                        long local = dpSum[prev][j - k] * f(k) +
                                dpWay[prev][j - k] * g(k);
                        local = local % mod * comb.combination(j, k) % mod;
                        dpSum[i][j] += local;
                    }
                    dpWay[i][j] %= mod;
                    dpSum[i][j] %= mod;
                }
            }

            long ans = dpSum[n][m];
            debug.debug("f", f);
            debug.debug("g", g);
            debug.debug("dpWay", dpWay);
            debug.debug("dpSum", dpSum);
            out.println(ans);
        }

    }

    static class Combination implements IntCombination {
        final Factorial factorial;
        int modVal;

        public Combination(Factorial factorial) {
            this.factorial = factorial;
            this.modVal = factorial.getMod();
        }

        public Combination(int limit, int mod) {
            this(new Factorial(limit, mod));
        }

        public int combination(int m, int n) {
            if (n > m || n < 0) {
                return 0;
            }
            return (int) ((long) factorial.fact(m) * factorial.invFact(n) % modVal * factorial.invFact(m - n) % modVal);
        }

    }

    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private static final int THRESHOLD = 1 << 13;
        private final Writer os;
        private StringBuilder cache = new StringBuilder(THRESHOLD * 2);

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        private void afterWrite() {
            if (cache.length() < THRESHOLD) {
                return;
            }
            flush();
        }

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            afterWrite();
            return this;
        }

        public FastOutput append(long c) {
            cache.append(c);
            afterWrite();
            return this;
        }

        public FastOutput append(String c) {
            cache.append(c);
            afterWrite();
            return this;
        }

        public FastOutput println(long c) {
            return append(c).println();
        }

        public FastOutput println() {
            return append(System.lineSeparator());
        }

        public FastOutput flush() {
            try {
                os.append(cache);
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }

    static interface IntCombination {
    }

    static class Factorial {
        int[] fact;
        int[] inv;
        int mod;

        public int getMod() {
            return mod;
        }

        public Factorial(int[] fact, int[] inv, int mod) {
            this.mod = mod;
            this.fact = fact;
            this.inv = inv;
            fact[0] = inv[0] = 1;
            int n = Math.min(fact.length, mod);
            for (int i = 1; i < n; i++) {
                fact[i] = i;
                fact[i] = (int) ((long) fact[i] * fact[i - 1] % mod);
            }
            inv[n - 1] = BigInteger.valueOf(fact[n - 1]).modInverse(BigInteger.valueOf(mod)).intValue();
            for (int i = n - 2; i >= 1; i--) {
                inv[i] = (int) ((long) inv[i + 1] * (i + 1) % mod);
            }
        }

        public Factorial(int limit, int mod) {
            this(new int[limit + 1], new int[limit + 1], mod);
        }

        public int fact(int n) {
            return fact[n];
        }

        public int invFact(int n) {
            return inv[n];
        }

    }

    static class Debug {
        private boolean offline;
        private PrintStream out = System.err;
        static int[] empty = new int[0];

        public Debug(boolean enable) {
            offline = enable && System.getSecurityManager() == null;
        }

        public Debug debug(String name, Object x) {
            return debug(name, x, empty);
        }

        public Debug debug(String name, Object x, int... indexes) {
            if (offline) {
                if (x == null || !x.getClass().isArray()) {
                    out.append(name);
                    for (int i : indexes) {
                        out.printf("[%d]", i);
                    }
                    out.append("=").append("" + x);
                    out.println();
                } else {
                    indexes = Arrays.copyOf(indexes, indexes.length + 1);
                    if (x instanceof byte[]) {
                        byte[] arr = (byte[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof short[]) {
                        short[] arr = (short[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof boolean[]) {
                        boolean[] arr = (boolean[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof char[]) {
                        char[] arr = (char[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof int[]) {
                        int[] arr = (int[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof float[]) {
                        float[] arr = (float[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof double[]) {
                        double[] arr = (double[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof long[]) {
                        long[] arr = (long[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else {
                        Object[] arr = (Object[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    }
                }
            }
            return this;
        }

    }

    static class FastInput {
        private final InputStream is;
        private byte[] buf = new byte[1 << 13];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

    }

    static class IntMath {
        private IntMath() {
        }

        public static long sumOfInterval(long l, long r) {
            return (r + l) * (r - l + 1) / 2;
        }

    }
}


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

public class E {
	FastScanner in;
	PrintWriter out;

	int[] p;
	double[][] dpEqLess;
	double[][] dpEqLessMul;
	int maxK = 50;

	public void solve() throws IOException {
		int q = in.nextInt();
		dpEqLess = new double[maxK][q];
		for (int i = 0; i < maxK; i++) {
			dpEqLess[i][0] = 1;
		}
		p = new int[q];
		p[0] = -1;
		int cntV = 0;
		for (int i = 0; i < q; i++) {
			int type = in.nextInt();
			int v = in.nextInt() - 1;
			if (type == 1) {
				int u = ++cntV;
				p[u] = v;
				for (int j = 0; j < maxK; j++) {
					dpEqLess[j][u] = 1;
				}
				double prev = 1;
				for (int j = 0; j < maxK; j++) {
					double val = dpEqLess[j][v];
					val /= prev;
					prev = dpEqLess[j][v]*0.5 + 0.5;
					val *= (0.5 + 0.5*(j - 1 >= 0 ? dpEqLess[j - 1][u] : 0));
					dpEqLess[j][v] = val;

					v = p[v];
					u = p[u];
					if (v == -1) {
						break;
					}
				}
			} else {
				double res = 0;
				for (int j = 1; j < maxK; j++) {
					res += j * (dpEqLess[j][v] - dpEqLess[j - 1][v]);
				}
				out.println(res);
			}
		}
	}

	public void run() {
		try {
			in = new FastScanner();
			out = new PrintWriter(System.out);

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}
	}

	public static void main(String[] arg) {
		new E().run();
	}
}


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

public class F {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	static final int K = 110;
	static final int N = 500_000;

	double[][] dp = new double[N][K];
	int[] par = new int[N];

	void solve() throws IOException {
		int q = nextInt();

		for (int i = 0; i < N; i++)
			Arrays.fill(dp[i], 1);

		par[0] = -1;

		int curV = 1;

		while (q-- > 0) {
			int type = nextInt();
			int v = nextInt() - 1;
			if (type == 2) {
				double ret = 0;
				double[] ds = dp[v];
				for (int i = 0; i < ds.length; i++) {
					double prob = ds[i];
					ret += 1 - prob;
				}
				out.println(ret);
			} else {
				int u = curV++;
				par[u] = v;

				double old = dp[v][0];
				dp[v][0] *= 0.5;
				v = par[v];
				u = par[u];
				int k = 1;
				while (k < K && v != -1) {

					double nextOld = dp[v][k];
					dp[v][k] /= 0.5 * (1 + old);
					dp[v][k] *= 0.5 * (1 + dp[u][k - 1]);

					k++;
					v = par[v];
					u = par[u];
					old = nextOld;
				}

			}
		}
	}

	F() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new F();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

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

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

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


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

import static java.lang.Math.*;

public class Main implements Runnable {

	void solve() throws Exception {
		int a = sc.nextInt(), b = sc.nextInt(), m = sc.nextInt();
		int vx = sc.nextInt(), vy = sc.nextInt(), vz = sc.nextInt();
		double t = (double)m / (-vy);
		double sx = (double)a / 2, sz = 0;
		double resx = sx + vx * t;
		double resz = sz + vz * t;
		while (resx < 0 || resx > a) {
			if (resx < 0) {
				resx = -resx;
			}
			if (resx > a) {
				resx = a - (resx - a);
			}
		}
		while (resz < 0 || resz > b) {
			if (resz < 0) {
				resz = -resz;
			}
			if (resz > b) {
				resz = b - (resz - b);
			}
		}
		out.printf(Locale.US, "%.12f %.12f\n", resx, resz);
	}

	BufferedReader in;
	PrintWriter out;
	FastScanner sc;

	static Throwable uncaught;

	@Override
	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			sc = new FastScanner(in);
			solve();
		} catch (Throwable t) {
			Main.uncaught = t;
		} finally {
			out.close();
		}
	}

	public static void main(String[] args) throws Throwable {
		Thread t = new Thread(null, new Main(), "", 128 * 1024 * 1024);
		t.start();
		t.join();
		if (uncaught != null) {
			throw uncaught;
		}
	}

}

class FastScanner {

	BufferedReader reader;
	StringTokenizer strTok;

	public FastScanner(BufferedReader reader) {
		this.reader = reader;
	}

	public String nextToken() throws IOException {
		while (strTok == null || !strTok.hasMoreTokens()) {
			strTok = new StringTokenizer(reader.readLine());
		}
		return strTok.nextToken();
	}

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

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

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

}


import java.util.Scanner;

public class _38_Hit_ball {

	public static void main(String[] args) {
		Scanner scn = new Scanner(System.in);
		double x = scn.nextInt();
		double z = scn.nextInt();
	double m = scn.nextInt();
		double vx = scn.nextInt();
		double vy = scn.nextInt();
		double vz = scn.nextInt();
		double t=0;
		double inx=x/2;
		double iny=m;

		double inz=0;

       while(true){
    	   double xmin=Double.MAX_VALUE;
    	   double zmin=Double.MAX_VALUE;;
    	   if(vx<0){
    		   xmin=inx/(-vx);
    	   }else if(vx!=0){
    	    xmin=(x-inx)/(vx);}

    	   double ymin=iny/(-vy);
    	   if(vz<0){
    		   zmin=inz/(-vz);
    	   }else if(vz!=0){
    	    zmin=(z-inz)/vz;}
    	   double v=Math.min(xmin, Math.min(ymin,zmin));
    	   if(ymin==v){
    		   inx=inx+vx*v;
    		   inz=inz+vz*v;
    		   break;
    	   }else if(xmin==zmin){
    		   if(vx<0){
    			   inx=0;
    		   }else{
    		   inx=x;}
    		   if(vz<0){
    			   inz=0;
    		   }else{
    			   inz=z;
    		   }

    		   iny=iny+vy*v;
    		   vx=-vx;
    		   vz=-vz;
    	   }else if(xmin==v){
    		   if(vx<0){
    			   inx=0;
    		   }else{
    		   inx=x;}
    		   inz=inz+vz*v;
    		   iny=iny+vy*v;
    		   vx=-vx;
    	   }else{
    		   if(vz<0){
    			   inz=0;
    		   }else{
    			   inz=z;
    		   }
    		   inx=inx+v*vx;
    		   iny=iny+vy*v;
    		   vz=-vz;
    	   }

       }
       System.out.printf("%.6f ",inx);
       System.out.printf("%.6f",inz);
	}

}


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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class  Main  {

	//ArrayList<Integer> lis = new ArrayList<Integer>();
	//ArrayList<String> lis = new ArrayList<String>();
	//ArrayList<test> lis = new ArrayList<test>();
	static long sum=0;
//	static boolean f=false;
	//static String s[],r="";
	static int dx[]={1,-1,0,0};
	static int dy[]={0,0,1,-1};

public  static void main(String[] args) throws IOException {
   //googlein.txt C-small-attempt0.in
//	Scanner sc =new Scanner(new File("file.txt"));
	 Scanner sc =new Scanner(System.in);
	  //File file = new File("file.txt");
	//	PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));
	//	sc.useDelimiter("(\\s)+|[,]");

	  while(sc.hasNext()){
		   //long sum=0;
	//	  int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();
		double a=sc.nextDouble(),b=sc.nextDouble(),m=sc.nextDouble();
		double x=sc.nextDouble(),y=abs(sc.nextDouble()),z=sc.nextDouble();
		double ax=0,az=0;
		double t=m/abs(y);
		double xx=(abs(x)*t-a/2);

		if(xx<0)ax=x*t+a/2;
		else{
		 if((int)(xx/a)%2==0){ if(0<x)ax=a-(xx-(int)(xx/a)*a);else ax=xx-(int)(xx/a)*a; }
		 else 	{ if(x<0)ax=a-(xx-(int)(xx/a)*a);else ax=xx-(int)(xx/a)*a; }
		}
		double zz=t*z;
		if( (int)(zz/b)%2==0 ){ az=zz-(int)(zz/b)*b; }
		else az=b-(zz-(int)(zz/b)*b);
		//db(t,xx,zz,(int)(xx/a)%2);

		System.out.println(ax+" "+az);

	  }

}

	// db("Case #"+(k)+": "+c);
	 //	pw.println("Case #"+(k)+": "+c);

	 	//pw.flush();
	 	//pw.close();

    static void db(Object... os){
	         System.err.println(Arrays.deepToString(os));

	}

}

/*class P implements Comparable<P>{
    int v,vv,t;
	P(int v,int vv,int t){
		this.v=v;
	    this.vv=vv;
	    this.t=t;
	}
	  public int compareTo(P x){
          return t-x.t;
	   }

}*/


import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Crash
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		OutputWriter out = new OutputWriter(outputStream);
		TaskD solver = new TaskD();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskD {
	private int sign(double x) {
		if (Math.abs(x) < 1e-8) return 0;
		return (x > 0) ? 1 : -1;
	}
	public void solve(int testNumber, InputReader in, OutputWriter out) {
		double a = in.readDouble();
		double b = in.readDouble();
		double m = in.readDouble();
		double vx = in.readDouble();
		double vy = in.readDouble();
		double vz = in.readDouble();
		double x = a / 2, y = m, z = 0;
		while (true) {
			double minT = -y / vy;
			int flag = 0;
			if (sign(vx) > 0) {
				double t = (a - x) / vx;
				if (sign(t - minT) < 0) {
					minT = t;
					flag = 1;
				}
			}
			if (sign(vx) < 0) {
				double t = -x / vx;
				if (sign(t - minT) < 0) {
					minT = t;
					flag = 2;
				}
			}
			if (sign(vz) > 0) {
				double t = (b - z) / vz;
				if (sign(t - minT) < 0) {
					minT = t;
					flag = 3;
				}
			}
			if (sign(vz) < 0) {
				double t = -z / vz;
				if (sign(t - minT) < 0) {
					minT = t;
					flag = 4;
				}
			}
			x += minT * vx;
			y += minT * vy;
			z += minT * vz;
			if (flag == 0) break;
			if (flag == 1 || flag == 2) vx *= -1;
			if (flag == 3 || flag == 4) vz *= -1;
		}
		out.printDouble(x, 10);
		out.print(" ");
		out.printDouble(z, 10);
		out.printLine();
	}
}

class InputReader {
	private InputStream stream;
	private byte[] buf = new byte[1000];
	private int curChar;
	private int numChars;

	public InputReader(InputStream stream) {
		this.stream = stream;
	}

	private int read() {
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	public double readDouble() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-') {
			sgn = -1;
			c = read();
		}
		double res = 0;
		while (!isSpaceChar(c) && c != '.') {
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		}
		if (c == '.') {
			c = read();
			double m = 1;
			while (!isSpaceChar(c)) {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				m /= 10;
				res += (c - '0') * m;
				c = read();
			}
		}
		return res * sgn;
	}

	private boolean isSpaceChar(int c) {
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}
}

class OutputWriter {
	private final PrintWriter writer;

	public OutputWriter(OutputStream outputStream) {
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
	}

	public OutputWriter(Writer writer) {
		this.writer = new PrintWriter(writer);
	}

	public void print(Object...objects) {
		for (int i = 0; i < objects.length; i++) {
			if (i != 0)
				writer.print(' ');
			writer.print(objects[i]);
		}
	}

	public void printDouble(double x, int precision) {
		writer.printf("%." + precision + "f", x);
	}

	public void printLine(Object...objects) {
		print(objects);
		writer.println();
	}

	public void close() {
		writer.close();
	}
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class cf203d {
  public static void main(String[] args) {
    FastIO in = new FastIO(), out = in;
    double a = in.nextDouble();
    double b = in.nextDouble();
    double m = in.nextDouble();
    double vx = in.nextDouble();
    double vy = in.nextDouble();
    double vz = in.nextDouble();
    double t = m / -vy;
    double x0 = a/2 + vx*t;
    double z0 = vz*t;
    while(x0 < 0 || x0 > a) {
      if(x0 < 0) x0 = -x0;
      if(x0 > a) x0 = 2*a-x0;
    }
    while(z0 < 0 || z0 > b) {
      if(z0 < 0) z0 = -z0;
      if(z0 > b) z0 = 2*b-z0;
    }
    out.printf("%.10f %.10f%n", x0,z0);
    out.close();
  }
  static boolean ok(int x) {
    while(x > 0) {
      int d = x%10;
      if(d != 1 && d != 4) return false;
      x /= 10;
    }
    return true;
  }
  static class FastIO extends PrintWriter {
    BufferedReader br;
    StringTokenizer st;

    public FastIO() {
      this(System.in,System.out);
    }
    public FastIO(InputStream in, OutputStream out) {
      super(new BufferedWriter(new OutputStreamWriter(out)));
      br = new BufferedReader(new InputStreamReader(in));
      scanLine();
    }
    public void scanLine() {
      try {
        st = new StringTokenizer(br.readLine().trim());
      } catch(Exception e) {
        throw new RuntimeException(e.getMessage());
      }
    }
    public int numTokens() {
      if(!st.hasMoreTokens()) {
        scanLine();
        return numTokens();
      }
      return st.countTokens();
    }
    public String next() {
      if(!st.hasMoreTokens()) {
        scanLine();
        return next();
      }
      return st.nextToken();
    }
    public double nextDouble() {
      return Double.parseDouble(next());
    }
    public long nextLong() {
      return Long.parseLong(next());
    }
    public int nextInt() {
      return Integer.parseInt(next());
    }
  }
}


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

public class Main {
  BufferedReader br;
  int a, b, m, vx, vy, vz;
  BigDecimal t, x, z, x0, z0;

  public void go() throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    String[] ss = br.readLine().split(" ");
    a = Integer.parseInt(ss[0]);
    b = Integer.parseInt(ss[1]);
    m = Integer.parseInt(ss[2]);
    ss = br.readLine().split(" ");
    vx = Integer.parseInt(ss[0]);
    vy = Integer.parseInt(ss[1]);
    vz = Integer.parseInt(ss[2]);

    t = new BigDecimal(-m).divide(new BigDecimal(vy), 50, RoundingMode.UP);
    x = new BigDecimal(a).divide(new BigDecimal(2), 50, RoundingMode.UP).add(new BigDecimal(vx).multiply(t));
    z = new BigDecimal(vz).multiply(t);

    if (x.compareTo(BigDecimal.ZERO) != -1) {
      x0 = x.divideAndRemainder(new BigDecimal(2*a))[1];
      if (x0.intValue() >= a)
        x0 = new BigDecimal(2*a).subtract(x0);
    }
    else {
      x = x.negate();
      x0 = x.divideAndRemainder(new BigDecimal(2*a))[1];
      if (x0.intValue() >= a)
        x0 = new BigDecimal(2*a).subtract(x0);
    }

    z0 = z.divideAndRemainder(new BigDecimal(2*b))[1];
    if (z0.intValue() > b)
      z0 = new BigDecimal(2*b).subtract(z0);

    System.out.format("%.10f %.10f%n", x0.doubleValue(), z0.doubleValue());
  }

  public static void main(String[] args) throws Exception {
    new Main().go();
  }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        static final int INF = (int) 1e9;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            int nk = 0;
            int nv = 0;
            int no = 0;
            int[] kpos = new int[n];
            int[] vpos = new int[n];
            int[] opos = new int[n];
            int[] snk = new int[n + 1];
            int[] snv = new int[n + 1];
            int[] sno = new int[n + 1];
            for (int i = 0; i < n; ++i) {
                char ch = s.charAt(i);
                if (ch == 'V') {
                    vpos[nv++] = i;
                } else if (ch == 'K') {
                    kpos[nk++] = i;
                } else {
                    opos[no++] = i;
                }
                snk[i + 1] = nk;
                snv[i + 1] = nv;
                sno[i + 1] = no;
            }
            int[][][][] best = new int[2][nk + 1][nv + 1][no + 1];
            for (int[][][] x : best) for (int[][] y : x) for (int[] z : y) Arrays.fill(z, INF);
            best[0][0][0][0] = 0;
            for (int k = 0; k <= nk; ++k) {
                for (int v = 0; v <= nv; ++v) {
                    for (int o = 0; o <= no; ++o) {
                        for (int hv = 0; hv < 2; ++hv) {
                            int cur = best[hv][k][v][o];
                            if (k < nk && hv == 0) {
                                best[0][k + 1][v][o] = Math.min(best[0][k + 1][v][o], cur + Math.max(snv[kpos[k]] - v,0) + Math.max(sno[kpos[k]] - o,0));
                            }
                            if (v < nv) {
                                best[1][k][v + 1][o] = Math.min(best[1][k][v + 1][o], cur + Math.max(snk[vpos[v]] - k,0) + Math.max(sno[vpos[v]] - o,0));
                            }
                            if (o < no) {
                                best[0][k][v][o + 1] = Math.min(best[0][k][v][o + 1], cur + Math.max(snv[opos[o]] - v,0) + Math.max(snk[opos[o]] - k,0));
                            }
                        }
                    }
                }
            }
            out.println(Math.min(best[0][nk][nv][no], best[1][nk][nv][no]) );
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


//package Round_405;

import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;

public class E {

	public E() {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
		ArrayList<Integer> V = new ArrayList<Integer>(), K = new ArrayList<Integer>(), X = new ArrayList<Integer>();
		char[] s = sc.next().toCharArray();
		for (int i = 0; i < n; i++)
			if (s[i] == 'V')
				V.add(i);
			else if (s[i] == 'K')
				K.add(i);
			else
				X.add(i);
		long[][][][] dp = new long[n + 1][n + 1][n + 1][2];
		for (int i = 0; i <= n; i++)
			for (int j = 0; j <= n; j++)
				for (int k = 0; k <= n; k++)
					for (int d = 0; d < 2; d++)
						dp[i][j][k][d] = Integer.MAX_VALUE;
		dp[0][0][0][0] = 0;
		for (int v = 0; v <= V.size(); v++) {
			for (int k = 0; k <= K.size(); k++) {
				for (int x = 0; x <= X.size(); x++) {
					for (int t = 0; t < 2; t++) {
						long cur = dp[v][k][x][t];
						int m1 = 0, m2 = 0, m3 = 0;
						if (v < V.size()) {
							int vv = V.get(v);
							m1 = rem(V, v, vv) + rem(K, k, vv) + rem(X, x, vv);
							dp[v + 1][k][x][1] = Math.min(dp[v + 1][k][x][1],
									cur + m1);
						}
						if (k < K.size() && t == 0) {
							int kk = K.get(k);
							m2 = rem(V, v, kk) + rem(K, k, kk) + rem(X, x, kk);
							dp[v][k + 1][x][0] = Math.min(dp[v][k + 1][x][0],
									cur + m2);
						}
						if (x < X.size()) {
							int xx = X.get(x);
							m3 = rem(V, v, xx) + rem(K, k, xx) + rem(X, x, xx);
							dp[v][k][x + 1][0] = Math.min(dp[v][k][x + 1][0],
									cur + m3);
						}
					}
				}
			}
		}
		long ret = Long.MAX_VALUE;
		for (int i = 0; i < 2; i++)
			ret = Math.min(ret, dp[V.size()][K.size()][X.size()][i]);
		out.println(ret);
		sc.close();
		out.close();
	}

	private int rem(ArrayList<Integer> arr, int ind, int val) {
		int cnt = 0;
		for (int i = ind; i < arr.size() && arr.get(i) < val; i++)
			cnt++;
		return cnt;
	}

	public static void main(String[] args) {
		new E();
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

/**
 * @author Pavel Mavrin
 */
public class C {

    private void solve() throws IOException {
        int n = nextInt();
        String s = next();
        int[][] a = new int[3][n];
        int[] na = new int[3];
        for (int i = 0; i < n; i++) {
            if (s.charAt(i) == 'V') {
                a[0][na[0]++] = i;
            } else if (s.charAt(i) == 'K') {
                a[1][na[1]++] = i;
            } else {
                a[2][na[2]++] = i;
            }
        }
        int[][][][] d = new int[na[0] + 1][na[1] + 1][na[2] + 1][2];
        for (int[][][] ints : d) {
            for (int[][] anInt : ints) {
                for (int[] ints1 : anInt) {
                    Arrays.fill(ints1, Integer.MAX_VALUE);
                }
            }
        }
        int[][][] p = new int[3][3][n];
        for (int x = 0; x < 3; x++) {
            for (int y = 0; y < 3; y++) if (x != y) {
                for (int i = 0; i < na[x]; i++) {
                    for (int j = 0; j < na[y]; j++) {
                        if (a[y][j] < a[x][i]) p[x][y][i]++;
                    }
                }
            }
        }
//        for (int x = 0; x < 3; x++) {
//            for (int i = 0; i < na[x]; i++) {
//                System.out.println(x + " " + i + " " + p[x][i]);
//            }
//        }
        d[0][0][0][1] = 0;
        for (int i = 0; i <= na[0]; i++) {
            for (int j = 0; j <= na[1]; j++) {
                for (int k = 0; k <= na[2]; k++) {
                    for (int q = 0; q < 2; q++) if (d[i][j][k][q] != Integer.MAX_VALUE) {
//                        System.out.println(i + " " + j + " " + k + " " + q + " " + d[i][j][k][q]);
                        if (i < na[0]) {
                            d[i + 1][j][k][0] = Math.min(d[i + 1][j][k][0], d[i][j][k][q] + Math.max(p[0][1][i] - j, 0) + Math.max(p[0][2][i] - k, 0));
                        }
                        if (j < na[1] && q == 1) {
                            d[i][j + 1][k][1] = Math.min(d[i][j + 1][k][1], d[i][j][k][q] + Math.max(p[1][0][j] - i, 0) + Math.max(p[1][2][j] - k, 0));
                        }
                        if (k < na[2]) {
                            d[i][j][k + 1][1] = Math.min(d[i][j][k + 1][1], d[i][j][k][q] + Math.max(p[2][0][k] - i, 0) + Math.max(p[2][1][k] - j, 0));
                        }
                    }
                }
            }
        }
        out.println(Math.min(d[na[0]][na[1]][na[2]][0], d[na[0]][na[1]][na[2]][1]));
    }

    // ------------------

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st;
    PrintWriter out = new PrintWriter(System.out);

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

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

    public static void main(String[] args) throws IOException {
        new C().run();
    }

    private void run() throws IOException {
        solve();
        out.close();
    }

}


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

public class DStress2 {

	void solve() {
//		stress();
		 int n = in.nextInt();
		 String s = in.nextToken();
		 out.println(solve(s.toCharArray()));
	}

	void stress() {
		Random rng = new Random(123);
		for (int IT = 0; IT < 10000; IT++) {
			int n = 1 + rng.nextInt(12);
			char[] c = new char[n];
			for (int i = 0; i < n; i++) {
				c[i] = "AVK".charAt(rng.nextInt(3));
			}

			int ans1 = solve(c);
			int ans2 = stupid(c);
			if (ans1 != ans2) {
				System.err.println(IT + " " + ans1 + " " + ans2 + " " + new String(c));
				break;
			}
		}
	}

	int INF = Integer.MAX_VALUE / 3;

	int stupid(char[] s) {
		String st = new String(s);
		Queue<String> q = new ArrayDeque<>();
		Map<String, Integer> dist = new HashMap<>();
		q.add(st);
		dist.put(st, 0);
		while (!q.isEmpty()) {
			st = q.poll();
			int cur = dist.get(st);
			if (!st.contains("VK")) {
				return cur;
			}

			for (int pos = 0; pos < st.length() - 1; pos++) {
				String next = st.substring(0, pos) + st.charAt(pos + 1) + st.charAt(pos) + st.substring(pos + 2);
				if (!dist.containsKey(next)) {
					dist.put(next, cur + 1);
					q.add(next);
				}
			}
		}
		return 0;
	}

	int solve(char[] s) {
		List<Integer> vPos = new ArrayList<>(), kPos = new ArrayList<>(), otherPos = new ArrayList<>();

		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'V') {
				vPos.add(i);
			} else if (s[i] == 'K') {
				kPos.add(i);
			} else {
				otherPos.add(i);
			}
		}

		int[][][][] dp = new int[2][vPos.size() + 1][kPos.size() + 1][otherPos.size() + 1];

		for (int[][][] i : dp) {
			for (int[][] j : i) {
				for (int[] k : j) {
					Arrays.fill(k, INF);
				}
			}
		}
		dp[0][0][0][0] = 0;

		for (int V = 0; V <= vPos.size(); V++) {
			for (int K = 0; K <= kPos.size(); K++) {
				for (int O = 0; O <= otherPos.size(); O++) {
					for (int last = 0; last < 2; last++) {
						int cur = dp[last][V][K][O];
						if (cur == INF) {
							continue;
						}
						if (V < vPos.size()) {
							dp[1][V + 1][K][O] = Math.min(dp[1][V + 1][K][O], cur + count(vPos.get(V), K, kPos) + count(vPos.get(V), O, otherPos));
						}
						if (K < kPos.size() && last == 0) {
							dp[0][V][K + 1][O] = Math.min(dp[0][V][K + 1][O], cur + count(kPos.get(K), V, vPos) + count(kPos.get(K), O, otherPos));
						}
						if (O < otherPos.size()) {
							dp[0][V][K][O + 1] = Math.min(dp[0][V][K][O + 1], cur + count(otherPos.get(O), V, vPos) + count(otherPos.get(O), K, kPos));
						}
					}
				}
			}
		}

		return Math.min(dp[0][vPos.size()][kPos.size()][otherPos.size()], dp[1][vPos.size()][kPos.size()][otherPos.size()]);
	}

	private int count(Integer integer, int start, List<Integer> kPos) {
		int ans = 0;
		for (int i = start; i < kPos.size(); i++) {
			if (kPos.get(i) < integer) {
				ans++;
			}
		}
		return ans;
	}

	FastScanner in;
	PrintWriter out;

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public String nextToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
				}
			}
			return st.nextToken();
		}

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

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

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

	public static void main(String[] args) {
		new DStress2().run();
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public int cv;
        public int ck;
        public int cs;
        public int[][] freq;
        public ArrayList<Integer>[] pos;
        public int[][][][] dp;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt();
            char[] c = in.next().toCharArray();
            cv = 0;
            ck = 0;
            cs = 0;
            freq = new int[n + 1][3];
            pos = new ArrayList[3];
            for (int i = 0; i < 3; i++) pos[i] = new ArrayList<>();
            int idx = 0;
            for (char x : c) {
                System.arraycopy(freq[idx], 0, freq[idx + 1], 0, 3);
                idx++;
                if (x == 'V') {
                    freq[idx][0]++;
                    cv++;
                    pos[0].add(idx);
                } else if (x == 'K') {
                    freq[idx][1]++;
                    ck++;
                    pos[1].add(idx);
                } else {
                    freq[idx][2]++;
                    cs++;
                    pos[2].add(idx);
                }
            }
            dp = new int[cv + 1][ck + 1][cs + 1][3];
            for (int[][][] x : dp) for (int[][] y : x) for (int[] z : y) Arrays.fill(z, -1);
            out.println(dfs(0, 0, 0, 2));
        }

        public int dfs(int tv, int tk, int ts, int last) {
            if (tv == cv && tk == ck && ts == cs) {
                return 0;
            }
            if (dp[tv][tk][ts][last] != -1) return dp[tv][tk][ts][last];
            int ret = 1 << 29;
            if (tv < cv) {
                int p = pos[0].get(tv);
                int move = Math.max(freq[p][0] - tv, 0) + Math.max(freq[p][1] - tk, 0) + Math.max(freq[p][2] - ts, 0) - 1;
                ret = Math.min(ret, dfs(tv + 1, tk, ts, 0) + move);
            }
            if (tk < ck && last != 0) {
                int p = pos[1].get(tk);
                int move = Math.max(freq[p][0] - tv, 0) + Math.max(freq[p][1] - tk, 0) + Math.max(freq[p][2] - ts, 0) - 1;
                ret = Math.min(ret, dfs(tv, tk + 1, ts, 1) + move);
            }
            if (ts < cs) {
                int p = pos[2].get(ts);
                int move = Math.max(freq[p][0] - tv, 0) + Math.max(freq[p][1] - tk, 0) + Math.max(freq[p][2] - ts, 0) - 1;
                ret = Math.min(ret, dfs(tv, tk, ts + 1, 2) + move);
            }
            return dp[tv][tk][ts][last] = ret;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (this.numChars == -1) {
                throw new InputMismatchException();
            } else {
                if (this.curChar >= this.numChars) {
                    this.curChar = 0;

                    try {
                        this.numChars = this.stream.read(this.buf);
                    } catch (IOException var2) {
                        throw new InputMismatchException();
                    }

                    if (this.numChars <= 0) {
                        return -1;
                    }
                }

                return this.buf[this.curChar++];
            }
        }

        public int nextInt() {
            int c;
            for (c = this.read(); isSpaceChar(c); c = this.read()) {
                ;
            }

            byte sgn = 1;
            if (c == 45) {
                sgn = -1;
                c = this.read();
            }

            int res = 0;

            while (c >= 48 && c <= 57) {
                res *= 10;
                res += c - 48;
                c = this.read();
                if (isSpaceChar(c)) {
                    return res * sgn;
                }
            }

            throw new InputMismatchException();
        }

        public String next() {
            int c;
            while (isSpaceChar(c = this.read())) {
                ;
            }

            StringBuilder result = new StringBuilder();
            result.appendCodePoint(c);

            while (!isSpaceChar(c = this.read())) {
                result.appendCodePoint(c);
            }

            return result.toString();
        }

        public static boolean isSpaceChar(int c) {
            return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }
}


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

public class C {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	void submit() throws IOException {
		nextInt();
		String s = nextToken();
		out.println(fast(s));
//		out.println(slow(s));
	}

	static final String BAD = "VK";

	String prepare(String s) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < s.length(); i++) {
			char c = s.charAt(i);
			if (BAD.indexOf(c) != -1) {
				sb.append(c);
			} else {
				sb.append('A');
			}
		}
		return sb.toString();
	}

	int slow(String s) {
		s = prepare(s);
		HashMap<String, Integer> map = new HashMap<>();
		ArrayDeque<String> que = new ArrayDeque<>();
		que.add(s);
		map.put(s, 0);

		while (true) {
			s = que.poll();
			int curD = map.get(s);
			if (s.indexOf(BAD) == -1) {
				// System.err.println(s);
				return curD;
			}

			for (int i = 0; i < s.length() - 1; i++) {
				String nxt = swap(s, i, i + 1);
				if (nxt != null && !map.containsKey(nxt)) {
					map.put(nxt, curD + 1);
					que.add(nxt);
				}
			}
		}
	}

	String swap(String s, int i, int j) {
		if (s.charAt(i) == s.charAt(j)) {
			return null;
		}
		char[] buf = s.toCharArray();
		char tmp = buf[i];
		buf[i] = buf[j];
		buf[j] = tmp;
		return new String(buf);
	}

	static final String STR = "VKA";

	int fast(String s) {

		s = prepare(s);

		int n = s.length();

		int[] a = new int[n];
		int[][] pos = new int[3][n];
		int[] sz = new int[3];

		int[][][] cntHere = new int[3][n][3];

		int[][] pref = new int[n + 1][];

		pref[0] = new int[] { 0, 0, 0 };

		for (int i = 0; i < n; i++) {
			a[i] = STR.indexOf(s.charAt(i));
			int c = a[i];
			cntHere[c][sz[c]] = pref[i].clone();
			pos[c][sz[c]++] = i;

			pref[i + 1] = pref[i].clone();
			pref[i + 1][c]++;
		}

		int[][][][] dp = new int[2][sz[0] + 1][sz[1] + 1][sz[2] + 1];

		for (int i = 0; i < 2; i++) {
			for (int j0 = 0; j0 <= sz[0]; j0++) {
				for (int j1 = 0; j1 <= sz[1]; j1++) {
					Arrays.fill(dp[i][j0][j1], INF);
				}
			}
		}

		int ans = INF;

		dp[0][0][0][0] = 0;
		for (int j0 = 0; j0 <= sz[0]; j0++) {
			for (int j1 = 0; j1 <= sz[1]; j1++) {
				for (int j2 = 0; j2 <= sz[2]; j2++) {
					for (int last = 0; last < 2; last++) {
						//
						// if (j0 == 2 && j1 == 0 && j2 == 1) {
						// System.err.println(dp[last][j0][j1][j2]);
						// }

						int idx = j0 + j1 + j2;
						int curVal = dp[last][j0][j1][j2];
						if (curVal == INF) {
							continue;
						}

						if (idx == n) {
							ans = Math.min(ans, curVal);
							continue;
						}

						if (j0 < sz[0]) {
							int cost = Math.max(j1 - cntHere[0][j0][1], 0)
									+ Math.max(j2 - cntHere[0][j0][2], 0);
							dp[1][j0 + 1][j1][j2] = Math.min(
									dp[1][j0 + 1][j1][j2], curVal + cost);
						}

						if (j1 < sz[1] && last == 0) {
							int cost = Math.max(j0 - cntHere[1][j1][0], 0)
									+ Math.max(j2 - cntHere[1][j1][2], 0);
							dp[0][j0][j1 + 1][j2] = Math.min(
									dp[0][j0][j1 + 1][j2], curVal + cost);
						}

						if (j2 < sz[2]) {
							int cost = Math.max(j0 - cntHere[2][j2][0], 0)
									+ Math.max(j1 - cntHere[2][j2][1], 0);
							dp[0][j0][j1][j2 + 1] = Math.min(
									dp[0][j0][j1][j2 + 1], curVal + cost);
						}
					}
				}
			}
		}

		return ans;
	}

	static final int INF = 1_000_000;

	static final Random rng = new Random();

	String genStr() {
		int n = rng.nextInt(15) + 1;
		// int n = 6;
		char[] buf = new char[n];
		for (int i = 0; i < n; i++) {
			buf[i] = STR.charAt(rng.nextInt(3));
		}
		return new String(buf);
	}

	void stress() {
		for (int tst = 0;; tst++) {
			String s = genStr();
			int fast = fast(s);
			int slow = slow(s);
			if (fast != slow) {
				System.err.println(s);
				System.err.println(fast);
				System.err.println(slow);
				throw new AssertionError();
			}
			System.err.println(tst);
		}
	}

	C() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		submit();
		// stress();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new C();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

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

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

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


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

public class J implements Runnable {

    private static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

    private BufferedReader in;
    private PrintWriter out;
    private StringTokenizer tok = new StringTokenizer("");

    private void init() throws FileNotFoundException {
        Locale.setDefault(Locale.US);
        String fileName = "";
        if (ONLINE_JUDGE && fileName.isEmpty()) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            if (fileName.isEmpty()) {
                in = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            } else {
                in = new BufferedReader(new FileReader(fileName + ".in"));
                out = new PrintWriter(fileName + ".out");
            }
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());

        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    int[] readIntArray(int size) throws IOException {
        int[] a = new int[size];
        for (int i = 0; i < size; i++) {
            a[i] = readInt();
        }
        return a;
    }

    public static void main(String[] args) {
        //new Thread(null, new _Solution(), "", 128 * (1L << 20)).start();
        new J().run();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    @Override
    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            init();
            solve();
            out.close();
            time();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(-1);
        }
    }

    int[][][][] dp;
    char[] s;
    int INF = 10000000;

    int count(char[] s, char target, int v, int k, int x) {
        int answer = 0;
        for (char c : s) {
            if (c == 'V') {
                v--;
                if (v == 0 && target == 'V') return answer;
                if (v < 0) answer++;
            }
            if (c == 'K') {
                k--;
                if (k == 0 && target == 'K') return answer;
                if (k < 0) answer++;
            }
            if (c == 'X') {
                x--;
                if (x == 0 && target == 'X') return answer;
                if (x < 0) answer++;
            }
        }
        throw new RuntimeException();
    }

    private void solve() throws IOException {
        int n = readInt();
        s = readString().toCharArray();
        int vcnt = 0, kcnt = 0, xcnt = 0;
        for (int i = 0; i < s.length; i++) {
            if (s[i] == 'V') {
                vcnt++;
                continue;
            }
            if (s[i] == 'K') {
                kcnt++;
                continue;
            }
            xcnt++;
            s[i] = 'X';
        }
        dp = new int[vcnt + 1][kcnt + 1][xcnt + 1][3];
        for (int[][][] x : dp) {
            for (int[][] xx : x) {
                for (int[] xxx : xx) {
                    Arrays.fill(xxx, INF);
                }
            }
        }
        dp[0][0][0][0] = dp[0][0][0][1] = dp[0][0][0][2] = 0;
        //V,K,X
        for (int v = 0; v <= vcnt; v++) {
            for (int k = 0; k <= kcnt; k++) {
                for (int x = 0; x <= xcnt; x++) {
                    int rv = v + 1 <= vcnt ? count(s, 'V', v + 1, k, x) : 0;
                    int rk = k + 1 <= kcnt ? count(s, 'K', v, k + 1, x) : 0;
                    int rx = x + 1 <= xcnt ? count(s, 'X', v, k, x + 1) : 0;

                    for (int now = 0; now < 3; now++) {
                        if (v + 1 <= vcnt) dp[v + 1][k][x][0] = Math.min(dp[v + 1][k][x][0], dp[v][k][x][now] + rv);
                        if (now != 0 && k + 1 <= kcnt) dp[v][k + 1][x][1] = Math.min(dp[v][k + 1][x][1], dp[v][k][x][now] + rk);
                        if (x + 1 <= xcnt) dp[v][k][x + 1][2] = Math.min(dp[v][k][x + 1][2], dp[v][k][x][now] + rx);
                    }
                }
            }
        }
        int res = INF;
        for (int i = 0; i < 3; i++) {
            res = Math.min(res, dp[vcnt][kcnt][xcnt][i]);
        }
        out.println(res);

    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author niquefa_diego
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            char[] s = in.next().toCharArray();
            int c[] = new int[3];
            int pos[][] = new int[3][n];
            for (int i = 0; i < n; ++i) {
                int x = s[i] == 'K' ? 0 : (s[i] == 'V' ? 1 : 2);
                pos[x][c[x]++] = i;
            }

            int dp[][][][] = new int[2][c[0] + 1][c[1] + 1][c[2] + 1];
            for (int[][][] x : dp) for (int[][] y : x) for (int[] z : y) Arrays.fill(z, Integer.MAX_VALUE / 2);
            dp[0][0][0][0] = 0;
            for (int i0 = 0; i0 <= c[0]; ++i0)
                for (int i1 = 0; i1 <= c[1]; ++i1)
                    for (int i2 = 0; i2 <= c[2]; ++i2)
                        for (int isLast1 = 0; isLast1 < 2; ++isLast1) {

                            int cur = dp[isLast1][i0][i1][i2];
                            if (i0 < c[0] && isLast1 == 0) {
                                int swaps = 0, pos0 = pos[0][i0];
                                for (int i = i1; i < c[1] && pos[1][i] < pos0; ++i) swaps++;
                                for (int i = i2; i < c[2] && pos[2][i] < pos0; ++i) swaps++;
                                dp[0][i0 + 1][i1][i2] = Math.min(dp[0][i0 + 1][i1][i2], cur + swaps);
                            }

                            if (i1 < c[1]) {
                                int swaps = 0, pos1 = pos[1][i1];
                                for (int i = i0; i < c[0] && pos[0][i] < pos1; ++i) swaps++;
                                for (int i = i2; i < c[2] && pos[2][i] < pos1; ++i) swaps++;
                                dp[1][i0][i1 + 1][i2] = Math.min(dp[1][i0][i1 + 1][i2], cur + swaps);
                            }

                            if (i2 < c[2]) {
                                int swaps = 0, pos2 = pos[2][i2];
                                for (int i = i0; i < c[0] && pos[0][i] < pos2; ++i) swaps++;
                                for (int i = i1; i < c[1] && pos[1][i] < pos2; ++i) swaps++;
                                dp[0][i0][i1][i2 + 1] = Math.min(dp[0][i0][i1][i2 + 1], cur + swaps);
                            }

                        }

            out.println(Math.min(dp[0][c[0]][c[1]][c[2]], dp[1][c[0]][c[1]][c[2]]));
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer = null;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.TreeSet;

public final class CF_114_E{
	static boolean verb=true;
	static void log(Object X){if (verb) System.err.println(X);}
	static void log(Object[] X){if (verb) {for (Object U:X) System.err.print(U+" ");System.err.println("");}}
	static void log(int[] X){if (verb) {for (int U:X) System.err.print(U+" ");System.err.println("");}}
	static void logWln(Object X){if (verb) System.err.print(X);}
	static void info(Object o){	System.out.println(o);}
	static void output(Object o){outputWln(""+o+"\n");	}
	static void outputWln(Object o){try {out.write(""+ o);} catch (Exception e) {}}

	static int MX=Integer.MAX_VALUE;

	static boolean solve(long a,long b){
		//log("a:"+a+" b:"+b);

		if (a==0 || b==0)
			return false;
		if (a==b)
			return true;
		if (a>b){
			long c=a;
			a=b;
			b=c;
		}
		if (b%a==0)
			return true;

		boolean op=solve(a,b%a);
		if (!op)
			return true;

		long ob=b;
		if (a+1<b/a)
			ob=b%(a*(a+1));
		if (ob!=b) {
			//log("case 1");
			if (ob>0)
			return solve(a,ob);
			ob=a*(a+1);
			return solve(a,ob);
		}
		//log("case 2");
		if (b/a<a){
			// we can only do a succession of sub
			// obviousy b%a is a losing position for us..
			// how long before we go there ??
			long div=b/a;
			if (div%2==1)
				return false;
			return true;

		}
		//log("case 3");
		long aa=1;
		loop:while (aa<=b/a){
			aa*=a;
			//log("aa:"+aa);
			if (!solve(b-aa,a))
				return true;
		}
		return false;

	}

	static void check(){
		log("checking");
		for (int x=1;x<100;x++)
			for (int y=3;y<x;y++){
				boolean b=solve(x,y);
				int xx=x%(y*(y+1));
				if (xx!=0){
				boolean c=solve(x%(y*(y+1)),y);
				if (b!=c){
					log("Error "+x+" "+y);
					log(b);
					log(c);
					log(x+" "+y);
					log(x%(y*(y+1))+" "+y);
					return;
				}
				}
			}
		log("done");
	}

	static void test(){
		int y=10;
		for (int x=1;x<200;x++) {
			boolean b=solve(x,y);
			if (!b)
				log(x+" "+y);

		}
		//for (int x=1;x<20;x++)
		//	for (int y=1;y<x;y++)
		//		log(x+" "+y+" >> "+solve(x,y));
	}

	// Global vars
	static BufferedWriter out;
	static InputReader reader;

	static int MAX=201;

	static void process() throws Exception {

		//check();
		//test();

		out = new BufferedWriter(new OutputStreamWriter(System.out));
		reader=new InputReader(System.in);

		int T=reader.readInt();
		for (int t=0;t<T;t++){
		long a=reader.readLong();
		long b=reader.readLong();
		log(a+" "+b);
		boolean w=solve(a,b);
		String res="Second";
		if (w)
			res="First";
		output(res);
		}

		try {
			out.close();
		}
		catch (Exception e){}

	}

	public static void main(String[] args) throws Exception {
		process();

	}

	static final class InputReader {
		private final InputStream stream;
		private final byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		private int read() throws IOException {
			if (curChar >= numChars) {
				curChar = 0;
				numChars = stream.read(buf);
				if (numChars <= 0) {
					return -1;
				}
			}
			return buf[curChar++];
		}

		public final String readString() throws IOException {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res=new StringBuilder();
			do {
				res.append((char)c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public final int readInt() throws IOException {
			int c = read();
			boolean neg=false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d=(char)c;
			//log("d:"+d);
			if (d=='-') {
				neg=true;
				c = read();
			}
			int res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			//log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		public final long readLong() throws IOException {
			int c = read();
			boolean neg=false;
			while (isSpaceChar(c)) {
				c = read();
			}
			char d=(char)c;
			//log("d:"+d);
			if (d=='-') {
				neg=true;
				c = read();
			}
			long res = 0;
			do {
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			//log("res:"+res);
			if (neg)
				return -res;
			return res;

		}

		private boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
	}

}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.math.BigInteger;
import java.util.*;

public class popo {

    public static boolean prime[];
    public static ArrayList[] ad=new ArrayList[2555];
    public static ArrayList<Long> xor1,xor2;
    static int []min;
    static char [][]grid;
    static int []dx = {0,0,-1,1};
    static int []dy = {-1,1,0,0};
    static int []dx8 = {1,1,1,0,-1,-1,-1,0};
    static int []dy8 = {1,0,-1,-1,-1,0,1,1};
    static ArrayList<Point> aa;

    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int t = in.nextInt();
        while (t-->0)
          {
              long a = in.nextLong();
              long b = in.nextLong();
              boolean k =winner(a,b);
              if(k)
                  out.println("First");
              else
                  out.println("Second");

        }

        out.close();
    }
    static boolean winner(long a  ,long b)
    {
        if(a==0 || b==0)
            return false;
        if(a>b)
        {
            long t = a;
            a = b;
            b = t;
        }
        if(!winner(a,b%a))return true;
       // System.out.print(a+" "+b);
        long bacha = b/a;
        long karunga = a+1;
      //  System.out.print(bacha+" "+karunga);
        return ((bacha%karunga)%2 == 0);
    }

    public static long modPow(long base, long exp, long mod) {
        base = base % mod;
        long result = 1;
        while(exp > 0)
        {
            if(exp % 2== 1)
            {
                result = (result * base) % mod;
                exp --;
            }
            else
            {
                base = (base * base) % mod;
                exp = exp >> 1;
            }

        }
        return result;
    }

    public static long mod = 1000000007, inf = 100000000000000000l;
    public static long fac[],inv[];
    public static void cal()
    {
        fac = new long[100001];
        inv = new long[100001];
        fac[0]=1;
        inv[0]=1;
        for(int i=1; i<=100000; i++)
        {
            fac[i]=(fac[i-1]*i)%mod;
            //  inv[i]=(inv[i-1]*modPow(i,mod-2,mod))%mod;

        }
    }
    public static long combination(long n, long r)
    {
        long k = (fac[(int) n]%mod*inv[(int) r]%mod)%mod;
        long p = inv[(int) (n-r)]%mod;
        long m = (k*p)%mod;
        return m;
    }

    public static class Point implements Comparable<Point> {

        long x, y;

        public Point(long start, long end) {
            this.x = start;
            this.y = end;
        }

        @Override
        public int hashCode() {
            int hash = 5;
            hash = (int) (47 * hash + this.x);
            hash = (int) (47 * hash + this.y);
            return hash;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Point other = (Point) obj;
            if (this.x != other.x) {
                return false;
            }
            if (this.y != other.y) {
                return false;
            }
            return true;
        }

        @Override
        public int compareTo(Point o) {
            return Long.compare(x, o.x);
        }
    }
    static long setbits(long i)
    {
        long count = 0;
        while (i>0)
        {
            count += i & 1;
            i >>= 1;
        }
        return count;

    }

    static ArrayList<Long> sieveOfEratosthenes(int n)
    {
        // Create a boolean array "prime[0..n]" and initialize
        // all entries it as true. A value in prime[i] will
        // finally be false if i is Not a prime, else true.

        prime=new boolean[1000001];
        for(int i=0;i<n;i++)
            prime[i] = true;

        for(long p = 2; p*p <=n; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if(prime[(int)p] == true)
            {
                // Update all multiples of p
                for(long i = p*2; i <= n; i += p) {
                    prime[(int) i] = false;
                }
            }
        }
        ArrayList<Long> aa=new ArrayList<>();
        for (long i=0;i<n;i++)
        {
            if(prime[(int)i])
                aa.add(i);
        }
        return aa;

        // Print all prime numbers
      /*  for(int i = 2; i <= n; i++)
        {
            if(prime[i] == true)
                System.out.print(i + " ");
        }
       */
    }

    static class InputReader {

        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public String readString() {
            int c = snext();
            while (isSpaceChar(c))
                c = snext();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = snext();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
}


import java.util.*;
import java.io.*;
import java.awt.Point;
import static java.lang.Math.*;

public class P168E {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        int T = in.nextInt();
        for(int i=0; i<T; i++) {
            long A = in.nextLong();
            long B = in.nextLong();
            System.out.println(f(A,B) ? "First" : "Second");
        }
    }
    public static boolean f(long A, long B) {
        if(A > B) return f(B,A);
        if(A == 0) return false;
        if(A == 1) return true;

        if( (B/A % (A+1)) % 2 == 0) return true;
        if(!f(B%A,A)) return true;
        return false;
    }
}


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

public class D {

	static final int P = 1_000_000_007;

	static final int N = 52;

	void submit() {
		int n = nextInt();
		int m = nextInt();

		int[][] f = new int[N + 1][N + 1];

		f[0][1] = 1;

		for (int sz = 1; sz <= n; sz++) {

			int[][] dp = new int[sz + 1][N + 1];
			dp[0][1] = 1;

			int[][] cnt = new int[sz + 1][N + 1]; // [size][cut]

			for (int szL = 0; szL + 1 <= sz; szL++) {
				for (int cutL = 1; cutL <= N; cutL++) {
					for (int szR = 0; szL + szR + 1 <= sz; szR++) {
						for (int cutR = 1; cutR <= N; cutR++) {

							int szLR = szL + szR + 1;
							int cutLR = Math.min(cutL, cutR);

							cnt[szLR][cutLR] += (int) ((long) f[szL][cutL]
									* f[szR][cutR] % P);
							if (cnt[szLR][cutLR] >= P) {
								cnt[szLR][cutLR] -= P;
							}
						}
					}
				}
			}

			for (int addSz = 1; addSz <= sz; addSz++) {
				for (int addCut = 1; addCut <= N; addCut++) {

					if (cnt[addSz][addCut] == 0) {
						continue;
					}

					int[][] nextDp = new int[sz + 1][];
					for (int i = 0; i <= sz; i++) {
						nextDp[i] = dp[i].clone();
					}

					int smth = sz / addSz;

					int[] arrWays = new int[smth + 1];
					int base = cnt[addSz][addCut];

					arrWays[0] = 1;

					for (int i = 1; i <= smth; i++) {
						arrWays[i] = (int)((long)arrWays[i - 1] * inv[i] % P * base % P);
						base++;
						if (base == P) {
							base = 0;
						}
					}

					for (int cntAdd = 1; cntAdd <= smth; cntAdd++) {

						int ways = arrWays[cntAdd];

						for (int i = sz - addSz * cntAdd; i >= 0; i--) {
							for (int j = N - addCut * cntAdd; j >= 1; j--) {

								if (i + addSz * cntAdd <= sz
										&& j + addCut * cntAdd <= N) {

									nextDp[i + addSz * cntAdd][j + addCut * cntAdd] += (int) ((long) dp[i][j]
											* ways % P);
									if (nextDp[i + addSz * cntAdd][j + addCut
											* cntAdd] >= P) {
										nextDp[i + addSz * cntAdd][j + addCut
												* cntAdd] -= P;
									}

								}

							}
						}

					}

					dp = nextDp;

				}
			}

			for (int j = 1; j <= N; j++) {
				f[sz][j] = dp[sz][j];
			}

		}

//		for (int i = 0; i <= n; i++) {
//			for (int j = 1; j <= N; j++) {
//				if (f[i][j] != 0) {
//					System.err.println(i + " " + j + " -> " + f[i][j]);
//				}
//			}
//
//			System.err.println();
//		}

		out.println(f[n][m]);

	}

	int[] inv = new int[1000];
	{
		inv[0] = 0;
		inv[1] = 1;
		for (int i = 2; i < inv.length; i++) {
			inv[i] = P - (int) ((long) (P / i) * inv[P % i] % P);
		}
	}

	void preCalc() {

	}

	void stress() {

	}

	void test() {

	}

	D() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		// stress();
		// test();
		out.close();
	}

	static final Random rng = new Random();

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

	public static void main(String[] args) throws IOException {
		new D();
	}

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

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

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

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


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.io.Closeable;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 27);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            DShakeIt solver = new DShakeIt();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class DShakeIt {
        Modular mod = new Modular(1e9 + 7);
        int[][][][] h;
        int[][] g;
        int n;
        int flow;
        InverseNumber inv = new InverseNumber(100, mod);
        Debug debug = new Debug(false);

        public void solve(int testNumber, FastInput in, FastOutput out) {
            n = in.readInt();
            int m = in.readInt();
            flow = Math.max(n + 1, m);

            // f = new int[n + 1][flow + 1];
            h = new int[n + 1][flow + 1][n + 1][flow + 1];
            g = new int[n + 1][flow + 1];

            //SequenceUtils.deepFill(f, -1);
            SequenceUtils.deepFill(g, -1);
            SequenceUtils.deepFill(h, -1);

            //g(2, 0);

            int ans = f(n, m - 1);
            //ans = mod.mul(ans, fact.invFact(n));

            //debug.debug("f", f);
            debug.debug("g", g);
            debug.debug("h", h);
            out.println(ans);
        }

        public int h(int i, int j, int a, int b) {
            if (i < 0 || j < 0) {
                return 0;
            }
            if (h[i][j][a][b] == -1) {
                h[i][j][a][b] = 0;
                if (a == 0 || b == 0) {
                    return h[i][j][a][b] = i == 0 && j == 0 ? 1 : 0;
                }
                int limit = Math.min(i / a, j / b);
                int prod = 1;
                int aa = a;
                int bb = b;
                if (bb > 1) {
                    bb--;
                } else {
                    bb = flow;
                    aa--;
                }
                h[i][j][a][b] = h(i, j, aa, bb);
                for (int t = 1; t <= limit; t++) {
                    prod = mod.mul(prod, g(a - 1, b - 1) + t - 1);
                    prod = mod.mul(prod, inv.inverse(t));
                    int local = mod.mul(h(i - a * t, j - b * t, aa, bb),
                            prod);
                    h[i][j][a][b] = mod.plus(h[i][j][a][b], local);
                }

            }

            return h[i][j][a][b];
        }

        public int f(int i, int j) {
            return h(i, j, i, j);
        }

        public int g(int i, int j) {
            if (i < 0 || j < 0) {
                return 0;
            }
            if (g[i][j] == -1) {
                g[i][j] = 0;
                if (i == 0) {
                    return g[i][j] = j == 0 ? 1 : 0;
                }
                for (int a = 0; a <= i; a++) {
                    int c = i - a;
                    for (int b = j; b <= a + 1; b++) {
                        for (int d = j; d <= c + 1; d++) {
                            if (Math.min(b, d) != j) {
                                continue;
                            }
                            int way = mod.mul(f(a, b), f(c, d));

                            g[i][j] = mod.plus(g[i][j], way);
                        }
                    }
                }
            }

            return g[i][j];
        }

    }

    static class InverseNumber {
        int[] inv;

        public InverseNumber(int[] inv, int limit, Modular modular) {
            this.inv = inv;
            inv[1] = 1;
            int p = modular.getMod();
            for (int i = 2; i <= limit; i++) {
                int k = p / i;
                int r = p % i;
                inv[i] = modular.mul(-k, inv[r]);
            }
        }

        public InverseNumber(int limit, Modular modular) {
            this(new int[limit + 1], limit, modular);
        }

        public int inverse(int x) {
            return inv[x];
        }

    }

    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private StringBuilder cache = new StringBuilder(1 << 20);
        private final Writer os;

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            return this;
        }

        public FastOutput append(int c) {
            cache.append(c);
            return this;
        }

        public FastOutput println(int c) {
            return append(c).println();
        }

        public FastOutput println() {
            cache.append(System.lineSeparator());
            return this;
        }

        public FastOutput flush() {
            try {
                os.append(cache);
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }

    static class FastInput {
        private final InputStream is;
        private byte[] buf = new byte[1 << 13];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

    }

    static class Modular {
        int m;

        public int getMod() {
            return m;
        }

        public Modular(int m) {
            this.m = m;
        }

        public Modular(long m) {
            this.m = (int) m;
            if (this.m != m) {
                throw new IllegalArgumentException();
            }
        }

        public Modular(double m) {
            this.m = (int) m;
            if (this.m != m) {
                throw new IllegalArgumentException();
            }
        }

        public int valueOf(int x) {
            x %= m;
            if (x < 0) {
                x += m;
            }
            return x;
        }

        public int valueOf(long x) {
            x %= m;
            if (x < 0) {
                x += m;
            }
            return (int) x;
        }

        public int mul(int x, int y) {
            return valueOf((long) x * y);
        }

        public int plus(int x, int y) {
            return valueOf(x + y);
        }

        public String toString() {
            return "mod " + m;
        }

    }

    static class Debug {
        private boolean offline;
        private PrintStream out = System.err;
        static int[] empty = new int[0];

        public Debug(boolean enable) {
            offline = enable && System.getSecurityManager() == null;
        }

        public Debug debug(String name, Object x) {
            return debug(name, x, empty);
        }

        public Debug debug(String name, Object x, int... indexes) {
            if (offline) {
                if (x == null || !x.getClass().isArray()) {
                    out.append(name);
                    for (int i : indexes) {
                        out.printf("[%d]", i);
                    }
                    out.append("=").append("" + x);
                    out.println();
                } else {
                    indexes = Arrays.copyOf(indexes, indexes.length + 1);
                    if (x instanceof byte[]) {
                        byte[] arr = (byte[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof short[]) {
                        short[] arr = (short[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof boolean[]) {
                        boolean[] arr = (boolean[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof char[]) {
                        char[] arr = (char[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof int[]) {
                        int[] arr = (int[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof float[]) {
                        float[] arr = (float[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof double[]) {
                        double[] arr = (double[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else if (x instanceof long[]) {
                        long[] arr = (long[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    } else {
                        Object[] arr = (Object[]) x;
                        for (int i = 0; i < arr.length; i++) {
                            indexes[indexes.length - 1] = i;
                            debug(name, arr[i], indexes);
                        }
                    }
                }
            }
            return this;
        }

    }

    static class SequenceUtils {
        public static void deepFill(Object array, int val) {
            if (!array.getClass().isArray()) {
                throw new IllegalArgumentException();
            }
            if (array instanceof int[]) {
                int[] intArray = (int[]) array;
                Arrays.fill(intArray, val);
            } else {
                Object[] objArray = (Object[]) array;
                for (Object obj : objArray) {
                    deepFill(obj, val);
                }
            }
        }

    }
}


import java.util.Scanner;

public class E {

    static double e = 1e-8, R, phi0;
    static int x,y,r,v,vp;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int xp = sc.nextInt();
        int yp = sc.nextInt();
        vp = sc.nextInt();
        x = sc.nextInt();
        y = sc.nextInt();
        v = sc.nextInt();
        r = sc.nextInt();
        R = Math.sqrt(xp*xp+yp*yp);
        phi0 = Math.acos(xp / R);
        if (yp < 0)
            phi0 = 2*Math.PI-phi0;
        double left = 0, right = 1e9;
        for(;;) {
            double middle = (left+right) / 2;
            if (reache(middle) && !reache(middle-e)) {
                System.out.println(middle);
                return;
            }
            if (reache(middle))
                right = middle-e;
            else
                left = middle+e;
        }
    }

    private static boolean reache(double t) {
        double x2 = R*Math.cos(vp/R*t+phi0);
        double y2 = R*Math.sin(vp/R*t+phi0);
        double x1 = x, y1 = y;
        double a = y1-y2, b = x2-x1, c = x1*y2-x2*y1;
        double d = Math.abs(c) / Math.sqrt(a*a+b*b);
        double reach_time = 0;
        a = dis(x1, y1, 0, 0);
        b = dis(x2, y2, 0, 0);
        c = dis(x1, y1, x2, y2);
        if (d >= r || Math.abs(Math.sqrt(a*a-d*d)+Math.sqrt(b*b-d*d)-c) > e) {
            reach_time = c / v;
        }
        else {
            double alfa = Math.acos((x1*x2+y1*y2) / (a*b))-Math.acos(r/a)-Math.acos(r/b);
            reach_time = (r*alfa+Math.sqrt(a*a-r*r)+Math.sqrt(b*b-r*r)) / v;
        }
        return reach_time <= t;
    }

    private static double dis(double x1, double y1, double x2, double y2) {
        return Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    }
}


import java.util.*;
public class Main {
public static void main(String [] args){
        Scanner in=new Scanner(System.in);
        long array[]=new long[3];
        for(int i=0;i<=2;i++){
        array[i]=in.nextLong();
        }
        Arrays.sort(array);
        if(array[1]%2==array[0]%2){
        	System.out.print(array[1]);
        	return;
        }
        System.out.print(array[2]);
}
}


import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        new Main().go();
    }

    Scanner scan;
    PrintWriter print;

    void go() {
        try {
            //scan = new Scanner(new File("in.txt"));
            scan = new Scanner(System.in);
            print = new PrintWriter(System.out);
            for(; scan.hasNext();) {
                long a, b, c;
                a = scan.nextLong();
                b = scan.nextLong();
                c = scan.nextLong();
                long res = calc(a, b, c);
                long r = calc(b, a, c);
                if(r < res) res = r;
                r = calc(c, a, b);
                if(r < res) res = r;
                print.println(res);
            }
        }
        /*catch (FileNotFoundException ex) {
            ex.printStackTrace();
        } */
        finally {
            print.close();
        }
    }

    private long calc(long a, long b, long c) {
        long d = Math.min(b, c);
        a += d;
        b -= d;
        c -= d;
        if(b == 0) {
            b = c;
            c = 0;
        }
        if((b & 1) == 1) return d + a + b - 1;
        else if(a > 0) return d + b;
        else return d + a + b - 1;
    }

}


import java.io.*;
import java.util.StringTokenizer;
public class Pixels {

    /**
     * @param args
     */
    public static void main(String[] args) {
        BufferedReader inpt = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer input;
        long n;
        try {
            input = new StringTokenizer(inpt.readLine());
            long[] rgb = {Long.parseLong(input.nextToken()),Long.parseLong(input.nextToken()),Long.parseLong(input.nextToken())};
            int j;
            n = Math.max(rgb[0], Math.max(rgb[1], rgb[2]));
            for(int i = 0; i < 3; i++){
                j = (i+1)%3;
                if( rgb[i]%2 == rgb[j]%2){
                    n = Math.min(n, Math.max(rgb[i], rgb[j]));
                }
            }
            System.out.println(n);

        } catch (IOException e) {
            e.printStackTrace();
        }

    }

}


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

public class BB {
	public static void main(String[] args) {
		new BB().run();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof;

	void run() {
		try {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			solve();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(-1);
		} finally {
			out.close();
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreElements()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

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

	void solve() throws IOException {
		long[] v = {nextLong(), nextLong(), nextLong(), };
		Arrays.sort(v);
		out.println(v[0] % 2 == v[1] % 2 ? v[1] : v[2]);
	}
}


import java.util.Scanner;

public class Pixel {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long i,j,k,n,a,b,c,big,middle,small,sum;
        boolean is;
        while (input.hasNext()){
            a = input.nextLong(); b = input.nextLong(); c = input.nextLong(); sum = 0; is = false;

            big = (a>=b) ? ((a>=c)? a :c) : ((b>=c) ? b : c);
            small = (a>=b) ? ((b>=c) ? c : b) : ((a>=c) ? c : a);
            middle = a>b ? (c>a ? a :(b>c)? b:c) : (c>b ? b : a>c? a : c);

           // System.out.println(big+ " " + middle + " " + small);
            for (i=0; i<big; i++){
                if (big == middle || big == small || middle == small) break;
                if ((middle - small ) % 2 == 0){
                   // big--;middle--;small++;
                    j = (middle - small);
                   // sum += (j/2);
                    sum += (small + j);
                    is = true;
                    break;
                }
                else break;
            }
            if (!is) {
                if (big == middle) sum += big;
                else if (big == small) sum += big;
                else if (small == middle) sum += small;
                else sum += big; System.out.println(sum);
            }
            else
            System.out.println(sum);
        }
    }
}