import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
import java.util.Calendar;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

/**
 * #
 *
 * @author pttrung
 */
public class D2_Helvetic_2016 {

	public static long MOD = 1000003;

	public static void main(String[] args) throws FileNotFoundException {
		// PrintWriter out = new PrintWriter(new FileOutputStream(new File(
		// "output.txt")));
		PrintWriter out = new PrintWriter(System.out);
		Scanner in = new Scanner();
		int n = in.nextInt();
		int c = in.nextInt();
		long[]p = new long[n + c];
		p[0] = 1;
		for(int i = 1; i < p.length; i++){
			p[i] = (p[i - 1]*(i % MOD) ) % MOD;
		}
		long result = 0;
		for(int i = 1;i <= n; i ++ ){
			long tmp = p[i + c - 1];
			tmp *= pow(p[i], MOD - 2);
			tmp %= MOD;
			tmp *= pow(p[c - 1] , MOD - 2);
			tmp %= MOD;
			result += tmp;
			result %= MOD;
		}
		out.println(result);
		out.close();
	}

	public static int[] KMP(String val) {
		int i = 0;
		int j = -1;
		int[] result = new int[val.length() + 1];
		result[0] = -1;
		while (i < val.length()) {
			while (j >= 0 && val.charAt(j) != val.charAt(i)) {
				j = result[j];
			}
			j++;
			i++;
			result[i] = j;
		}
		return result;

	}

	public static boolean nextPer(int[] data) {
		int i = data.length - 1;
		while (i > 0 && data[i] < data[i - 1]) {
			i--;
		}
		if (i == 0) {
			return false;
		}
		int j = data.length - 1;
		while (data[j] < data[i - 1]) {
			j--;
		}
		int temp = data[i - 1];
		data[i - 1] = data[j];
		data[j] = temp;
		Arrays.sort(data, i, data.length);
		return true;
	}

	public static int digit(long n) {
		int result = 0;
		while (n > 0) {
			n /= 10;
			result++;
		}
		return result;
	}

	public static double dist(long a, long b, long x, long y) {
		double val = (b - a) * (b - a) + (x - y) * (x - y);
		val = Math.sqrt(val);
		double other = x * x + a * a;
		other = Math.sqrt(other);
		return val + other;

	}

	public static class Point implements Comparable<Point> {

		int x, y;

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

		@Override
		public int hashCode() {
			int hash = 5;
			hash = 47 * hash + this.x;
			hash = 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 Integer.compare(x, o.x);
		}
	}

	public static class FT {

		long[] data;

		FT(int n) {
			data = new long[n];
		}

		public void update(int index, long value) {
			while (index < data.length) {
				data[index] += value;
				index += (index & (-index));
			}
		}

		public long get(int index) {
			long result = 0;
			while (index > 0) {
				result += data[index];
				index -= (index & (-index));
			}
			return result;

		}
	}

	public static long gcd(long a, long b) {
		if (b == 0) {
			return a;
		}
		return gcd(b, a % b);
	}

	public static long pow(long a, long b) {
		if (b == 0) {
			return 1;
		}
		if (b == 1) {
			return a;
		}
		long val = pow(a, b / 2);
		if (b % 2 == 0) {
			return val * val % MOD;
		} else {
			return val * (val * a % MOD) % MOD;

		}
	}

	static class Scanner {

		BufferedReader br;
		StringTokenizer st;

		public Scanner() throws FileNotFoundException {
			// System.setOut(new PrintStream(new
			// BufferedOutputStream(System.out), true));
			br = new BufferedReader(new InputStreamReader(System.in));
			// br = new BufferedReader(new InputStreamReader(new
			// FileInputStream(new File("input.txt"))));
		}

		public String next() {

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

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

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

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

		public String nextLine() {
			st = null;
			try {
				return br.readLine();
			} catch (Exception e) {
				throw new RuntimeException();
			}
		}

		public boolean endLine() {
			try {
				String next = br.readLine();
				while (next != null && next.trim().isEmpty()) {
					next = br.readLine();
				}
				if (next == null) {
					return true;
				}
				st = new StringTokenizer(next);
				return st.hasMoreTokens();
			} catch (Exception e) {
				throw new RuntimeException();
			}
		}
	}
}


import java.util.Scanner;

public class TaskC {
	static String w0 = "What are you doing at the end of the world? Are you busy? Will you save us?";
	static String w1a = "What are you doing while sending \"";
	static String w1b = "\"? Are you busy? Will you send \"";
	static String w1c = "\"?";

	static long w1aLen = w1a.length();
	static long w1bLen = w1b.length();

	static String f1 = w1a+w0+w1b+w0+w1c;

	static long[] lens;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int q = sc.nextInt();
		int n;
		long k;
		lens = new long[54];
		for(int j = 0; j < 54; j++) {
			lens[j] = -1;
		}
		for(int i = 0; i < q; i++) {
			n = sc.nextInt();
			k = sc.nextLong();
			System.out.print(solve(n, k-1));
		}
		return;
	}

	public static char solve(int n, long k) {
		while(n >= 0) {
			if(k < 0 || k >= getLen(n)) {
				return '.';
			}
			if(n == 0) return w0.charAt((int)k);
			else if(n == 1) return f1.charAt((int)k);
			else {
				long nSub1Len = getLen(n-1);
				if(k < w1aLen)
				{
					return w1a.charAt((int)(k));
				}
				else if(k >= w1aLen && k < w1aLen + nSub1Len)
				{
					n--;
					k-=w1aLen;
				}
				else if(k >= w1aLen + nSub1Len && k < w1aLen + nSub1Len+ w1bLen)
				{
					return w1b.charAt((int)(k-w1aLen-nSub1Len));
				}
				else if(k >= w1aLen + nSub1Len+w1bLen && k < w1aLen + nSub1Len+w1bLen + nSub1Len)
				{
					n--;
					k-=(w1aLen + nSub1Len + w1bLen);
				}
				else
				{
					return w1c.charAt((int)(k-w1aLen-nSub1Len-w1bLen-nSub1Len));
				}
			}
		}
		return '.';
	}

	public static long getLen(int n) {
		if(n > 53) return getLen(53);
		if(lens[n] != -1) return lens[n];
		if(n == 0) {
			lens[n] = w0.length();
			return lens[n];
		} else {
			lens[n] = w1a.length() + getLen(n-1) + w1b.length() + getLen(n-1) + w1c.length();
			return lens[n];
		}
	}
}


import java.util.*;

public class Balance {

  public static final int MOD = 51123987;
  public static int[][] combos = null;

  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    in.nextInt();
    String s = in.next();
    int len = s.length();
    int half = (len+1)/2;
    int[][][][] groupCounts = new int[half+2][half+2][half+2][3];
    int[][][][][] prevAdd = new int[half+2][half+2][half+2][3][3];
    // [i][j][k][-] = # of subsequences such that there are 'i' groups of a, 'j' groups of b, 'k' groups of c
    // [-][-][-][0] = # of such groups where the rightmost group is type 'a', [1] type 'b', [2] type 'c'
    //

    for (int i = 0; i < len; ++i) {
      char val = s.charAt(i);
      for (int a = 0; a <= i && a <= half; ++a) {
        for (int b = 0; a+b <= i && b <= half; ++b) {
          for (int c = 0; a+b+c <= i && c <= half; ++c) {
            if (a+b+c == 0) {
              groupCounts[val=='a'?1:0][val=='b'?1:0][val=='c'?1:0][val-'a'] = 1;
              continue;
            }
            int newAdd;
            if (val == 'a') {
              newAdd = groupCounts[a][b][c][1] - prevAdd[a][b][c][1][0];
              groupCounts[a+1][b][c][0] = mod(groupCounts[a+1][b][c][0] + newAdd, MOD);
              prevAdd[a][b][c][1][0] += newAdd;

              newAdd = groupCounts[a][b][c][2] - prevAdd[a][b][c][2][0];
              groupCounts[a+1][b][c][0] = mod(groupCounts[a+1][b][c][0] + newAdd, MOD);
              prevAdd[a][b][c][2][0] += newAdd;
            } else if (val == 'b') {
              newAdd = groupCounts[a][b][c][0] - prevAdd[a][b][c][0][1];
              groupCounts[a][b+1][c][1] = mod(groupCounts[a][b+1][c][1] + newAdd, MOD);
              prevAdd[a][b][c][0][1] += newAdd;

              newAdd = groupCounts[a][b][c][2] - prevAdd[a][b][c][2][1];
              groupCounts[a][b+1][c][1] = mod(groupCounts[a][b+1][c][1] + newAdd, MOD);
              prevAdd[a][b][c][2][1] += newAdd;
            } else { // val == 'c'
              newAdd = groupCounts[a][b][c][0] - prevAdd[a][b][c][0][2];
              groupCounts[a][b][c+1][2] = mod(groupCounts[a][b][c+1][2] + newAdd, MOD);
              prevAdd[a][b][c][0][2] += newAdd;

              newAdd = groupCounts[a][b][c][1] - prevAdd[a][b][c][1][2];
              groupCounts[a][b][c+1][2] = mod(groupCounts[a][b][c+1][2] + newAdd, MOD);
              prevAdd[a][b][c][1][2] += newAdd;
            }
          }
        }
      }
    }
    long total = 0;
    for (int a = 0; a <= half; ++a) {
      for (int b = 0; b <= half; ++b) {
        for (int c = 0; a+b+c <= len && c <= half; ++c) {
          long calc = calculate(a, b, c, len) % MOD;
          total += groupCounts[a][b][c][0] * calc;
          total += groupCounts[a][b][c][1] * calc;
          total += groupCounts[a][b][c][2] * calc;
          total %= MOD;
        }
      }
    }
    System.out.println(total);
  }

  public static int[][] getCombinations(int n, int m) {
    if (combos != null)
      return combos;
    combos = new int[n+1][n+1];
    combos[0][0] = 1;
    for (int row = 1; row <= n; ++row) {
      combos[row][0] = 1;
      for (int col = 1; col <= row; ++col) {
        combos[row][col] = combos[row-1][col-1] + combos[row-1][col];
        if (combos[row][col] >= m)
          combos[row][col] -= m;
      }
    }
    return combos;
  }

  public static long calculate(int a, int b, int c, int total) {
    getCombinations(total, MOD);
    long ret = 1;
    int goal = total/3;
    //SPECIAL CASE: at least one is zero
    if (a == 0 || b == 0 || c == 0) {
      // the only way this is possible is if total <= 2
      // total == 2: 0,1,1 , 1,0,1, 1,1,0
      // total == 1: 0,0,1 , 0,1,0  1,0,0
      if (total > 2)
        return 0;
      int sum = a + b + c;
      if (sum == total)
        return 1;
      return 0;
    }
    if (total % 3 == 0) {
      // each group must have the same total;
      if (a > goal || b > goal || c > goal)
        return 0;
      ret *= combos[goal-1][goal-a];
      ret *= combos[goal-1][goal-b];
      ret %= MOD;
      ret *= combos[goal-1][goal-c];
      ret %= MOD;
    } else if (total % 3 == 1) {
      long retPartial = 0;
      // try goal,goal,goal+1
      if (a <= goal && b <= goal && c <= goal+1) {
        ret *= combos[goal-1][goal-a];
        ret *= combos[goal-1][goal-b];
        ret %= MOD;
        ret *= combos[goal][goal-c+1];
        retPartial += ret;
        ret = 1;
      }
      // try goal,goal+1,goal
      if (a <= goal && b <= goal+1 && c <= goal) {
        ret *= combos[goal-1][goal-a];
        ret *= combos[goal][goal-b+1];
        ret %= MOD;
        ret *= combos[goal-1][goal-c];
        retPartial += ret;
        ret = 1;
      }
      // try goal+1,goal,goal
      if (a <= goal+1 && b <= goal && c <= goal) {
        ret *= combos[goal][goal-a+1];
        ret *= combos[goal-1][goal-b];
        ret %= MOD;
        ret *= combos[goal-1][goal-c];
        retPartial += ret;
        ret = 1;
      }
      ret = retPartial % MOD;
    } else { // total % 3 == 2
      long retPartial = 0;
      // try goal,goal+1,goal+1
      if (a <= goal && b <= goal+1 && c <= goal+1) {
        ret *= combos[goal-1][goal-a];
        ret *= combos[goal][goal-b+1];
        ret %= MOD;
        ret *= combos[goal][goal-c+1];
        retPartial += ret;
        ret = 1;
      }
      // try goal+1,goal,goal+1
      if (a <= goal+1 && b <= goal && c <= goal+1) {
        ret *= combos[goal][goal-a+1];
        ret *= combos[goal-1][goal-b];
        ret %= MOD;
        ret *= combos[goal][goal-c+1];
        retPartial += ret;
        ret = 1;
      }
      // try goal+1,goal+1,goal
      if (a <= goal+1 && b <= goal+1 && c <= goal) {
        ret *= combos[goal][goal-a+1];
        ret *= combos[goal][goal-b+1];
        ret %= MOD;
        ret *= combos[goal-1][goal-c];
        retPartial += ret;
        ret = 1;
      }
      ret = retPartial % MOD;
    }
    return ret;
  }

  public static int mod(int a, int m) {
    if (a < 0)
      a += m;
    if (a >= m)
      a -= m;
    return a;
  }
}


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

public class C {

    /**
     * @param args
     */
    public static void main(String[] args) {
        Subs subs = new Subs();
        subs.sol();
        subs.print();
    }

}

class Subs {

    Subs() {
        Scanner scr = new Scanner(System.in);
        String fs = scr.nextLine();
        String ft = scr.nextLine();
        s = fs.toCharArray();
        t = ft.toCharArray();
        scr.close();
    }

    void sol() {
        //long[][] dp = new long[s.length + 1][t.length + 1]; - memory limit
        long[] pred = new long[s.length+1];
        long[] curr = new long[s.length+1];

        ans = 0;
        long save;
        for (int j = 1; j <= t.length; j++){
            save = pred[0];
            for (int i = 1; i <= s.length; i++){

                /* de facto, but it's too slowly
                if (s[i-1] == t[j-1]) {
                    for (int k = 0; k < j; k++){
                        dp[i][j] = (dp[i][j] + dp[i-1][k]) % M;
                    }
                    dp[i][j] += 1;
                    ans = (ans + dp[i][j]) % M;
                */

                //dp[i][j] = dp[i][j-1];
                curr[i] = pred[i];
                if (s[i-1] == t[j-1]){
                    //dp[i][j] = (dp[i][j] + dp[i-1][j-1] + 1) % M;
                    curr[i] = (curr[i] + save + 1) % M;
                }
                save = pred[i];
                pred[i] = curr[i];
            }
        }
        for (int i = 1; i <= s.length; i++){
            //ans = (ans + dp[i][t.length]) % M;
            ans = (ans + curr[i]) % M;
        }
    }

    void print() {
        PrintWriter pw = new PrintWriter(System.out);
        pw.println(ans);
        pw.flush();
        pw.close();
    }

    long ans;
    char[] s;
    char[] t;
    static final int M = 1000000007;
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

public class CF1528E {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StreamTokenizer st = new StreamTokenizer(br);

    final int N = (int) (1e6 + 10);
    final int M = 998244353;

    long[] dp = new long[N], dp1 = new long[N], dp2 = new long[N];

    private long readLong() throws IOException {
        st.nextToken();
        return (long) st.nval;
    }

    private int readInt() throws IOException {
        st.nextToken();
        return (int) st.nval;
    }

    private String readString() throws Exception {
        st.nextToken();
        return st.sval;
    }

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

    long inv(long a) {
        return inv(a, M);
    }

    public long inv(long a, long mod) {
        long b = mod;
        long p = 1, q = 0;
        while (b > 0) {
            long c = a / b;
            long d;
            d = a;
            a = b;
            b = d % b;
            d = p;
            p = q;
            q = d - c * q;
        }
        return p < 0 ? p + mod : p;
    }

    long g(int n) {
        if (n < 0)
            return 0;
        long t = dp[n];
        long res = (t * (t + 1)) % M;
        res = (res * (t + 5)) % M;
        res = (res * inv(3)) % M;
        return (res + M) % M;
    }

    private void run() throws Exception {
        int n = readInt();
        dp[0] = dp1[0] = dp2[0] = 1;

        for (int i = 1; i <= n; i++) {
            dp[i] = ((dp[i - 1] + 1) * (dp[i - 1] + 2) / 2) % M;
            dp1[i] = dp[i] - dp[i - 1];
            dp2[i] = dp1[i] - dp1[i - 1];
        }
        long res = (g(n - 1) - g(n - 2)) % M;
        for (int i = 0; i < n; i++)
            res = (res + dp2[i] * dp1[n - 1 - i]) % M;
        res = (res + M) % M;
        System.out.println(res);
    }
}


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

public class Main {
    static Reader r = new Reader();
    static StringBuilder sb = new StringBuilder();
    static final int p = 1_000_000_007;

    public static ArrayList<Integer> primeList(int n){
        // return prime numbers less than or equal to n
        if(n==1) return new ArrayList<>();
        ArrayList<Integer> prime = new ArrayList<>();
        prime.add(2);
        if(n==2) return prime;

        boolean[] isPrime = new boolean[(n-1)/2];
        Arrays.fill(isPrime,true);
        for(int i=0;(2*i+3)*(2*i+3)<=n;i++){
            if(!isPrime[i]) continue;
            for(int j=((2*i+3)*(2*i+3)-3)/2;j<(n-1)/2;j+=(2*i+3))
                isPrime[j] = false;
        }
        for(int i=0;i<(n-1)/2;i++){
            if(isPrime[i]) prime.add(2*i+3);
        }
        return prime;
    }
    static int gcd(int n, int m){
        if(n==0) return (m>0)?m:-m;
        return gcd(m%n, n);
    }

    public static void main(String args[]) throws IOException {
        int n = r.readInt();
        ArrayList<Integer> prime = primeList((int)Math.sqrt(n));
        ArrayList<Integer>[] div = new ArrayList[n+1];
        int[] phi = new int[n+1];
        for(int i=1;i<=n;i++)
            div[i] = new ArrayList<>();
        for(int i=1;i<=n/2;i++){
            for(int j=2*i;j<=n;j+=i){
                div[j].add(i);
            }
        }
        for(int i=1;i<=n;i++){
            int m = i;
            int ans = m;
            for(int p:prime){
                if(p>Math.sqrt(m)) break;
                if(m%p!=0) continue;
                ans = (ans/p)*(p-1);
                while(m%p==0)
                    m/=p;
            }
            if(m>1) ans = (ans/m)*(m-1);
            phi[i] = ans;
        }
        long cnt = 0;
        for(int k=1;k<n;k++){
            for(int d:div[k]){
                cnt += (long) phi[k/d]*d*(n-k)/gcd(d,n-k);
                cnt %= p;
            }
        }
        System.out.println(cnt);
    }
}
class Reader {
    final private int BUFFER_SIZE = 1 << 16;
    private DataInputStream din;
    private byte[] buffer;
    private int bufferPointer, bytesRead;

    public Reader() {
        din = new DataInputStream(System.in);
        buffer = new byte[BUFFER_SIZE];
        bufferPointer = bytesRead = 0;
    }

    public String readLine() throws IOException {
        byte[] buf = new byte[1000000]; // line length
        int cnt = 0, c;
        while((c=read())!=-1){
            if(c=='\n'){
                if(cnt!=0) break;
                else continue;
            }
            buf[cnt++] = (byte)c;
        }
        return new String(buf, 0, cnt);
    }

    public int readInt() throws IOException {
        int ret = 0;
        byte c = read();
        while(c <= ' '){ c = read();}
        boolean neg = (c == '-');
        if(neg) c = read();
        do{
            ret = (ret<<3) + (ret<<1) + c - '0';
        } while ((c = read()) >= '0' && c <= '9');
        return neg ? -ret : ret;
    }

    public long readLong() throws IOException {
        long ret = 0;
        byte c = read();
        while(c <= ' '){ c = read();}
        boolean neg = (c == '-');
        if(neg) c = read();
        do{
            ret = (ret<<3) + (ret<<1) + c - '0';
        } while ((c = read()) >= '0' && c <= '9');
        return neg ? -ret : ret;
    }

    private void fillBuffer() throws IOException {
        bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
        if(bytesRead == -1) buffer[0] = -1;
    }

    private byte read() throws IOException {
        if(bufferPointer == bytesRead) fillBuffer();
        return buffer[bufferPointer++];
    }

    public void close() throws IOException {
        if(din==null) return;
        din.close();
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
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;
        FastScanner in = new FastScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            char[][] s = new char[][]{in.next().toCharArray(), in.next().toCharArray()};
            for (char[] c : s) {
                for (int i = 0; i < c.length; i++) {
                    if (c[i] == 'C') {
                        c[i] = 'B';
                    }
                }
            }
            int q = in.nextInt();

            int[][][] count = new int[2][][];
            int[][] sufA = new int[2][];
            for (int i = 0; i < 2; i++) {
                count[i] = count(s[i]);
                sufA[i] = sufA(s[i]);
            }
            int[][] info = new int[2][3];
            for (int i = 0; i < q; i++) {
                int l1 = in.nextInt() - 1, r1 = in.nextInt();
                int l2 = in.nextInt() - 1, r2 = in.nextInt();

                info[0][0] = count[0][0][r1] - count[0][0][l1];
                info[0][1] = count[0][1][r1] - count[0][1][l1];
                info[0][2] = Math.min(sufA[0][r1 - 1], r1 - l1);

                info[1][0] = count[1][0][r2] - count[1][0][l2];
                info[1][1] = count[1][1][r2] - count[1][1][l2];
                info[1][2] = Math.min(sufA[1][r2 - 1], r2 - l2);
                out.print(can(info[0], info[1]) ? '1' : '0');
            }
        }

        private boolean can(int[] a, int[] b) {
            a[0] -= a[2];
            b[0] -= b[2];
            if (a[2] < b[2]) {
                return false;
            }
            if (a[2] % 3 == b[2] % 3) {
                if (can2(a, b)) {
                    return true;
                }
            }
            a[2]--;
            a[1] += 2;

            a[0] += a[2] - b[2];
            return can2(a, b);
        }

        private boolean can2(int[] a, int[] b) {
            if (a[0] < 0 || a[1] < 0) {
                return false;
            }
            if (a[1] > b[1]) {
                return false;
            }
            if (a[1] % 2 != b[1] % 2) {
                return false;
            }
            if (b[1] > a[1] && (a[0] + a[1] == 0)) {
                return false;
            }
            return true;
        }

        private int[] sufA(char[] chars) {
            int[] a = new int[chars.length];
            for (int i = 0; i < chars.length; i++) {
                if (chars[i] == 'A') {
                    a[i] = (i == 0 ? 0 : a[i - 1]) + 1;
                } else {
                    a[i] = 0;
                }
            }
            return a;
        }

        private int[][] count(char[] chars) {
            int[][] a = new int[2][chars.length + 1];
            for (int i = 0; i < chars.length; i++) {
                a[0][i + 1] += a[0][i];
                a[1][i + 1] += a[1][i];
                a[chars[i] - 'A'][i + 1]++;
            }
            return a;
        }

    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

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

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

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

    }
}


import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class F {

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	static void solve() throws Exception {
		int n = nextInt();
		int p = nextInt();
		int q = nextInt();
		if (p >= n) {
			p = n - 1;
		}
		int c[] = new int[p + 1];
		c[0] = 1;
		for (int i = 1, val = 1, pow = 0; i <= p; i++) {
			int mul = n - i + 1;
			int shift = Integer.numberOfTrailingZeros(mul);
			val *= mul >> shift;
			pow += shift;
			mul = i;
			shift = Integer.numberOfTrailingZeros(mul);
			val *= BigInteger.valueOf(mul >> shift).modInverse(BigInteger.valueOf(0x100000000L)).intValue();
			pow -= shift;
			c[i] = pow >= 32 ? 0 : val << pow;
		}
		int ans = 0;
		for (int day = 1; day <= q; day++) {
			int cans = 0;
			for (int i = 0, pow = 1; i <= p; i++, pow *= day) {
				cans += c[i] * pow;
			}
			ans ^= day * cans;
		}
		out.print(ans & 0xffffffffL);
	}

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

	static long nextLong() throws IOException {
		return parseLong(next());
	}

	static double nextDouble() throws IOException {
		return parseDouble(next());
	}

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

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}


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

public class VK16_3F {

	static int B;
	static int P;
	static int Q;

	static long[] iFact;
	static long[] iFact2;

	public static void main0(String[] args) {
		System.out.println(Integer.toUnsignedString(inv(7)));
	}

	static int[] numF;
	static int[] numFP;
	static int[] iNumF;

	static int[] denF;
	static int[] denFP;
	static int[] iDenF;

	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		StringTokenizer inputData = new StringTokenizer(reader.readLine());

		B = Integer.parseInt(inputData.nextToken());
		P = Integer.parseInt(inputData.nextToken());
		P = Math.min(P, B);
		Q = Integer.parseInt(inputData.nextToken());

		numF = new int[P * 2 + 1];
		numF[0] = 1;
		numFP = new int[P * 2 + 1];

		iNumF = new int[P * 2 + 1];

		for (int i = 1; i <= P * 2; i++) {
			int cPow = Integer.numberOfTrailingZeros(B - i + 1);
			numF[i] = numF[i - 1] * ((B - i + 1) >> cPow);
			numFP[i] = numFP[i - 1] + cPow;
		}

		for (int i = 0; i <= P * 2; i++) {
			iNumF[i] = inv(numF[i]);
		}

		denF = new int[P * 2 + 1];
		denF[0] = 1;
		denFP = new int[P * 2 + 1];

		iDenF = new int[P * 2 + 1];

		for (int i = 1; i <= P * 2; i++) {
			int cPow = Integer.numberOfTrailingZeros(i);
			denF[i] = denF[i - 1] * (i >> cPow);
			denFP[i] = denFP[i - 1] + cPow;
		}

		for (int i = 0; i <= P * 2; i++) {
			iDenF[i] = inv(denF[i]);
		}

		int ans = 0;
		for (int n = 1; n <= Q; n++) {
			ans ^= n * calculate(n);
		}
		printer.println(Integer.toUnsignedString(ans));
		printer.close();
	}

	static int calculate(int n) {
		int cPow = 1;
		int sum = 0;
		int endI = Math.min(P, B - 1);
		for (int i = 0; i <= endI; i++) {
			sum += comb(B, i) * cPow;
			cPow *= n;
		}
		return sum;
	}

	static int comb(int n, int k) {
		int off = B - n;
		int cNumF = numF[k + off] * iNumF[off];
		int cNumP = numFP[k + off] - numFP[off];
		return (cNumF * iDenF[k]) << (cNumP - denFP[k]);
	}

	static int inv(int n) {
		int x = 1;
		x = x * (2 - x * n); /* Newton's method */
		x = x * (2 - x * n); /* 5 steps enough for 32 bits */
		x = x * (2 - x * n);
		x = x * (2 - x * n);
		x = x * (2 - x * n);
		return x;
	}
}


//package educational.round11;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class EE {
	InputStream is;
	PrintWriter out;
	String INPUT = "";

	void solve()
	{
		int n = ni(), m = ni();
		int mod = 1000000007;
		long ret = 2L*m;
		long f = m;
		for(int i = 2;i <= n;i++){
			ret = ret * (2*m-1) + f;
			f = f * m;
			ret %= mod;
			f %= mod;
		}
		out.println(ret);
	}

	void run() throws Exception
	{
		is = oj ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

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

	private byte[] inbuf = new byte[1024];
	private int lenbuf = 0, ptrbuf = 0;

	private int readByte()
	{
		if(lenbuf == -1)throw new InputMismatchException();
		if(ptrbuf >= lenbuf){
			ptrbuf = 0;
			try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
			if(lenbuf <= 0)return -1;
		}
		return inbuf[ptrbuf++];
	}

	private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
	private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

	private double nd() { return Double.parseDouble(ns()); }
	private char nc() { return (char)skip(); }

	private String ns()
	{
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	private char[] ns(int n)
	{
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while(p < n && !(isSpaceChar(b))){
			buf[p++] = (char)b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}

	private char[][] nm(int n, int m)
	{
		char[][] map = new char[n][];
		for(int i = 0;i < n;i++)map[i] = ns(m);
		return map;
	}

	private int[] na(int n)
	{
		int[] a = new int[n];
		for(int i = 0;i < n;i++)a[i] = ni();
		return a;
	}

	private int ni()
	{
		int num = 0, b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private long nl()
	{
		long num = 0;
		int b;
		boolean minus = false;
		while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
		if(b == '-'){
			minus = true;
			b = readByte();
		}

		while(true){
			if(b >= '0' && b <= '9'){
				num = num * 10 + (b - '0');
			}else{
				return minus ? -num : num;
			}
			b = readByte();
		}
	}

	private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
	private void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
}


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

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

    static class TaskC {
        public static boolean angle(TaskC.Point a, TaskC.Point b) {
            double amag = a.mag();
            double bmag = b.mag();
            double abmag = a.v * b.v + a.w * b.w + a.x * b.x + a.y * b.y + a.z * b.z;
            double angle = Math.toDegrees(Math.acos(abmag / (amag * bmag)));
            if (angle < 90) {
                return true;
            }
            return false;
        }

        public void solve(int testNumber, FastScanner in, PrintWriter out) {
            int n = in.nextInt();
            if (n > 11) {
                out.println("0");
            } else {
                HashSet<Integer> good = new HashSet<Integer>();
                ArrayList<TaskC.Point> arr = new ArrayList<>();
                for (int i = 0; i < n; i++) {
                    int a = in.nextInt();
                    int b = in.nextInt();
                    int c = in.nextInt();
                    int d = in.nextInt();
                    int e = in.nextInt();
                    TaskC.Point p = new TaskC.Point(a, b, c, d, e);
                    arr.add(p);
                }
                for (int i = 0; i < n; i++) {
                    boolean b = true;
                    for (int j = 0; j < n; j++) {
                        for (int k = 0; k < n; k++) {
                            if (i != j && i != k && j != k) {
                                TaskC.Point one = arr.get(j);
                                TaskC.Point two = arr.get(k);
                                TaskC.Point three = arr.get(i);
                                TaskC.Point lol2 = new TaskC.Point(one.v - three.v, one.w - three.w, one.x - three.x, one.y - three.y, one.z - three.z);
                                TaskC.Point lol1 = new TaskC.Point(two.v - three.v, two.w - three.w, two.x - three.x, two.y - three.y, two.z - three.z);
                                if (angle(lol1, lol2)) {
                                    b = false;
                                }
                            }
                        }
                    }
                    if (b) {
                        good.add(i + 1);
                    }
                }
                if (good.size() == 0) {
                    out.println("0");
                } else {
                    out.println(good.size());
                    for (int i : good) {
                        out.println(i);
                    }
                }
            }
        }

        public static class Point {
            int v;
            int w;
            int x;
            int y;
            int z;

            public Point(int a, int b, int c, int d, int e) {
                v = a;
                w = b;
                x = c;
                y = d;
                z = e;
            }

            public double mag() {
                return Math.sqrt(v * v + w * w + x * x + y * y + z * z);
            }

        }

    }

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

        public FastScanner(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());
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;
import java.util.Set;
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 Yogesh Kumar a.k.a DREAMPLAY
 */
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) {
//        System.out.println(Math.toDegrees(Math.acos(0.5)));
            int n = in.nextInt();
            if (n >= 100) {
                out.print(0);
            } else {
                int[] a = new int[105];
                int[] b = new int[105];
                int[] c = new int[105];
                int[] d = new int[105];
                int[] e = new int[105];
                for (int i = 1; i <= n; i++) {
                    a[i] = in.nextInt();
                    b[i] = in.nextInt();
                    c[i] = in.nextInt();
                    d[i] = in.nextInt();
                    e[i] = in.nextInt();
                }

                Set<Integer> bad = new HashSet<>();

                for (int i = 1; i <= n; i++) {
                    for (int j = 1; j <= n; j++) {
                        for (int k = 1; k <= n; k++) {
                            if (i == j || j == k || k == i) {
                                continue;
                            }

                            long ax = a[j] - a[i];
                            long bx = b[j] - b[i];
                            long cx = c[j] - c[i];
                            long dx = d[j] - d[i];
                            long ex = e[j] - e[i];

                            long ay = a[k] - a[i];
                            long by = b[k] - b[i];
                            long cy = c[k] - c[i];
                            long dy = d[k] - d[i];
                            long ey = e[k] - e[i];

                            double val = ax * ay + bx * by + cx * cy + dx * dy + ex * ey;
                            long m1 = ax * ax + bx * bx + cx * cx + dx * dx + ex * ex;
                            long m2 = ay * ay + by * by + cy * cy + dy * dy + ey * ey;
                            val = val / Math.sqrt(m1);
                            val = val / Math.sqrt(m2);
                            if (Math.toDegrees(Math.acos(val)) + 0.000000001 < 90) {
                                bad.add(i);
                            }
                        }
                    }
                }

                out.println(n - bad.size());

                for (int i = 1; i <= n; i++) {
                    if (!bad.contains(i)) {
                        out.println(i);
                    }
                }
            }
        }

    }

    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());
        }

    }
}


import java.util.*;
import java.io.*;
/*
TASK: fivedimpoints
LANG: JAVA
 */

public class fivedimpoints{
    static int n;
    static int[][] coord;
    static long[][][] vect;
    static boolean[] bad;

    public static void main(String[] args) throws IOException{
        FastScanner in = new FastScanner(System.in);
        n = in.nextInt();
        if(n > 11){
            System.out.println(0);
            return;
        }
        coord = new int[n][5];
        vect = new long[n][n][5];
        bad = new boolean[n];
        for(int i = 0;i <n; i++){
            for(int j = 0;j < 5;j++){
                coord[i][j] = in.nextInt();
            }
        }
        for(int i = 0;i < n; i++){
            for(int j = 0;j < n; j++){
                for(int k = 0; k < 5; k++){
                    vect[i][j][k] = coord[j][k] - coord[i][k];
                }
            }
        }
        int count = n;
        long prod;
        for(int i = 0;i < n; i++){
            for(int j = 0;j < n; j++){
                if(j != i){
                    for(int k = 0; k < n; k++){
                        if(k != j && k != i){
                            prod = 0;
                            for(int m = 0; m < 5; m++){
                                prod += vect[j][i][m]*vect[k][i][m];
                            }
                            if(prod > 0 && !bad[i]){
                                bad[i] = true;
                                count--;
                            }
                        }
                    }
                }
            }
        }
        System.out.println(count);
        for(int i = 0;i < n; i++){
            if(!bad[i]){
                System.out.println(i+1);
            }
        }
    }
}
class FastScanner{
    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;

    public FastScanner(InputStream stream) {
        this.stream = stream;
    }
    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++];
    }

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

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

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

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

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

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

    public String nextLine() {
        int c = read();
        while (isEndline(c))
            c = read();
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isEndline(c));
        return res.toString();
    }
}


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

import static java.lang.Math.*;

public class Main implements Runnable
{
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

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

		public 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 String nextLine()
		{
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

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

		public double nextDouble()
		{
			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 == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				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 == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			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 String next()
		{
			return readString();
		}

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

	public static void main(String args[]) throws Exception
	{
		new Thread(null, new Main(),"Main",1<<26).start();
	}

	int findAngle(Point p1, Point p2)
    {
            return p1.a * p2.a + p1.b * p2.b + p1.c * p2.c + p1.d * p2.d + p1.e * p2.e;
    }

	Point makeVector(Point p1, Point p2)
    {
        return  new Point(p1.a - p2.a, p1.b - p2.b, p1.c - p2.c, p1.d - p2.d, p1.e - p2.e);
    }

    public void run()
	{
		InputReader sc = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int n = sc.nextInt();

                if(n > 20)
                {
                    w.print("0");
                    w.close();
                    return;
                }

                Point point[] = new Point[n];
                for(int i = 0; i < n; ++i)
                {
                    point[i] = new Point(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
                }

                ArrayList<Integer> ans = new ArrayList<>();
                for(int i = 0; i < n; ++i)
                {
                    int flag = 0;
                    midloop:for(int j = 0; j < n; ++j)
                    {
                        for(int k= 0; k< n && j != i; ++k)
                        {
                            if(k != j && k != i)
                            {
                                Point p1 = makeVector(point[i], point[j]);
                                Point p2 = makeVector(point[i], point[k]);
                                int value = findAngle(p1, p2);
                                if(value > 0)
                                {
                                    flag = 1;
                                    break midloop;
                                }
                            }
                        }
                    }
                    if(flag == 0)
                        ans.add(i);
                }

                w.println(ans.size());
                for(int i = 0; i < ans.size(); ++i)
                {
                    w.println((ans.get(i) + 1));
                }
		w.close();
	}
}
class Point
{
    int a,b,c,d,e;
    Point(int a, int b, int c, int d, int e)
    {
        this.a = a;
        this.b = b;
        this.c = c;
        this.d = d;
        this.e = e;
    }
}


import java.util.ArrayList;
import java.util.Scanner;

public class P851C
{
	static double eps = 1e-9;
	public static void main(String[] args)
	{
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if (n > 11)
		{
			System.out.println(0);
			return;
		}
		int[][] arr = new int[n][5];
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < 5; j++)
			{
				arr[i][j] = scan.nextInt();
			}
		}
		ArrayList<Integer> list = new ArrayList<>();
		for (int i = 0; i < n; i++)
		{
			boolean good = true;
			Loop:
			for (int j = 0; j < n; j++)
			{
				if (j == i)
					continue;
				for (int k = j+1; k < n; k++)
				{
					if (k == i)
						continue;
					Vector v1 = new Vector(arr[i], arr[j]);
					Vector v2 = new Vector(arr[i], arr[k]);
					double angle = Math.acos(v1.prod(v2)/(v1.mag()*v2.mag()));
					if (angle < Math.PI/2-eps)
					{
						good = false;
						break Loop;
					}
				}
			}
			if (good)
				list.add(i+1);
		}
		System.out.println(list.size());
		for (int i : list)
			System.out.println(i);
	}
	static class Vector
	{
		int[] arr = new int[5];
		Vector(int[] a, int[] b)
		{
			for (int i = 0; i < 5; i++)
			{
				arr[i] = b[i]-a[i];
			}
		}
		double mag()
		{
			double sum = 0;
			for (int i = 0; i < arr.length; i++)
			{
				sum += arr[i]*arr[i];
			}
			return Math.sqrt(sum);
		}
		int prod(Vector v)
		{
			int sum = 0;
			for (int i = 0; i < arr.length; i++)
			{
				sum += arr[i]*v.arr[i];
			}
			return sum;
		}
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.ArrayList;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Yuan Lei
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(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, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            if (n > 40) {
                out.println(0);
                return;
            } else {
                final ArrayList<TaskC.Point> points = new ArrayList<>();
                for (int i = 0; i < n; ++i) {
                    int a, b, c, d, e;
                    a = in.nextInt();
                    b = in.nextInt();
                    c = in.nextInt();
                    d = in.nextInt();
                    e = in.nextInt();
                    points.add(new TaskC.Point(a, b, c, d, e));
                }
                if (n < 3) {
                    out.println(n);
                    for (int i = 1; i <= n; ++i) {
                        out.println(i);
                    }
                    return;
                }
                ArrayList<Integer> result = new ArrayList<>();
                for (int center = 0; center < n; ++center) {
                    boolean find = false;
                    for (int a = 0; a < n; ++a)
                        if (a != center) {
                            for (int b = 0; b < n; ++b)
                                if (b != center && b != a) {
                                    TaskC.Point A = points.get(a).minus(points.get(center));
                                    TaskC.Point B = points.get(b).minus(points.get(center));
                                    if (A.dot(B)) {
                                        find = true;
                                        break;
                                    }
                                }
                            if (find) break;
                        }
                    if (!find) result.add(center + 1);
                }
                out.println(result.size());
                for (int id : result) {
                    out.println(id);
                }
            }
        }

        static class Point {
            long a;
            long b;
            long c;
            long d;
            long e;

            public Point(long a, long b, long c, long d, long e) {
                this.a = a;
                this.b = b;
                this.c = c;
                this.d = d;
                this.e = e;
            }

            boolean dot(final TaskC.Point rhs) {
                return a * rhs.a + b * rhs.b + c * rhs.c + d * rhs.d + e * rhs.e > 0;
            }

            TaskC.Point minus(final TaskC.Point rhs) {
                return new TaskC.Point(a - rhs.a, b - rhs.b, c - rhs.c, d - rhs.d, e - rhs.e);
            }

        }

    }
}


import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

/**
 * Created by Pranav ps on 04-09-2017.
 */
public class wedss {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n <= 11){
            long[][] points = new long[n][5];

            for(int i = 0 ; i < n; i++){
                for (int j = 0; j < 5; j++) {
                    points[i][j] = sc.nextLong();
                }
            }

            long[][][] vectors = new long[n][n][5];
            for(int i = 0; i < n; i++){
                for(int j = 0; j < n; j++){
                    for (int k = 0; k < 5; k++) {
                        vectors[i][j][k] = points[j][k] - points[i][k];
                    }
                }
            }

            HashSet<Integer> list = new HashSet<>();

            for(int i = 0; i < n; i++){
                boolean flag = false;
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        if(!equal(vectors[i][j],vectors[i][k]) && dot(vectors[i][j],vectors[i][k])){
                            list.add(i+1);
                            flag = true;
                            break;
                        }
                    }
                    if(flag)
                        break;
                }
            }

            System.out.println(n - list.size());
            for(int i = 0; i < n; i++){
                if(!list.contains(i+1))
                    System.out.println(i+1);
            }
        }
        else{
            System.out.println(0);
        }
    }
    private static boolean equal(long[] a, long[] b){
        boolean res = true;
        for(int i = 0 ; i < 5; i++){
            res &= a[i]==b[i];
        }
        return res;
    }
    private static boolean dot(long[] a, long[] b){
        long res = 0;
        for(int i = 0 ; i < 5; i++){
            res += a[i]*b[i];
        }

        return res>0;
    }
}


import java.io.*;
import java.math.*;
import java.util.*;
public class Main{

  public static long sq(long a){
    return a*a;
  }
  public static long distSq(long ax, long ay, long bx, long by){
    return sq(ax-bx)+sq(ay-by);
  }

  public static class Point{
    long x1;
    long x2;
    long x3;
    long x4;
    long x5;

    public Point(long x1, long x2, long x3, long x4, long x5){
      this.x1 = x1;
      this.x2 = x2;
      this.x3 = x3;
      this.x4 = x4;
      this.x5 = x5;
    }

    private static long sq(long x){
      return x*x;
    }
    public long lenSq(){
      return sq(x1)+sq(x2)+sq(x3)+sq(x4)+sq(x5);
    }

    public long prod(Point other){
      return this.x1*other.x1 + this.x2*other.x2 + this.x3*other.x3 + this.x4*other.x4 + this.x5*other.x5;
    }

    public Point sub(Point other){
      return new Point(this.x1-other.x1,this.x2-other.x2,this.x3-other.x3,this.x4-other.x4,this.x5-other.x5);
    }

  }

  public static boolean check(ArrayList<Point> points, int i){
    Point ith = points.get(i);
    int n = points.size();
    for(int j=0; j<n; ++j){
      if(j == i){
        continue;
      }
      for(int k=0; k<n; k++){
        if(k == i || k == j){
            continue;
        }

        Point x = points.get(j).sub(ith);
        Point y = points.get(k).sub(ith);
        if(x.prod(y) > 0){
          return false;
        }
      }
    }
    return true;
  }

  public static void main(String[] args){
    InputReader reader = new InputReader(System.in);
    PrintWriter pw = new PrintWriter(System.out);
    int n = reader.nextInt();
    if(n > 11){
      pw.printf("0\n");
      pw.flush();
      pw.close();
      return;
    }
    ArrayList<Point> points = new ArrayList<Point>(n);
    for(int i=0; i<n; ++i){
      points.add(new Point(reader.nextLong(), reader.nextLong(), reader.nextLong(), reader.nextLong(), reader.nextLong()));
    }

    ArrayList<Integer> ret = new ArrayList<Integer>(11);
    for(int i=0; i<n; ++i){
      if(check(points,i)){
        ret.add(i+1);
      }
    }

    pw.printf("%d\n", ret.size());
    for(Integer x : ret){
      pw.printf("%d\n", x);
    }
    pw.flush();
    pw.close();
  }

  public static class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

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

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

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

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

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

    public BigInteger nextBigInteger(){
      return new BigInteger(next());
    }

    public String nextLine(){
      String line = "";
      try{
        while(line.equals("")){
          line = reader.readLine();
        }
      } catch(IOException ioe){
        throw new RuntimeException(ioe);
      }
      return line;
    }
  }

}


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

import static java.lang.Math.*;

public class Main implements Runnable
{
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		private BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

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

		public 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 String nextLine()
		{
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

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

		public double nextDouble()
		{
			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 == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				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 == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			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 String next()
		{
			return readString();
		}

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

	public static void main(String args[]) throws Exception
	{
		new Thread(null, new Main(),"Main",1<<26).start();
	}

	int findAngle(Point p1, Point p2)
    {
            return p1.a * p2.a + p1.b * p2.b + p1.c * p2.c + p1.d * p2.d + p1.e * p2.e;
    }

	Point makeVector(Point p1, Point p2)
    {
        return  new Point(p1.a - p2.a, p1.b - p2.b, p1.c - p2.c, p1.d - p2.d, p1.e - p2.e);
    }

    public void run()
	{
		InputReader sc = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);
		int n = sc.nextInt();

                if(n > 32)
                {
                    w.print("0");
                    w.close();
                    return;
                }

                Point point[] = new Point[n];
                for(int i = 0; i < n; ++i)
                {
                    point[i] = new Point(sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt(), sc.nextInt());
                }

                ArrayList<Integer> ans = new ArrayList<>();
                for(int i = 0; i < n; ++i)
                {
                    int flag = 0;
                    midloop:for(int j = 0; j < n; ++j)
                    {
                        for(int k= 0; k< n && j != i; ++k)
                        {
                            if(k != j && k != i)
                            {
                                Point p1 = makeVector(point[i], point[j]);
                                Point p2 = makeVector(point[i], point[k]);
                                int value = findAngle(p1, p2);
                                if(value > 0)
                                {
                                    flag = 1;
                                    break midloop;
                                }
                            }
                        }
                    }
                    if(flag == 0)
                        ans.add(i);
                }

                w.println(ans.size());
                for(int i = 0; i < ans.size(); ++i)
                {
                    w.println((ans.get(i) + 1));
                }
		w.close();
	}
}
class Point
{
    int a,b,c,d,e;
    Point(int a, int b, int c, int d, int e)
    {
        this.a = a;
        this.b = b;
        this.c = c;
        this.d = d;
        this.e = e;
    }
}


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

public class Main {

    static Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
    static Reader fastInput = new Reader();

    public static void main(String[] args) throws IOException {
        int n = fastInput.nextInt();
        if (n > 20) {
            System.out.println(0);
        } else {
            int[][] p = new int[n][5];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < 5; j++) {
                    p[i][j] = fastInput.nextInt();
                }
            }
            ArrayList<Integer> good = new ArrayList<>();
            loop:
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < n; j++) {
                    if (i != j) {
                        for (int k = j + 1; k < n; k++) {
                            if (i != k) {
                                if (getAn(p[i], p[j], p[k]) < 90) {
                                    continue loop;
                                }
                            }
                        }
                    }
                }
                good.add(i + 1);
            }
            System.out.println(good.size());
            for (int i = 0; i < good.size(); i++) {
                System.out.println(good.get(i));
            }
        }
    }

    static double getAn(int[] p1, int[] p2, int[] p3) {
        double dot = 0, aLen = 0, bLen = 0;
        for (int i = 0; i < p1.length; i++) {
            dot += (p2[i] - p1[i]) * (p3[i] - p1[i]);
            aLen += (p2[i] - p1[i]) * (p2[i] - p1[i]);
            bLen += (p3[i] - p1[i]) * (p3[i] - p1[i]);
        }
        return 180 * Math.acos(dot / Math.sqrt(aLen * bLen)) / Math.PI;
    }

    static class Reader {

        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n') {
                    break;
                }
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg) {
                c = read();
            }
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg) {
                return -ret;
            }
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg) {
                c = read();
            }
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg) {
                return -ret;
            }
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ') {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg) {
                c = read();
            }

            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg) {
                return -ret;
            }
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) {
                buffer[0] = -1;
            }
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead) {
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null) {
                return;
            }
            din.close();
        }
    }
}


import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.NoSuchElementException;

public class Main {
	private static FastScanner sc = new FastScanner();

	public static void main(String[] args) {
		int n = sc.nextInt();
		if(n >= 12) {
			System.out.println("0");
			return;
		}

		int[][] a = new int[n][5];
		for(int i=0; i<n; i++) {
			for(int j=0; j<5; j++) {
				a[i][j] = sc.nextInt();
			}
		}

		ArrayList<Integer> ans = new ArrayList<>();
		for(int i=0; i<n; i++) {
			boolean flag = true;
			loop:
			for(int j=0; j<n; j++) {
				for(int k=0; k<n; k++) {
					if(i == j || j == k || k == i) continue;
					int sum = 0;
					for(int l=0; l<5; l++) {
						sum += (a[j][l] - a[i][l]) * (a[k][l] - a[i][l]);
					}
					if(sum > 0) {
						flag = false;
						break loop;
					}
				}
			}

			if(flag) {
				ans.add(i + 1);
			}
		}

		System.out.println(ans.size());
		for(int i=0; i<ans.size(); i++) {
			System.out.println(ans.get(i));
		}
	}

	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}


import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

/**
 * Created by Pranav ps on 04-09-2017.
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n <= 11){
            long[][] points = new long[n][5];

            for(int i = 0 ; i < n; i++){
                for (int j = 0; j < 5; j++) {
                    points[i][j] = sc.nextLong();
                }
            }

            long[][][] vectors = new long[n][n][5];
            for(int i = 0; i < n; i++){
                for(int j = 0; j < n; j++){
                    for (int k = 0; k < 5; k++) {
                        vectors[i][j][k] = points[j][k] - points[i][k];
                    }
                }
            }

            HashSet<Integer> list = new HashSet<>();

            for(int i = 0; i < n; i++){
                boolean flag = false;
                for (int j = 0; j < n; j++) {
                    for (int k = 0; k < n; k++) {
                        if(!equal(vectors[i][j],vectors[i][k]) && dot(vectors[i][j],vectors[i][k])){
                            list.add(i+1);
                            flag = true;
                            break;
                        }
                    }
                    if(flag)
                        break;
                }
            }

            System.out.println(n - list.size());
            for(int i = 0; i < n; i++){
                if(!list.contains(i+1))
                    System.out.println(i+1);
            }
        }
        else{
            System.out.println(0);
        }
    }
    private static boolean equal(long[] a, long[] b){
        boolean res = true;
        for(int i = 0 ; i < 5; i++){
            res &= a[i]==b[i];
        }
        return res;
    }
    private static boolean dot(long[] a, long[] b){
        long res = 0;
        for(int i = 0 ; i < 5; i++){
            res += a[i]*b[i];
        }

        return res>0;
    }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int mod=1000000007;
        int[][] bell = new int[4010][4010];
        bell[0][0]=1;
        Scanner scan=new Scanner(System.in);
        int n = scan.nextInt();
        for(int i=1;i<=n;i++){
            bell[i][0]=bell[i-1][i-1];
            for(int j=1;j<=i;j++){
                bell[i][j]=bell[i-1][j-1]+bell[i][j-1];
                bell[i][j]%=mod;
            }
        }
        System.out.println(bell[n][n-1]);
    }
}


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

public class Main {
    private static class Solver {
        private void Solve() {
            final int MOD = (int) 1e9 + 7;

            int n = inp.nextInt();
            String S = " " + inp.next();
            int m = S.length() - 1;

            int[] kmp = new int[m + 1];
            kmp[0] = -1;
            for (int i = 1; i <= m; ++i) {
                kmp[i] = 0;
                for (int j = kmp[i - 1]; j != -1; j = kmp[j]) {
                    if (S.charAt(j + 1) == S.charAt(i)) {
                        kmp[i] = j + 1;
                        break;
                    }
                }
            }

            int[][] nxt = new int[m + 1][2];
            for (int i = 0; i < m; ++i) {
                for (int k = 0; k < 2; ++k) {
                    nxt[i][k] = 0;
                    for (int j = i; j != -1; j = kmp[j]) {
                        if (S.charAt(j + 1) == '(' + k) {
                            nxt[i][k] = j + 1;
                            break;
                        }
                    }
                }
            }

            int[][][] dp = new int[n * 2 + 1][n + 1][m + 1];
            for (int i = 0; i <= n * 2; ++i) {
                for (int j = 0; j <= n; ++j) {
                    for (int k = 0; k <= m; ++k) {
                        dp[i][j][k] = 0;
                    }
                }
            }

            dp[0][0][0] = 1;
            for (int i = 0; i < n * 2; ++i) {
                for (int depth = 0; depth <= n; ++depth) {
                    for (int pref = 0; pref < m; ++pref) {
                        if (dp[i][depth][pref] == 0) {
                            continue;
                        }

                        for (int k = 0; k < 2; ++k) {
                            int newDepth = depth + (k == 0 ? 1 : -1);
                            if (newDepth < 0 || newDepth > n) {
                                continue;
                            }
                            dp[i + 1][newDepth][nxt[pref][k]] += dp[i][depth][pref];
                            if (dp[i + 1][newDepth][nxt[pref][k]] >= MOD) {
                                dp[i + 1][newDepth][nxt[pref][k]] -= MOD;
                            }
                        }
                    }
                }
            }

            int[][] f = new int[n * 2 + 1][n * 2 + 1];
            for (int i = 0; i <= n * 2; ++i) {
                for (int j = 0; j <= n * 2; ++j) {
                    f[i][j] = 0;
                }
            }

            f[0][0] = 1;
            for (int i = 0; i < n * 2; ++i) {
                for (int depth = 0; depth <= n; ++depth) {
                    for (int k = 0; k < 2; ++k) {
                        int newDepth = depth + (k == 0 ? -1 : 1);
                        if (newDepth < 0 || newDepth > n) {
                            continue;
                        }
                        f[i + 1][newDepth] += f[i][depth];
                        if (f[i + 1][newDepth] >= MOD) {
                            f[i + 1][newDepth] -= MOD;
                        }
                    }
                }
            }

            int ans = f[n * 2][0];
            for (int i = 0; i < m; ++i) {
                ans -= dp[n * 2][0][i];
                if (ans < 0) {
                    ans += MOD;
                }
            }
            out.println(ans);
        }
        static InputReader inp;
        static PrintWriter out;
    }

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

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

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

        private int nextInt() {
            return Integer.parseInt(next());
        }
        private long nextLong() {
            return Long.parseLong(next());
        }
        private int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; ++i) {
                a[i] = nextInt();
            }
            return a;
        }
    }
    public static void main(String[] args) throws IOException {
        if (!"true".equals(System.getProperty("ONLINE_JUDGE"))) {
            System.setIn(new FileInputStream(new File("input.txt")));
        }
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Solver.inp = new InputReader(inputStream);
        Solver.out = new PrintWriter(outputStream);
        Solver solver = new Solver();
        solver.Solve();
        Solver.out.close();
    }
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

public class DimaAndHorses {
	static int[] locHorse;
	static List<List<Integer>> enemies;
	public static void main(String[] args){
		FastScanner sc= new FastScanner();

		int n = sc.nextInt();
		int m = sc.nextInt();

		//enemies[i] = list of enemies of horse i
		enemies = new ArrayList<List<Integer>>();
		for(int horse=0;horse<=n;horse++){
			enemies.add(new ArrayList<Integer>());
		}

		for(int i=1;i<=m;i++){
			int h1 = sc.nextInt();
			int h2 = sc.nextInt();
			enemies.get(h1).add(h2);
			enemies.get(h2).add(h1);
		}

		//all horse in group 0 initially
		locHorse = new int[n+1];
		for(int horse=1;horse<=n;horse++){
			jump(horse);
		}
		for(int horse=1;horse<=n;horse++){
			System.out.print(locHorse[horse]);
		}
	}

	public static void jump(int horse){
		int countEnemy = 0;
		for(Integer enemy : enemies.get(horse)){
			if(locHorse[enemy] == locHorse[horse]){
				countEnemy++;
			}
		}
		if(countEnemy >= 2){
			locHorse[horse] = locHorse[horse] == 0 ? 1 : 0;
			for(Integer enemy : enemies.get(horse)){
				if(locHorse[enemy] == locHorse[horse]){
					jump(enemy);
				}
			}
		}
	}

	public static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

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

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

		String nextToken() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Set;

/**
 * @author Egor Kulikov (egor@egork.net)
 */
public class TaskE {
	@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
	private InputReader in;
	private PrintWriter out;
	private int[] dRow = {0, 1, 1};
	private int[] dColumn = {2, 1, -1};

	private void solve() {
		int[][] field = new int[5][9];
		for (int[] row : field)
			Arrays.fill(row, -1);
		int index = 0;
		for (int i = 0; i < 3; i++) {
			for (int j = 2 - i; j < 7 + i; j += 2)
				field[i][j] = index++;
		}
		for (int i = 3; i < 5; i++) {
			for (int j = i - 2; j < 8; j += 2)
				field[i][j] = index++;
		}
		Set<Integer> moves = new HashSet<Integer>();
		for (int i = 0; i < 5; i++) {
			for (int j = 0; j < 9; j++) {
				if (field[i][j] == -1)
					continue;
				for (int k = 0; k < 3; k++) {
					int currentMove = 0;
					int row = i;
					int column = j;
					while (row < 5 && column < 9 && column >= 0 && field[row][column] != -1) {
						currentMove += 1 << field[row][column];
						moves.add(currentMove);
						row += dRow[k];
						column += dColumn[k];
					}
				}
			}
		}
		Integer[] allMoves = moves.toArray(new Integer[moves.size()]);
		int startPosition = 0;
		for (int i = 0; i < 19; i++) {
			if (in.readCharacter() == 'O')
				startPosition += 1 << i;
		}
		boolean[] winner = new boolean[1 << 19];
		for (int i = 1; i <= startPosition; i++) {
			if ((startPosition & i) != i)
				continue;
			for (int move : allMoves) {
				if ((i & move) == move && !winner[i - move]) {
					winner[i] = true;
					break;
				}
			}
		}
		out.println(winner[startPosition] ? "Karlsson" : "Lillebror");
	}

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

	private TaskE() {
		@SuppressWarnings({"UnusedDeclaration"})
		String id = getClass().getName().toLowerCase();
		//noinspection EmptyTryBlock
		try {
//			System.setIn(new FileInputStream(id + ".in"));
//			System.setOut(new PrintStream(new FileOutputStream(id + ".out")));
//			System.setIn(new FileInputStream("input.txt"));
//			System.setOut(new PrintStream(new FileOutputStream("output.txt")));
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		in = new InputReader(System.in);
		out = new PrintWriter(System.out);
	}

	private void run() {
		//noinspection InfiniteLoopStatement
//		while (true)
//		int testCount = in.readInt();
//		for (int i = 0; i < testCount; i++)
		solve();
		exit();
	}

	@SuppressWarnings({"UnusedDeclaration"})
	private void exit() {
		out.close();
		System.exit(0);
	}

	@SuppressWarnings({"UnusedDeclaration"})
	private static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar, numChars;

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

		public 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 int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

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

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

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

		private String readLine0() {
			StringBuffer buf = new StringBuffer();
			int c = read();
			while (c != '\n' && c != -1) {
				if (c != '\r')
					buf.appendCodePoint(c);
				c = read();
			}
			return buf.toString();
		}

		public String readLine() {
			String s = readLine0();
			while (s.trim().length() == 0)
				s = readLine0();
			return s;
		}

		public String readLine(boolean ignoreEmptyLines) {
			if (ignoreEmptyLines)
				return readLine();
			else
				return readLine0();
		}

		public BigInteger readBigInteger() {
			try {
				return new BigInteger(readString());
			} catch (NumberFormatException e) {
				throw new InputMismatchException();
			}
		}

		public char readCharacter() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			return (char) c;
		}

		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 == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				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 == 'e' || c == 'E')
						return res * Math.pow(10, readInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public int[] readIntArray(int size) {
			int[] array = new int[size];
			for (int i = 0; i < size; i++)
				array[i] = readInt();
			return array;
		}

		public long[] readLongArray(int size) {
			long[] array = new long[size];
			for (int i = 0; i < size; i++)
				array[i] = readLong();
			return array;
		}

		public double[] readDoubleArray(int size) {
			double[] array = new double[size];
			for (int i = 0; i < size; i++)
				array[i] = readDouble();
			return array;
		}

		public String[] readStringArray(int size) {
			String[] array = new String[size];
			for (int i = 0; i < size; i++)
				array[i] = readString();
			return array;
		}

		public char[][] readTable(int rowCount, int columnCount) {
			char[][] table = new char[rowCount][columnCount];
			for (int i = 0; i < rowCount; i++) {
				for (int j = 0; j < columnCount; j++)
					table[i][j] = readCharacter();
			}
			return table;
		}

		public void readIntArrays(int[]... arrays) {
			for (int i = 0; i < arrays[0].length; i++) {
				for (int j = 0; j < arrays.length; j++)
					arrays[j][i] = readInt();
			}
		}
	}
}


import java.util.*;
public class SweetsGame {
	//    0	1	2
	//    3	4	5	6
	//    7	8	9	10	11
	//    12	13	14	15
	//    16	17 	18
	static int [] dp = new int [1<<20];
	static int [] dx = {-2, -1, 1, 2, 1, -1};
	static int [] dy = {0, 1,  1, 0, -1, -1};
	static int [] len = new int[]{3,4,5,4,3};
	public static void main (String [] arg) {
		Scanner sc = new Scanner(System.in);

		boolean [][] state = new boolean [5][9];
		int cnt = 0;
		for (int i = 0; i<len.length; ++i) {
			int offset = (i % 2) + ((len[i] == 3) ? 2 : 0);
			for (int j = 0; j<len[i]; ++j) {
				String s = sc.next();
				state[i][offset+2*j] = (s.charAt(0) == '.') ? false : true;
				if (state[i][offset+2*j]) ++cnt;
			}
		}
		Arrays.fill(dp,-1);
		boolean who = canwin(state, cnt);
		System.out.println((who) ? "Karlsson" : "Lillebror");

	}
	public static boolean canwin (boolean [][] state, int left) {
		if (left <= 0) return false;
		int V = toInt(state);
		if (dp[V] >= 0) return (dp[V] != 0);

		boolean canwin = false;
		for (int i = 0; i<len.length; ++i) {
			for (int j = 0; j<state[i].length && !canwin; ++j) {
				if (!state[i][j]) continue;
				state[i][j] = false;
				canwin |= !canwin(state, left-1);
				for (int k = 0; k<dx.length; ++k) {
					for (int len = 1; ; ++len) {
						int i1 = dy[k]*len + i;
						int j1 = dx[k]*len + j;
						if (i1 < 0 || j1 < 0 || i1 >= state.length || j1 >= state[i].length || !state[i1][j1]) {
							while (len-- > 1) {
								i1 -= dy[k];
								j1 -= dx[k];
								state[i1][j1] = true;
							}
							break;
						}
						state[i1][j1] = false;
						canwin |= !canwin(state,left-len-1);
					}
				}
				state[i][j] = true;
			}
		}
		//System.out.println(toString(state) + " : " + canwin);
		dp[V] = (canwin) ? 1 : 0;
		return canwin;

	}
	public static String toString (boolean [][] state) {
		String s = "";
		for (int i = 0; i<state.length; ++i) {
			for (int j = 0; j<state[i].length; ++j) {
				s += (state[i][j]) ? "o" : ".";
			}
			s+="\n";
		}
		return s;
	}
	public static int toInt (boolean [][] state) {
		int cnt = 0;
		int ans = 0;
		for (int i = 0; i<len.length; ++i) {
			int offset = (i & 1) + ((len[i] == 3) ? 2 : 0);
			for (int j = 0; j<len[i]; ++j) {
				if (state[i][offset+2*j]) ans |= (1<<cnt);
				cnt++;
			}
		}
		return ans;
	}
}


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

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;

	private String next() throws Exception{
		while (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

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

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

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

	int []dp;
	int n = 5, m = 9;
	int []x,y;

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		char [][]a = new char[n][];
		for(int i=0;i<n;i++) {
			// String x = in.readLine();
			// while(x.length() < m) x+=" ";
			a[i] = in.readLine().toCharArray();
		}

		x = new int[19];
		y = new int[19];
		int at = 0;
		for(int i=0;i<n;i++){
			for(int j=0;j<a[i].length;j++){
				if (a[i][j] != ' ') {
					x[at] = i;
					y[at++] = j;
				}
			}
		}

		// print(a);

		dp = new int[1 << 19];
		Arrays.fill(dp, -1);

		dp[262143]=1;
		dp[393215]=1;
		dp[458751]=1;
		dp[491519]=1;
		dp[507903]=1;
		dp[516095]=1;
		dp[520191]=1;
		dp[522239]=1;
		dp[523263]=1;
		dp[523775]=0;
		dp[524031]=1;
		dp[524159]=1;
		dp[524223]=1;
		dp[524255]=1;
		dp[524271]=1;
		dp[524279]=1;
		dp[524283]=1;
		dp[524285]=1;
		dp[524286]=1;
		dp[524287]=1;

		int mask = encode(a);
		// print(decode(mask));
		boolean r = dfs(mask);

		if (r) out.println("Karlsson");
		else out.println("Lillebror");
		// out.println("{");
		// for(int i=0;i<1<<19;i++){
		// 	if (Integer.bitCount(i) >= 18) {
		// 		if (dp[i] == -1) dfs(i);
		// 		out.println("dp["+i+"]="+dp[i]+";");
		// 	}
		// }
		// out.println("}");
		out.close();
	}

	int di[] = new int[]{0,  0, 1, -1, 1,  1, -1, -1};
	int dj[] = new int[]{2, -2, 0,  0, 1, -1, -1,  1};

	private boolean dfs(int mask) {
		if (mask == 0) return false;
		if (dp[mask] != -1) return dp[mask] > 0;

		// System.out.println(mask);

		char [][]a = decode(mask);
		char [][]b;
		for(int i=0;i<19;i++){
			if (a[x[i]][y[i]] == 'O') {
				for(int k=0;k<di.length;k++){
					int ni = x[i], nj = y[i];
					b = copy(a);
					while(inRange(ni, nj) && b[ni][nj] == 'O') {
						b[ni][nj] = '.';
						int nmask = encode(b);
						// System.out.println("from ");
						// print(a);
						// System.out.println("to ");
						// print(b);
						if (!dfs(nmask)) {
							dp[mask] = 1;
							return true;
						}
						ni+=di[k];
						nj+=dj[k];
					}
				}
			}
		}

		dp[mask] = 0;
		return false;
	}

	private boolean inRange(int i, int j) {
		if (i < 0 || j < 0) return false;
		if (i >= n || j >= m) return false;
		return true;
	}

	private void print(char [][]a) {
		for(int i=0;i<n;i++) System.out.println(Arrays.toString(a[i]));
		System.out.println();
	}

	private char[][] copy(char [][]a) {
		char [][]b = a.clone();
		for(int i=0;i<n;i++) {
			b[i] = b[i].clone();
		}
		return b;
	}

	private int encode(char [][]a) {
		int mask = 0;
		for(int i=0;i<19;i++){
			if (a[x[i]][y[i]] == 'O') {
				mask|=1<<i;
			}
		}
		return mask;
	}

	private char[][] decode(int mask) {
		char [][]r = new char[n][m];
		for(int i=0;i<19;i++){
			if ((mask & (1 << i)) > 0) {
				r[x[i]][y[i]] = 'O';
			}else {
				r[x[i]][y[i]] = '.';
			}
		}
		return r;
	}

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


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

public class BetaRound59_E implements Runnable {

	final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok = new StringTokenizer("");

	void init() throws IOException {
		if (ONLINE_JUDGE) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		}
	}

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

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

	@Override
	public void run() {
		try {
			long t1 = System.currentTimeMillis();
			init();
			solve();
			out.close();
			long t2 = System.currentTimeMillis();
			System.err.println("Time = " + (t2 - t1));
		} catch (Exception e) {
			e.printStackTrace(System.err);
			System.exit(-1);
		}
	}

	public static void main(String[] args) {
		new Thread(new BetaRound59_E()).start();
	}

	class State {
		int[] arr;
		State(int[] a) {
			arr = a;
		}
	}

	int[] getArray(List<Integer> list) {
		int[] ans = new int[list.size()];
		for (int i = 0; i < ans.length; i++) {
			ans[i] = list.get(i);
		}
		return ans;
	}

	List<State> getStates(int[] a) {
		List<State> ans = new ArrayList<State>();
		List<Integer> list = new ArrayList<Integer>();
		for (int from = 0; from < a.length; from++) {
			for (int to = from + 1; to < a.length; to++) {
				for (int k = from; k <= to; k++) {
					list.add(a[k]);
				}
				ans.add(new State(getArray(list)));
				list.clear();
			}
		}
		return ans;
	}

	int[] getPossibleMoveMasks() {
		final int[][] lines = {
				{1,2,3},
				{4,5,6,7},
				{8,9,10,11,12},
				{13,14,15,16},
				{17,18,19},

				{1,4,8},
				{2,5,9,13},
				{3,6,10,14,17},
				{7,11,15,18},
				{12,16,19},

				{8,13,17},
				{4,9,14,18},
				{1,5,10,15,19},
				{2,6,11,16},
				{3,7,12}
		};

		List<State> states = new ArrayList<State>();
		for (int i = 1; i <= 19; i++) {
			states.add(new State(new int[] {i}));
		}
		for (int i = 0; i < lines.length; i++) {
			List<State> list = getStates(lines[i]);
			states.addAll(list);
		}

		int[][] moves = new int[states.size()][];
		for (int i = 0; i < moves.length; i++) {
			moves[i] = states.get(i).arr;
		}

		int[] ans = new int[moves.length];
		for (int i = 0; i < moves.length; i++) {
			int p = 0;
			for (int j = 0; j < moves[i].length; j++) {
				p += (1 << (moves[i][j] - 1));
			}
			ans[i] = p;
		}
		Arrays.sort(ans);
		return ans;
	}

	final int[] moves = getPossibleMoveMasks();

	void solve() throws IOException {
		int start = 0;
		for (int i = 0; i < 19; i++) {
			String s = readString();
			if (s.equals("O")) {
				start += (1 << i);
			}
		}
		vis[0] = true;
		boolean ans = dfs(start);
		out.print(ans ? "Karlsson" : "Lillebror");
	}

	boolean[] d = new boolean[1 << 19];
	boolean[] vis = new boolean[1 << 19];

	boolean dfs(int from) {
		if (vis[from]) {
			return d[from];
		}
		boolean ans = false;
		for (int move : moves) {
			if ((from | move) == from) {
				ans |= !dfs(from ^ move);
			}
		}
		vis[from] = true;
		return d[from] = ans;
	}

}