1	public class E_2{ public static void main( String[] args)throws Exception { FastReader in = new FastReader(System.in);  PrintWriter pw = new PrintWriter(System.out);  int n = in.nextInt(),k = in.nextInt(),N = ((int)5e6 + 1);  int left = 0,right = 0;  int a[] = new int[(n + 1)]; for ( int i = 1;(i <= n);i++) {a[i] = in.nextInt(); if ( (a[i] == k)) left++; } int f[] = new int[(N + 1)];  int ans = 0; for ( int i = n;(i >= 1);i--) {if ( (a[i] == k)) left--; f[a[i]]++; f[a[i]] = max(f[a[i]],(1 + right)); ans = max(ans,(f[a[i]] + left)); if ( (a[i] == k)) right++; }pw.println(ans); pw.close(); } static class FastReader{ InputStream is ; private byte[] inbuf = new byte[1024]; private int lenbuf = 0,ptrbuf = 0; public FastReader( InputStream is){ this.is = is; } public 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++];} public int nextInt(){ 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 << 3) + (num << 1)) + (b - '0')); } else {return (minus?-num:num);}b = readByte(); }} } }
2	public class Main{ static private long pow( long base, long coe){ if ( (coe == 0)) return 1; if ( (coe == 1)) return base; long res = pow(base,(coe / 2)); if ( ((coe % 2) == 0)) {return (res * res);} else {return ((res * res) * base);}} static private void getLen( long n){ long tmp = 0;  int cnt = 0; while((tmp < n)){++cnt; tmp += ((cnt * 9) * pow(10,(cnt - 1))); }if ( (tmp == n)) System.out.println("9"); else {tmp -= ((cnt * 9) * pow(10,(cnt - 1))); long ans = ((((n - tmp) - 1) / cnt) + pow(10,(cnt - 1))); System.out.println(String.valueOf(ans).charAt((int)(((n - tmp) - 1) % cnt))); }} public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long n = sc.nextLong(); getLen(n); } }
0	public class Main{ static final boolean debug = false; static final String fileName = ""; static final boolean useFiles = false; public static void main( String[] args)throws FileNotFoundException { PrintWriter writer = new PrintWriter(System.out); new Task(new InputReader(System.in),writer).solve(); writer.close(); } } 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();} } class Task{ public void solve(){ out.println(25); } private InputReader in ; private PrintWriter out ; Task( InputReader in, PrintWriter out){ this.in = in; this.out = out; } }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  MyInput in = new MyInput(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, MyInput in, PrintWriter out){ int n = in.nextInt();  int r = in.nextInt();  int[] x = in.nextIntArray(n);  double[] py = new double[n]; for ( int i = 0;(i < n);i++) { double y = r; for ( int j = 0;(j < i);j++) { int dx = Math.abs((x[i] - x[j])); if ( (dx > (2 * r))) continue; y = Math.max(y,(Math.sqrt((((4 * r) * r) - (dx * dx))) + py[j])); }py[i] = y; }for ( int i = 0;(i < n);i++) {out.printf("%.10f%s",py[i],((i == (n - 1))?"\n":" ")); }} } static class MyInput{ private final BufferedReader in ; static private int pos ; static private int readLen ; static private final char[] buffer = new char[(1024 * 8)]; static private char[] str = new char[((500 * 8) * 2)]; static private boolean[] isDigit = new boolean[256]; static private boolean[] isSpace = new boolean[256]; static private boolean[] isLineSep = new boolean[256]; {for ( int i = 0;(i < 10);i++) {isDigit[('0' + i)] = true; }isDigit['-'] = true; isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true; isLineSep['\r'] = isLineSep['\n'] = true; }public MyInput( InputStream is){ in = new BufferedReader(new InputStreamReader(is)); } public int read(){ if ( (pos >= readLen)) {pos = 0; try{readLen = in.read(buffer); }catch (IOException e){ throw (new RuntimeException());} if ( (readLen <= 0)) {throw (new MyInput.EndOfFileRuntimeException());} } return buffer[pos++];} public int nextInt(){ int len = 0; str[len++] = nextChar(); len = reads(len,isSpace); int i = 0;  int ret = 0; if ( (str[0] == '-')) {i = 1; } for ( ;(i < len);i++) ret = (((ret * 10) + str[i]) - '0'); if ( (str[0] == '-')) {ret = -ret; } return ret;} public char nextChar(){ while(true){final int c = read(); if ( !isSpace[c]) {return (char)c;} }} int reads( int len, boolean[] accept){ try{while(true){final int c = read(); if ( accept[c]) {break;} if ( (str.length == len)) { char[] rep = new char[((str.length * 3) / 2)]; System.arraycopy(str,0,rep,0,str.length); str = rep; } str[len++] = (char)c; } }catch (MyInput.EndOfFileRuntimeException e){ } return len;} public int[] nextIntArray(final int n){ final int[] res = new int[n]; for ( int i = 0;(i < n);i++) {res[i] = nextInt(); }return res;} } }
2	public class Main{ static private StringTokenizer st ; static private BufferedReader br ; public static long MOD = 1000000007; public static void print( Object x){ System.out.println((x + "")); } public static String nextToken()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String line = br.readLine(); st = new StringTokenizer(line.trim()); }return st.nextToken();} public static int nextInt()throws IOException { return Integer.parseInt(nextToken());} public static long nextLong()throws IOException { return Long.parseLong(nextToken());} public static long[] search( long[] none, long[] some)throws IOException { long[] med = new long[4]; for ( int i = 0;(i < 4);i++) {if ( (Math.abs((none[i] - some[i])) == 1)) {return some;} med[i] = ((none[i] + some[i]) / 2); } int ans = query(med); if ( (ans > 0)) return search(none,med); else return search(med,some);} public static int query( long[] query)throws IOException { print(("? " + arr(query))); System.out.flush(); int ans = nextInt(); if ( contains(query)) ans -= 1; return ans;} public static boolean contains( long[] search){ if ( (rect1 == null)) return false; if ( (search[0] > rect1[0])) return false; if ( (search[1] > rect1[1])) return false; if ( (search[2] < rect1[2])) return false; if ( (search[3] < rect1[3])) return false; return true;} public static String arr( long[] x){ return ((((((x[0] + " ") + x[1]) + " ") + x[2]) + " ") + x[3]);} public static long[] find()throws IOException { long[] d0 = {1,1,1,1};  long[] some = {1,1,n,n}; if ( (query(d0) > 0)) {return d0;} long[] none = {1,1,n,1}; if ( (query(none) > 0)) some = none; else some = search(none,some); none = new long[]{1,1,1,some[3]}; if ( (query(none) > 0)) some = none; else some = search(none,some); none = new long[]{1,some[3],some[2],some[3]}; if ( (query(none) > 0)) some = none; else some = search(none,some); none = new long[]{some[2],some[1],some[2],some[3]}; if ( (query(none) > 0)) some = none; else some = search(none,some); return some;} public static long[] rect1 = null; public static long[] rect2 = null; public static long n ; public static void main( String[] args)throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); n = nextLong(); rect1 = find(); rect2 = find(); print(((("! " + arr(rect1)) + " ") + arr(rect2))); System.out.flush(); } }
3	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int r = sc.nextInt();  int d = (2 * r);  int[] xCoordinates = new int[n];  double[] yCoordinates = new double[n]; for ( int i = 0;(i < n);i++) yCoordinates[i] = r; for ( int i = 0;(i < n);i++) xCoordinates[i] = sc.nextInt(); double y = 0; for ( int i = 0;(i < n);i++) {y = r; for ( int j = 0;(j < i);j++) {if ( (Math.abs((xCoordinates[i] - xCoordinates[j])) <= (2 * r))) { int dx = Math.abs((xCoordinates[i] - xCoordinates[j]));  double dy = Math.sqrt(((d * d) - (dx * dx))); if ( ((dy + yCoordinates[j]) > y)) y = (dy + yCoordinates[j]); } }yCoordinates[i] = y; }for ( int i = 0;(i < n);i++) System.out.print((yCoordinates[i] + " ")); sc.close(); } }
6	public class CF111C extends PrintWriter{ CF111C(){ super(System.out,true); } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF111C o = new CF111C(); o.main(); o.flush(); } int encode( int[] aa, int m){ int a = 0; for ( int j = 0;(j < m);j++) a = ((a * 3) + aa[j]); return a;} void decode( int[] aa, int m, int a, int base){ for ( int j = (m - 1);(j >= 0);j--) {aa[j] = (a % base); a /= base; }} void main(){ int n = sc.nextInt();  int m = sc.nextInt(); if ( (n < m)) { int tmp = n; n = m; m = tmp; } int p = 1; for ( int j = 0;(j < m);j++) p *= 3; int[] dp = new int[p];  int[] dq = new int[p];  int[] aa = new int[m];  int[] bb = new int[m]; for ( int j = 0;(j < m);j++) aa[j] = 1; Arrays.fill(dp,-1); dp[encode(aa,m)] = 0; while((n-- > 0)){Arrays.fill(dq,-1); for ( int a = 0;(a < p);a++) {if ( (dp[a] < 0)) continue; decode(aa,m,a,3); for ( int b = 0;(b < (1 << m));b++) {decode(bb,m,b,2); boolean bad = false; for ( int j = 0;(j < m);j++) if ( ((aa[j] == 0) && (bb[j] == 0))) {bad = true; break;} if ( bad) continue; int cnt = 0; for ( int j = 0;(j < m);j++) if ( (bb[j] == 1)) {bb[j] = 2; cnt++; } for ( int j = 0;(j < m);j++) if ( ((bb[j] == 0) && (((aa[j] == 2) || ((j > 0) && (bb[(j - 1)] == 2))) || (((j + 1) < m) && (bb[(j + 1)] == 2))))) bb[j] = 1;  int a_ = encode(bb,m); dq[a_] = Math.max(dq[a_],((dp[a] + m) - cnt)); }} int[] tmp = dp; dp = dq; dq = tmp; } int ans = 0; for ( int a = 0;(a < p);a++) {if ( (dp[a] <= ans)) continue; decode(aa,m,a,3); boolean bad = false; for ( int j = 0;(j < m);j++) if ( (aa[j] == 0)) {bad = true; break;} if ( !bad) ans = dp[a]; }println(ans); } }
0	public class Composite{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(); if ( (n == 12)) System.out.println("4 8"); else if ( ((n % 2) == 1)) System.out.println(((n - 9) + " 9")); else System.out.println(((n - 6) + " 6")); } }
0	public class A{ public static void main( String[] args){ System.out.println(((new java.util.Scanner(System.in).nextInt() / 2) * 3)); } }
0	public class A{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); if ( ((n % 2) == 0)) {System.out.printf("%d %d",4,(n - 4)); } else {System.out.printf("%d %d",9,(n - 9)); }} }
6	public class Main{ int n ,A ; int[] bs ,ls ; void run(){ n = nextInt(); int k = nextInt(); A = nextInt(); bs = new int[n]; ls = new int[n]; for ( int i = 0;(i < n);i++) {bs[i] = nextInt(); ls[i] = nextInt(); }dfs(k,0); System.out.println(res); } double res = 0; private void dfs( int k, int i){ if ( (i == n)) { double val = 0; for ( int j = 0;(j < (1 << n));j++) { double p = 1;  int B = 0; for ( int l = 0;(l < n);l++) p *= ((((j >> l) & 1) == 1)?(ls[l] / 100.0):((100 - ls[l]) / 100.0)); for ( int l = 0;(l < n);l++) if ( (((j >> l) & 1) == 0)) B += bs[l]; if ( (Integer.bitCount(j) > (n / 2))) {val += p; } else {val += ((p * A) / (A + B)); }}res = max(res,val); return ;} for ( int j = 0;(j < (k + 1));j++) {ls[i] += (j * 10); if ( (ls[i] <= 100)) {dfs((k - j),(i + 1)); } ls[i] -= (j * 10); }} int nextInt(){ try{ int c = System.in.read(); if ( (c == -1)) return c; while(((c != '-') && ((c < '0') || ('9' < c)))){c = System.in.read(); if ( (c == -1)) return c; }if ( (c == '-')) return -nextInt(); int res = 0; do {res *= 10; res += (c - '0'); c = System.in.read(); }while((('0' <= c) && (c <= '9')));return res; }catch (Exception e){ return -1;} } long nextLong(){ try{ int c = System.in.read(); if ( (c == -1)) return -1; while(((c != '-') && ((c < '0') || ('9' < c)))){c = System.in.read(); if ( (c == -1)) return -1; }if ( (c == '-')) return -nextLong(); long res = 0; do {res *= 10; res += (c - '0'); c = System.in.read(); }while((('0' <= c) && (c <= '9')));return res; }catch (Exception e){ return -1;} } String next(){ try{ StringBuilder res = new StringBuilder("");  int c = System.in.read(); while(Character.isWhitespace(c))c = System.in.read(); do {res.append((char)c); }while(!Character.isWhitespace(c = System.in.read()));return res.toString(); }catch (Exception e){ return null;} } public static void main( String[] args){ new Main().run(); } }
6	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastReader in = new FastReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  E2RotateColumnsHardVersion solver = new E2RotateColumnsHardVersion();  int testCount = Integer.parseInt(in.next()); for ( int i = 1;(i <= testCount);i++) solver.solve(i,in,out); out.close(); } static class E2RotateColumnsHardVersion{ public void solve( int testNumber, FastReader in, PrintWriter out){ int n = in.nextInt();  int m = in.nextInt();  E2RotateColumnsHardVersion.Column[] columns = new E2RotateColumnsHardVersion.Column[m]; for ( int i = 0;(i < columns.length);++i) columns[i] = new E2RotateColumnsHardVersion.Column(new int[n]); for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < m);++j) {columns[j].vals[i] = in.nextInt(); }}for ( E2RotateColumnsHardVersion.Column column :columns) column.initMax(); Arrays.sort(columns,new Comparator<E2RotateColumnsHardVersion.Column>(){}); if ( (columns.length > n)) columns = Arrays.copyOf(columns,n); out.println(solveOne(columns)); } private int solveOne( E2RotateColumnsHardVersion.Column[] columns){ int n = columns[0].vals.length;  int[] best = new int[(1 << n)];  int[] next = new int[(1 << n)];  int[] temp = new int[(1 << n)]; for ( E2RotateColumnsHardVersion.Column nowColumn :columns) {System.arraycopy(best,0,next,0,best.length); for ( int rot = 0;(rot < n);++rot) {System.arraycopy(best,0,temp,0,next.length); for ( int i = 0,pos = rot;(i < n);++i,++pos) {if ( (pos >= n)) pos = 0;  int val = nowColumn.vals[pos]; for ( int j = 0;(j < temp.length);++j) {if ( ((j & (1 << i)) == 0)) {temp[(j | (1 << i))] = Math.max(temp[(j | (1 << i))],(temp[j] + val)); } }}for ( int j = 0;(j < temp.length);++j) {next[j] = Math.max(next[j],temp[j]); }} int[] aa = best; best = next; next = aa; }return best[(best.length - 1)];} } static class FastReader{ private InputStream stream ; private byte[] buf = new byte[8192]; private int curChar ; private int pnumChars ; public FastReader( InputStream stream){ this.stream = stream; } private int pread(){ if ( (pnumChars == -1)) {throw (new InputMismatchException());} if ( (curChar >= pnumChars)) {curChar = 0; try{pnumChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (pnumChars <= 0)) {return -1;} } return buf[curChar++];} public String next(){ return nextString();} public int nextInt(){ int c = pread(); while(isSpaceChar(c))c = pread(); int sgn = 1; if ( (c == '-')) {sgn = -1; c = pread(); } int res = 0; do {if ( (c == ',')) {c = pread(); } if ( ((c < '0') || (c > '9'))) {throw (new InputMismatchException());} res *= 10; res += (c - '0'); c = pread(); }while(!isSpaceChar(c));return (res * sgn);} public String nextString(){ int c = pread(); while(isSpaceChar(c))c = pread(); StringBuilder res = new StringBuilder(); do {res.appendCodePoint(c); c = pread(); }while(!isSpaceChar(c));return res.toString();} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
5	public class test{ static int mod = 1000000007; public static void main( String[] args)throws Exception,IOException { Reader sc = new Reader(System.in);  int n = sc.nextInt(),r = 0;  long k = sc.nextInt();  Integer x[] = new Integer[n];  boolean b[] = new boolean[n]; for ( int i = 0;(i < n);i++) {x[i] = sc.nextInt(); }if ( (k == 1)) {System.out.println(n); return ;} sort(x); for ( int i = 0;(i < n);i++) {if ( b[i]) continue; r++; long p = x[i],pr = x[i]; while(((p * k) <= x[(n - 1)])){p *= k; int up = n,dw = 0,mid = ((up + dw) / 2);  boolean f = false; while(((up - dw) != 1)){if ( (x[mid] == p)) {f = true; break;} if ( (p < x[mid])) {up = mid; mid = ((up + dw) / 2); } else {dw = mid; mid = ((up + dw) / 2); }}if ( f) {if ( ((pr * k) != p)) {r++; pr = p; } b[mid] = true; } }}System.out.println(r); } } class Reader{ private BufferedReader x ; private StringTokenizer st ; public Reader( InputStream in){ x = new BufferedReader(new InputStreamReader(in)); st = null; } public String nextString()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(x.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(nextString());} }
6	public class Main{ public static void main( String[] args){ InputReader in = new StreamInputReader(System.in);  PrintWriter out = new PrintWriter(System.out); run(in,out); } public static void run( InputReader in, PrintWriter out){ Solver solver = new TaskC(); solver.solve(1,in,out); Exit.exit(in,out); } } class StreamInputReader extends InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ,numChars ; public StreamInputReader( 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 void close(){ try{stream.close(); }catch (IOException ignored){ } } } interface Solver{ public void solve( int testNumber, InputReader in, PrintWriter out); } class TaskC implements Solver{ public void solve( int testNumber, InputReader in, PrintWriter out){ int rowCount = in.readInt();  int columnCount = in.readInt(); out.println(((rowCount * columnCount) - go(Math.min(rowCount,columnCount),Math.max(rowCount,columnCount)))); } private int go( int rowCount, int columnCount){ int[][][] result = new int[columnCount][rowCount][(1 << (2 * rowCount))]; ArrayUtils.fill(result,-1); return go(0,0,((1 << rowCount) - 1),result);} private int go( int column, int row, int mask, int[][][] result){ if ( (column == result.length)) return ((mask == 0)?0:(Integer.MAX_VALUE / 2)); int length = result[column].length; if ( (row == length)) return go((column + 1),0,mask,result); if ( (result[column][row][mask] != -1)) return result[column][row][mask]; result[column][row][mask] = (Integer.MAX_VALUE / 2); if ( (((mask >> ((2 * length) - 1)) & 1) == 0)) result[column][row][mask] = go(column,(row + 1),((mask * 2) + ((column == (result.length - 1))?0:1)),result);  int newMask = mask; newMask &= (1 << (length - 1)); if ( (row != 0)) newMask &= (1 << length); if ( (row != (length - 1))) newMask &= (1 << (length - 2)); newMask *= 2; newMask &= ((1 << (2 * length)) - 1); return result[column][row][mask] = Math.min(result[column][row][mask],(1 + go(column,(row + 1),newMask,result)));} }
4	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  MyScanner in = new MyScanner(inputStream);  PrintWriter out = new PrintWriter(outputStream);  EPhoenixAndComputers solver = new EPhoenixAndComputers(); solver.solve(1,in,out); out.close(); } static class EPhoenixAndComputers{ public static MyScanner sc ; public static PrintWriter out ; public void solve( int testNumber, MyScanner sc, PrintWriter out){ EPhoenixAndComputers.sc = sc; EPhoenixAndComputers.out = out; int n = sc.nextInt();  long M = sc.nextLong(); MathLib.MOD = M; long[][] comb = MathLib.getComb((n + 5));  long[] pots2 = MathLib.getPots(2,(n + 2));  long[] inv = new long[(n + 5)]; for ( int i = 1;(i < inv.length);i++) {inv[i] = MathLib.inverse(i); } long[][] ret = new long[(n + 1)][(n + 1)]; for ( int size = 0;(size <= n);size++) {if ( (size <= 1)) {ret[size][size] = 1; } else if ( (size == 2)) {ret[size][2] = 2; } else { long[] me = ret[size]; me[size] = pots2[(size - 1)]; for ( int i = 1;((i + 1) < size);i++) { int prev = i,next = ((size - i) - 1);  long tmp = pots2[(i - 1)]; for ( int c = 0;(c <= next);c++) { long tot = ((ret[next][c] * comb[c][(c + prev)]) % MathLib.MOD); tot = ((tot * tmp) % MathLib.MOD); me[(prev + c)] += tot; me[(prev + c)] %= MathLib.MOD; }}}} long ans = 0; for ( int i = 0;(i <= n);i++) {ans += ret[n][i]; }ans %= MathLib.MOD; out.println(ans); } } static class MyScanner{ private BufferedReader br ; private StringTokenizer tokenizer ; public MyScanner( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); } public String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return tokenizer.nextToken();} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} } }
2	public class A{ BufferedReader reader ; StringTokenizer tokenizer ; PrintWriter out ; long MOD = 1000000009; public long mod_add( long n1, long n2){ return ((n1 + n2) % MOD);} public long mod_time( long n1, long n2){ return ((n1 * n2) % MOD);} public long mod_power( long a, int k){ if ( (k == 0)) return 1; if ( ((k % 2) == 0)) return mod_power(((a * a) % MOD),(k / 2)); return ((a * mod_power(a,(k - 1))) % MOD);} public void solve()throws IOException { int N = nextInt();  int M = (N - nextInt());  int K = nextInt();  int full = ((N / K) - M); if ( (full < 0)) {out.println((N - M)); return ;} long ans = mod_time((K * 2),(mod_power(2,full) - 1)); ans = mod_add(ans,((N - M) - (full * K))); out.println(ans); } public static void main( String[] args){ new A().run(); } public void run(){ try{reader = new BufferedReader(new InputStreamReader(System.in)); tokenizer = null; out = new PrintWriter(System.out); solve(); reader.close(); out.close(); }catch (Exception e){ e.printStackTrace(); System.exit(1); } } int nextInt()throws IOException { return Integer.parseInt(nextToken());} String nextToken()throws IOException { while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(reader.readLine()); }return tokenizer.nextToken();} }
6	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ double special( int[] loyalties, int[] levels, int playerlevelsum){ int poss = (1 << loyalties.length);  double res = 0; for ( int pos = 0;(pos < poss);pos++) { double occurs = 1;  int happy = 0;  int badlevelssum = 0; for ( int i = 0;(i < loyalties.length);i++) {if ( (((pos >> i) & 1) == 1)) {happy++; occurs *= ((double)loyalties[i] / 100); } else {badlevelssum += levels[i]; occurs *= ((double)(100 - loyalties[i]) / 100); }} double winprob = ((happy <= (levels.length / 2))?((double)playerlevelsum / (playerlevelsum + badlevelssum)):1); res += (occurs * winprob); }return res;} public void solve( int testNumber, InputReader in, OutputWriter out){ int senators = in.readInt();  int sweets = in.readInt();  int playerlevelsum = in.readInt();  int[] levels = new int[senators];  int[] loyalties = new int[senators]; IOUtils.readIntArrays(in,levels,loyalties); ArrayList<ArrayList<Integer>> possibilities = new ArrayList<>(Arrays.asList(new ArrayList<>())); for ( int senator = 0;(senator < senators);senator++) { ArrayList<ArrayList<Integer>> newpossibilities = new ArrayList<>(); for ( ArrayList<Integer> al :possibilities) { int sumsofar = 0; for ( int val :al) sumsofar += val; int minadd = ((senator == (senators - 1))?(sweets - sumsofar):0); for ( int moar = minadd;(moar <= (sweets - sumsofar));moar++) { ArrayList<Integer> copy = new ArrayList<>(al); copy.add(moar); newpossibilities.add(copy); }}possibilities = newpossibilities; } double res = 0; for ( ArrayList<Integer> al :possibilities) { int[] newloyalties = new int[senators]; for ( int i = 0;(i < senators);i++) newloyalties[i] = Math.min(100,(loyalties[i] + (10 * al.get(i)))); double special = special(newloyalties,levels,playerlevelsum);  double tot = special; res = Math.max(res,tot); }out.printLine(res); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private SpaceCharFilter filter ; 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 boolean isSpaceChar( int c){ if ( (filter != null)) return filter.isSpaceChar(c); return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } } }
3	public class Main{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int N = sc.nextInt(),R = sc.nextInt();  double answer[] = new double[N];  int[] x = new int[N]; for ( int i = 0;(i < N);i++) x[i] = sc.nextInt(); for ( int i = 0;(i < N);i++) {answer[i] = R; for ( int j = 0;(j < i);j++) { int dist = Math.abs((x[i] - x[j])); if ( (dist <= (2 * R))) { double t = (answer[j] + Math.sqrt((((4 * R) * R) - (dist * dist)))); answer[i] = Math.max(answer[i],t); } }}for ( int i = 0;(i < N);++i) out.print((answer[i] + " ")); out.println(); out.flush(); out.close(); } static class Scanner{ BufferedReader br ; StringTokenizer st ; Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(br.readLine()); }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} } }
1	public class Main{ public void solve(){ int n = ni();  int a = ni();  int b = ni();  long ans = 0;  HashMap<Long,Long> m = new HashMap<>();  HashMap<String,Long> s = new HashMap<>(); for ( int i = 0;(i < n);i++) {ni(); long vx = ni();  long vy = ni();  long v = (((long)a * vx) - vy);  String k = ((vx + "|") + vy);  long cs = s.getOrDefault(k,0L);  long c = m.getOrDefault(v,0L); ans += (c - cs); m.put(v,(c + 1)); s.put(k,(cs + 1)); }write(((ans * 2) + "\n")); } public static void main( String[] args){ Main m = new Main(); m.solve(); try{m.out.close(); }catch (IOException e){ } } BufferedReader in ; BufferedWriter out ; StringTokenizer tokenizer ; public Main(){ in = new BufferedReader(new InputStreamReader(System.in)); out = new BufferedWriter(new OutputStreamWriter(System.out)); } public String n(){ if ( ((tokenizer == null) || !tokenizer.hasMoreTokens())) {try{tokenizer = new StringTokenizer(in.readLine()); }catch (IOException e){ } } return tokenizer.nextToken();} public int ni(){ return Integer.parseInt(n());} public void write( String s){ try{out.write(s); }catch (IOException e){ } } }
3	public class C{ static int n ,r ,x[] ; static double ans[] ; public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out); n = sc.nextInt(); r = sc.nextInt(); x = new int[n]; ans = new double[n]; for ( int i = 0;(i < n);i++) x[i] = sc.nextInt(); for ( int i = 0;(i < n);i++) {ans[i] = r; for ( int j = 0;(j < i);j++) {if ( (Math.abs((x[i] - x[j])) > (2 * r))) continue; int deltaxsq = ((x[i] - x[j]) * (x[i] - x[j]));  int deltaysq = (((4 * r) * r) - deltaxsq);  double deltay = Math.sqrt(deltaysq); ans[i] = Math.max(ans[i],(ans[j] + deltay)); }pw.print((ans[i] + " ")); }pw.flush(); pw.close(); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public boolean ready()throws IOException { return br.ready();} } }
0	public class LearnMath{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  int N = scan.nextInt(); scan.close(); if ( ((N % 2) == 0)) {System.out.println(((4 + " ") + (N - 4))); } else {if ( (N > 18)) {System.out.println(((9 + " ") + (N - 9))); } else {System.out.println((((N - 9) + " ") + 9)); }}} }
6	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);  TaskE2 solver = new TaskE2(); solver.solve(1,in,out); out.close(); } static class TaskE2{ public void solve( int testNumber, FastScanner in, PrintWriter out){ int numTests = in.nextInt(); for ( int test = 0;(test < numTests);test++) { int n = in.nextInt();  int m = in.nextInt();  int[][] a = new int[n][m]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {a[i][j] = in.nextInt(); }} int[] maxInColumn = new int[m]; for ( int j = 0;(j < m);j++) {for ( int i = 0;(i < n);i++) {maxInColumn[j] = Math.max(maxInColumn[j],a[i][j]); }} Integer[] cols = new Integer[m]; for ( int i = 0;(i < m);i++) {cols[i] = i; }Arrays.sort(cols,(u,v)->(maxInColumn[u] - maxInColumn[v])); if ( (m > n)) { int[][] na = new int[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {na[i][j] = a[i][cols[j]]; }}m = n; a = na; } int[] buf = new int[n];  int[][] sums = new int[m][(1 << n)];  int[] sumsCur = new int[(1 << n)]; for ( int j = 0;(j < m);j++) {for ( int shift = 0;(shift < n);shift++) {for ( int i = 0;(i < n);i++) {buf[i] = a[((i + shift) % n)][j]; }for ( int mask = 0;(mask < (1 << n));mask++) {if ( (mask > 0)) { int k = Integer.numberOfTrailingZeros(mask); sumsCur[mask] = (sumsCur[(mask ^ (1 << k))] + buf[k]); sums[j][mask] = Math.max(sums[j][mask],sumsCur[mask]); } }}} int[] d = new int[(1 << n)];  int[] nd = new int[(1 << n)]; for ( int j = 0;(j < m);j++) {System.arraycopy(d,0,nd,0,d.length); for ( int mask = 0;(mask < (1 << n));mask++) {for ( int submask = mask;(submask > 0);submask = ((submask - 1) & mask)) {nd[mask] = Math.max(nd[mask],(d[(mask ^ submask)] + sums[j][submask])); }} int[] t = d; d = nd; nd = t; } int ans = 0; for ( int x :d) {ans = Math.max(ans,x); }out.println(ans); }} } static class FastScanner{ private BufferedReader in ; private StringTokenizer st ; public FastScanner( InputStream stream){ in = new BufferedReader(new InputStreamReader(stream)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
4	public class Main{ static FastScanner fs = new FastScanner(); static class FastScanner{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next(){ while(!st.hasMoreElements())try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } return st.nextToken();} int Int(){ return Integer.parseInt(next());} long Long(){ return Long.parseLong(next());} String Str(){ return next();} } public static void main( String[] args)throws java.lang.Exception { PrintWriter out = new PrintWriter(System.out);  int primes[] = new int[]{2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,1009,1013,1019,1021,1031,1033,1039,1049,1051,1061,1063,1069,1087,1091,1093,1097,1103,1109,1117,1123,1129,1151,1153,1163,1171,1181,1187,1193,1201,1213,1217,1223,1229,1231,1237,1249,1259,1277,1279,1283,1289,1291,1297,1301,1303,1307,1319,1321,1327,1361,1367,1373,1381,1399,1409,1423,1427,1429,1433,1439,1447,1451,1453,1459,1471,1481,1483,1487,1489,1493,1499,1511,1523,1531,1543,1549,1553,1559,1567,1571,1579,1583,1597,1601,1607,1609,1613,1619,1621,1627,1637,1657,1663,1667,1669,1693,1697,1699,1709,1721,1723,1733,1741,1747,1753,1759,1777,1783,1787,1789,1801,1811,1823,1831,1847,1861,1867,1871,1873,1877,1879,1889,1901,1907,1913,1931,1933,1949,1951,1973,1979,1987,1993,1997,1999,2003,2011,2017,2027,2029,2039,2053,2063,2069,2081,2083,2087,2089,2099,2111,2113,2129,2131,2137,2141,2143,2153,2161,2179,2203,2207,2213,2221,2237,2239,2243,2251,2267,2269,2273,2281,2287,2293,2297,2309,2311,2333,2339,2341,2347,2351,2357,2371,2377,2381,2383,2389,2393,2399,2411,2417,2423,2437,2441,2447,2459,2467,2473,2477,2503,2521,2531,2539,2543,2549,2551,2557,2579,2591,2593,2609,2617,2621,2633,2647,2657,2659,2663,2671,2677,2683,2687,2689,2693,2699,2707,2711,2713,2719,2729,2731,2741,2749,2753,2767,2777,2789,2791,2797,2801,2803,2819,2833,2837,2843,2851,2857,2861,2879,2887,2897,2903,2909,2917,2927,2939,2953,2957,2963,2969,2971,2999,3001,3011,3019,3023,3037,3041,3049,3061,3067,3079,3083,3089,3109,3119,3121,3137,3163,3167,3169,3181,3187,3191,3203,3209,3217,3221,3229,3251,3253,3257,3259,3271,3299,3301,3307,3313,3319,3323,3329,3331,3343,3347,3359,3361,3371,3373,3389,3391,3407,3413,3433,3449,3457,3461,3463,3467,3469,3491,3499,3511,3517,3527,3529,3533,3539,3541,3547,3557,3559,3571,3581,3583,3593,3607,3613,3617,3623,3631,3637,3643,3659,3671,3673,3677,3691,3697,3701,3709,3719,3727,3733,3739,3761,3767,3769,3779,3793,3797,3803,3821,3823,3833,3847,3851,3853,3863,3877,3881,3889,3907,3911,3917,3919,3923,3929,3931,3943,3947,3967,3989,4001,4003,4007,4013,4019,4021,4027,4049,4051,4057,4073,4079,4091,4093,4099,4111,4127,4129,4133,4139,4153,4157,4159,4177,4201,4211,4217,4219,4229,4231,4241,4243,4253,4259,4261,4271,4273,4283,4289,4297,4327,4337,4339,4349,4357,4363,4373,4391,4397,4409,4421,4423,4441,4447,4451,4457,4463,4481,4483,4493,4507,4513,4517,4519,4523,4547,4549,4561,4567,4583,4591,4597,4603,4621,4637,4639,4643,4649,4651,4657,4663,4673,4679,4691,4703,4721,4723,4729,4733,4751,4759,4783,4787,4789,4793,4799,4801,4813,4817,4831,4861,4871,4877,4889,4903,4909,4919,4931,4933,4937,4943,4951,4957,4967,4969,4973,4987,4993,4999};  int T = Int(); for ( int t = 0;(t < T);t++) { int n = Int();  int k = Int();  int A[] = new int[n]; for ( int i = 0;(i < n);i++) {A[i] = Int(); } Sol sol = new Sol(); sol.solution(out,A,k,primes); }out.flush(); } public static int Int(){ return fs.Int();} public static long Long(){ return fs.Long();} public static String Str(){ return fs.Str();} } class Sol{ int dp[][] ; public void solution( PrintWriter out, int[] A, int K, int[] primes){ int n = A.length;  int id = 0;  int dp[][] = new int[(n + 1)][(K + 1)]; for ( int i = 0;(i < dp.length);i++) {Arrays.fill(dp[i],n); } Map<String,Integer> f = new HashMap<>(); for ( int i = 0;(i < A.length);i++) { String h = hash(A[i],primes); if ( !f.containsKey(h)) {f.put(h,id); A[i] = id; id++; } else {A[i] = f.get(h); }} int dis[][] = new int[A.length][(K + 1)]; for ( int k = 0;(k <= K);k++) { int r = (n - 1);  Map<Integer,Integer> ff = new HashMap<>(); for ( int i = (n - 1);(i >= 0);i--) {put(ff,A[i]); while(((ff.size() + k) < ((r - i) + 1))){remove(ff,A[r]); dis[r][k] = (i + 1); r--; }}}for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= K);j++) {if ( (j >= (i + 1))) {dp[i][j] = 1; continue;} for ( int k = 0;(k <= j);k++) { int reach = dis[i][k]; if ( (reach == 0)) dp[i][j] = 1; else dp[i][j] = Math.min(dp[i][j],(1 + dp[(reach - 1)][(j - k)])); }}}out.println(dp[(n - 1)][K]); } public void put( Map<Integer,Integer> f, int key){ if ( !f.containsKey(key)) f.put(key,1); else f.put(key,(f.get(key) + 1)); } public void remove( Map<Integer,Integer> f, int key){ f.put(key,(f.get(key) - 1)); if ( (f.get(key) == 0)) f.remove(key); } public String hash( int n, int[] primes){ StringBuilder str = new StringBuilder("a,"); for ( int i :primes) {if ( ((i * i) > n)) break; int cnt = 0; while(((n % i) == 0)){n /= i; cnt++; }cnt %= 2; if ( (cnt != 0)) str.append((i + ",")); }if ( (n != 1)) str.append((n + ",")); return str.toString();} }
0	public class LCM235A{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long n = sc.nextLong(); if ( (n == 1)) {System.out.println(1); return ;} if ( (n == 2)) {System.out.println(2); return ;} if ( (n == 3)) {System.out.println(6); return ;} if ( (n == 4)) {System.out.println(12); return ;} if ( ((n % 2) == 1)) {System.out.println(((n * (n - 1)) * (n - 2))); return ;} if ( ((n % 3) == 0)) {System.out.println((((n - 1) * (n - 2)) * (n - 3))); } else {System.out.println(((n * (n - 1)) * (n - 3))); }} }
3	public class Main{ public static void main( String[] args){ Main main = new Main(); main.solveC(); } private void solveC(){ Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  double R = (0.0 + sc.nextInt());  double[] x = new double[N];  double[] y = new double[N]; for ( int i = 0;(i < N);i++) {x[i] = (0.0 + sc.nextInt()); double max_y = R; for ( int j = 0;(j < i);j++) { double dy = (((4 * R) * R) - ((x[i] - x[j]) * (x[i] - x[j]))); if ( (dy >= 0)) { double tmp_y = (y[j] + Math.sqrt(dy)); if ( (max_y < tmp_y)) {max_y = tmp_y; } } }y[i] = max_y; } StringJoiner sj = new StringJoiner(" "); for ( int i = 0;(i < N);i++) {sj.add(String.valueOf(y[i])); }System.out.println(sj.toString()); } interface Graph{ void link( int from, int to, long cost); Optional<Long> getCost( int from, int to); int getVertexNum(); } interface FlowResolver{ ; } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ int stage ; int n ; OutputWriter out ; InputReader in ; void query( int end){ switch(stage){ case 0:out.printLine('?',1,1,end,n); break; case 1:out.printLine('?',1,1,n,end); break; case 2:out.printLine('?',((n + 1) - end),1,n,n); break; case 3:out.printLine('?',1,((n + 1) - end),n,n); break; } out.flush(); } public void solve( int testNumber, InputReader in, OutputWriter out){ this.out = out = new OutputWriter(System.out); this.in = in = new InputReader(System.in); n = in.readInt(); int[] endx = new int[2];  int[] endy = new int[2];  int[] stx = new int[2];  int[] sty = new int[2]; find(endx); stage++; find(endy); stage++; find(stx); for ( int i = 0;(i < 2);i++) {stx[i] = ((n + 1) - stx[i]); }stage++; find(sty); for ( int i = 0;(i < 2);i++) {sty[i] = ((n + 1) - sty[i]); }for ( int i = 0;(i < 8);i++) {if ( ((stx[(i & 1)] > endx[((i >> 2) & 1)]) || (sty[((i >> 1) & 1)] > endy[0]))) {continue;} if ( ((stx[(1 - (i & 1))] > endx[(1 - ((i >> 2) & 1))]) || (sty[(1 - ((i >> 1) & 1))] > endy[1]))) {continue;} out.printLine('?',stx[(i & 1)],sty[((i >> 1) & 1)],endx[((i >> 2) & 1)],endy[0]); out.flush(); if ( (in.readInt() == 0)) {continue;} out.printLine('?',stx[(1 - (i & 1))],sty[(1 - ((i >> 1) & 1))],endx[(1 - ((i >> 2) & 1))],endy[1]); out.flush(); if ( (in.readInt() != 0)) {out.printLine("!",stx[(i & 1)],sty[((i >> 1) & 1)],endx[((i >> 2) & 1)],endy[0],stx[(1 - (i & 1))],sty[(1 - ((i >> 1) & 1))],endx[(1 - ((i >> 2) & 1))],endy[1]); out.flush(); return ;} }} private void find( int[] endx){ int left = 1;  int right = n; while((left < right)){ int middle = ((left + right) >> 1); query(middle); if ( (in.readInt() == 2)) {right = middle; } else {left = (middle + 1); }}endx[0] = left; left = 0; right--; while((left < right)){ int middle = (((left + right) + 1) >> 1); query(middle); if ( (in.readInt() == 0)) {left = middle; } else {right = (middle - 1); }}endx[1] = (left + 1); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } public void flush(){ writer.flush(); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputReader.SpaceCharFilter filter ; 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 boolean isSpaceChar( int c){ if ( (filter != null)) {return filter.isSpaceChar(c);} return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } }
3	public class Main{ public void solve()throws IOException { int n = nextInt(),r = nextInt();  int x[] = new int[n]; for ( int i = 0;(i < n);i++) {x[i] = nextInt(); } double res[] = new double[n]; res[0] = r; for ( int i = 1;(i < n);i++) { double max = r; for ( int j = 0;(j < i);j++) { int d = Math.abs((x[i] - x[j])); if ( (d <= (2 * r))) { double yy = Math.sqrt((((4 * r) * r) - (d * d))); max = Math.max(max,(yy + res[j])); } }res[i] = max; }for ( int i = 0;(i < n);i++) {out.print((res[i] + " ")); }} BufferedReader br ; StringTokenizer sc ; PrintWriter out ; public static void main( String[] args)throws IOException { Locale.setDefault(Locale.US); new Main().run(); } void run()throws IOException { try{br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.close(); }catch (Exception e){ e.printStackTrace(); System.exit(1); } } String nextToken()throws IOException { while(((sc == null) || !sc.hasMoreTokens())){try{sc = new StringTokenizer(br.readLine()); }catch (Exception e){ return null;} }return sc.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
0	public class Code1{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = Integer.valueOf(sc.nextLine()); if ( ((n % 2) == 0)) System.out.println(((4 + " ") + (n - 4))); else {System.out.println(((9 + " ") + (n - 9))); }} }
4	public class C{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  Task solver = new Task(); solver.solve(in,out); out.close(); } static class Task{ int M ; public void solve( InputReader in, PrintWriter out){ int n = in.nextInt(); M = in.nextInt(); if ( (n <= 1)) {out.println(n); return ;} int[] pow2 = new int[(n + 1)]; pow2[0] = 1; for ( int i = 1;(i <= n);i++) pow2[i] = mul(2,pow2[(i - 1)]); int[][] Ckn = new int[(n + 1)][(n + 1)]; for ( int i = 0;(i <= n);i++) {Ckn[i][i] = 1; Ckn[0][i] = 1; for ( int j = (i - 1);(j >= 1);j--) {Ckn[j][i] = add(Ckn[(j - 1)][(i - 1)],Ckn[j][(i - 1)]); }} int ans = 0;  int[][] dp = new int[(n + 1)][(n + 1)]; dp[1][1] = 1; for ( int i = 2;(i <= n);i++) {dp[i][i] = pow2[(i - 1)]; for ( int j = 1;(j <= (i - 1));j++) {for ( int k = 1;(k <= j);k++) {dp[i][j] = add(dp[i][j],mul(mul(pow2[(k - 1)],dp[((i - k) - 1)][(j - k)]),Ckn[k][j])); }}}for ( int i = 0;(i <= n);i++) ans = add(ans,dp[n][i]); out.println(ans); } public int add( int a, int b){ a += b; if ( (a >= M)) a -= M; return a;} public int mul( int a, int b){ long res = ((long)a * (long)b); res %= M; return (int)res;} } static class InputReader{ BufferedReader br ; StringTokenizer st ; public InputReader( InputStream stream){ br = new BufferedReader(new InputStreamReader(stream)); } public String nextToken(){ while(((st == null) || !st.hasMoreTokens())){ String line = null; try{line = br.readLine(); }catch (IOException e){ throw (new RuntimeException(e));} if ( (line == null)) {return null;} st = new StringTokenizer(line); }return st.nextToken();} public int nextInt(){ return Integer.parseInt(nextToken());} } }
6	public class C3{ Scanner in ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni();  int m = ni(); if ( (n < m)) { int d = n; n = m; m = d; } if ( (m == 1)) {out.println((n - ((n + 2) / 3))); return ;} int[][] dp = new int[(n + 1)][(1 << (2 * m))];  int[] fill = new int[(1 << m)];  int mask = ((1 << m) - 1); for ( int i = 0;(i < (1 << m));i++) {fill[i] = ((((i << 1) | i) | (i >> 1)) & mask); }for ( int i = 0;(i < (1 << (2 * m)));i++) { int lower = (i & mask);  int upper = (i >> m); dp[0][i] = (((fill[lower] | upper) == mask)?Integer.bitCount(i):99999); }for ( int i = 1;(i <= (n - 2));i++) {for ( int j = 0;(j < (1 << (2 * m)));j++) { int lower = (j & mask);  int upper = (j >> m);  int min = 99999; for ( int k = 0;(k < (1 << m));k++) {if ( (((upper | fill[lower]) | k) == mask)) {min = Math.min(min,dp[(i - 1)][((lower << m) | k)]); } }dp[i][j] = (min + Integer.bitCount(upper)); }} int gmin = 99999; for ( int i = 0;(i < (1 << (2 * m)));i++) { int lower = (i & mask);  int upper = (i >> m); if ( ((fill[upper] | lower) == mask)) {gmin = Math.min(gmin,dp[(n - 2)][i]); } }out.println(((n * m) - gmin)); } void run()throws Exception { in = (oj?new Scanner(System.in):new Scanner(INPUT)); 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 C3().run(); } int ni(){ return Integer.parseInt(in.next());} boolean oj = (System.getProperty("ONLINE_JUDGE") != null); void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
5	public class Template{ BufferedReader in ; PrintWriter out ; StringTokenizer st ; String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (Exception e){ } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} public void run()throws Exception { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.flush(); out.close(); in.close(); } public void solve()throws Exception { int n = nextInt();  int k = nextInt();  int[] a = new int[n]; for ( int i = 0;(i < n);i++) {a[i] = nextInt(); } boolean[] ok = new boolean[n]; Arrays.fill(ok,true); Arrays.sort(a); if ( (k != 1)) {for ( int i = 0;(i < n);i++) {if ( ((a[i] % k) == 0)) { int x = (a[i] / k);  int ind = Arrays.binarySearch(a,x); if ( ((ind >= 0) && ok[ind])) {ok[i] = false; } } }} int ans = 0; for ( int i = 0;(i < n);i++) {if ( ok[i]) {ans++; } }out.println(ans); } public static void main( String[] args)throws Exception { new Template().run(); } }
0	public class Main{ public static void main( String[] args){ System.out.println("25"); } }
6	public class B{ private void solve()throws IOException { int senators = nextInt();  int candies = nextInt(); scoreA = nextInt(); lvl = new int[senators]; unloyal = new int[senators]; for ( int i = 0;(i < senators);i++) {lvl[i] = nextInt(); unloyal[i] = (10 - (nextInt() / 10)); }n = senators; give = new int[n]; res = 0; go(0,candies); out.println(res); } static double res ; static int[] lvl ; static int[] unloyal ; static int[] give ; static int n ; static int scoreA ; static double probability(){ double res = 0; for ( int mask = 0;(mask < (1 << n));mask++) { double p = 1;  int scoreB = 0;  int cntGood = Integer.bitCount(mask); for ( int i = 0;(i < n);i++) { int cnt = (unloyal[i] - give[i]); if ( ((mask & (1 << i)) == 0)) {scoreB += lvl[i]; p *= (cnt * .1); } else {p *= ((10 - cnt) * .1); }}if ( ((2 * cntGood) > n)) {res += p; } else {res += ((p * scoreA) / (scoreA + scoreB)); }}return res;} static void go( int man, int candies){ if ( (man == n)) {res = max(res,probability()); return ;} give[man] = 0; go((man + 1),candies); for ( int i = 1;(i <= min(unloyal[man],candies));i++) {give[man] = i; go((man + 1),(candies - i)); }} public static void main( String[] args){ try{br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); new B().solve(); out.close(); }catch (Throwable e){ e.printStackTrace(); System.exit(239); } } static BufferedReader br ; static StringTokenizer st ; static PrintWriter out ; static String nextToken()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String line = br.readLine(); if ( (line == null)) {return null;} st = new StringTokenizer(line); }return st.nextToken();} static int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
0	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } static class TaskA{ public void solve( int testNumber, InputReader in, OutputWriter out){ out.printLine(25); } } static class InputReader{ private InputStream stream ; public InputReader( InputStream stream){ this.stream = stream; } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void close(){ writer.close(); } public void printLine( int i){ writer.println(i); } } }
0	public class A{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long n = sc.nextLong(); System.out.println((3 * (n / 2))); } }
4	public class Main{ static FastScanner fs = new FastScanner(); static class FastScanner{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next(){ while(!st.hasMoreElements())try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } return st.nextToken();} int Int(){ return Integer.parseInt(next());} long Long(){ return Long.parseLong(next());} String Str(){ return next();} } public static void main( String[] args)throws java.lang.Exception { PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  int T = 1; for ( int t = 0;(t < T);t++) { int n = Int();  int k = Int();  int A[][] = new int[n][2];  int a = 0,b = 0,c = 0; for ( int i = 0;(i < A.length);i++) {A[i][0] = Int(); A[i][1] = (Int() - 1); if ( (A[i][1] == 0)) a++; else if ( (A[i][1] == 1)) b++; else c++; } Solution sol = new Solution(out); sol.solution(A,k,a,b,c); }out.close(); } public static int Int(){ return fs.Int();} public static long Long(){ return fs.Long();} public static String Str(){ return fs.Str();} } class Solution{ PrintWriter out ; public Solution( PrintWriter out){ this.out = out; } int mod = 1000000007; long dp3[][][][] ; public void solution( int[][] A, int T, int x, int y, int z){ long res = 0;  int n = A.length;  long dp1[][] = new long[(x + 1)][(T + 1)];  long dp2[][][] = new long[(y + 1)][(z + 1)][(T + 1)]; dp3 = new long[(x + 2)][(y + 2)][(z + 2)][3]; long f[] = new long[(n + 10)]; f[0] = f[1] = 1; for ( int i = 2;(i < f.length);i++) {f[i] = (f[(i - 1)] * i); f[i] %= mod; }for ( int i = 0;(i < dp3.length);i++) {for ( int j = 0;(j < dp3[0].length);j++) {for ( int k = 0;(k < dp3[0][0].length);k++) {Arrays.fill(dp3[i][j][k],-1); }}}dp1[0][0] = 1; long newdp1[][] = new long[dp1.length][dp1[0].length]; for ( int i = 0;(i < A.length);i++) { int p = A[i][0],type = A[i][1]; if ( (type == 0)) {for ( int cnt = 1;(cnt <= x);cnt++) {for ( int j = 1;(j < dp1[0].length);j++) {if ( (j >= p)) {newdp1[cnt][j] += dp1[(cnt - 1)][(j - p)]; newdp1[cnt][j] %= mod; } }}for ( int cnt = 0;(cnt <= x);cnt++) {for ( int j = 0;(j < dp1[0].length);j++) {dp1[cnt][j] += newdp1[cnt][j]; dp1[cnt][j] %= mod; newdp1[cnt][j] = 0; }}} }dp2[0][0][0] = 1; long newdp2[][][] = new long[dp2.length][dp2[0].length][dp2[0][0].length]; for ( int i = 0;(i < A.length);i++) { int p = A[i][0],type = A[i][1]; if ( (type != 0)) {for ( int a = 0;(a < dp2.length);a++) {for ( int b = 0;(b < dp2[0].length);b++) {for ( int j = 0;(j < dp2[0][0].length);j++) {if ( (j >= p)) {if ( (type == 1)) {if ( ((a - 1) >= 0)) {newdp2[a][b][j] += dp2[(a - 1)][b][(j - p)]; } } else {if ( ((b - 1) >= 0)) {newdp2[a][b][j] += dp2[a][(b - 1)][(j - p)]; } }} newdp2[a][b][j] %= mod; }}}for ( int a = 0;(a < dp2.length);a++) {for ( int b = 0;(b < dp2[0].length);b++) {for ( int j = 0;(j < dp2[0][0].length);j++) {dp2[a][b][j] += newdp2[a][b][j]; dp2[a][b][j] %= mod; newdp2[a][b][j] = 0; }}}} }dp3[1][0][0][0] = 1; dp3[0][1][0][1] = 1; dp3[0][0][1][2] = 1; for ( int i = 0;(i < dp3.length);i++) {for ( int j = 0;(j < dp3[0].length);j++) {for ( int k = 0;(k < dp3[0][0].length);k++) {for ( x = 0;(x < dp3[0][0][0].length);x++) {if ( (dp3[i][j][k][x] == -1)) {dfs(i,j,k,x); } }}}}for ( int i = 0;(i < (dp3.length - 1));i++) {for ( int j = 0;(j < (dp3[0].length - 1));j++) {for ( int k = 0;(k < (dp3[0][0].length - 1));k++) {for ( int cur = 0;(cur < 3);cur++) {for ( int t = 0;(t <= T);t++) { int aprice = t;  int bcprice = (T - t);  long cnt1 = dp1[i][aprice];  long cnt2 = dp2[j][k][bcprice];  long combination = dp3[i][j][k][cur];  long p1 = ((cnt1 * f[i]) % mod);  long p2 = ((((f[j] * f[k]) % mod) * cnt2) % mod);  long p3 = ((p1 * p2) % mod); res += ((p3 * combination) % mod); res %= mod; }}}}}out.println(res); } public long dfs( int a, int b, int c, int cur){ if ( (((a < 0) || (b < 0)) || (c < 0))) {return 0;} if ( (((a == 0) && (b == 0)) && (c == 0))) {return 0;} if ( (dp3[a][b][c][cur] != -1)) return dp3[a][b][c][cur]; long res = 0; if ( (cur == 0)) {res += dfs((a - 1),b,c,1); res %= mod; res += dfs((a - 1),b,c,2); res %= mod; } else if ( (cur == 1)) {res += dfs(a,(b - 1),c,0); res %= mod; res += dfs(a,(b - 1),c,2); res %= mod; } else {res += dfs(a,b,(c - 1),0); res %= mod; res += dfs(a,b,(c - 1),1); res %= mod; }res %= mod; dp3[a][b][c][cur] = res; return res;} }
5	public class Main{ public static void main( String[] args)throws IOException { BufferedReader c = new BufferedReader(new InputStreamReader(System.in));  String S[] = c.readLine().split(" ");  int N = Integer.parseInt(S[0]);  int K = Integer.parseInt(S[1]);  int A[] = parseArray(c.readLine(),N); shuffle(A); Arrays.sort(A); TreeMap<Long,Long> T = new TreeMap<Long,Long>();  int ans = 0; for ( int i = 0;(i < N);i++) T.put((long)A[i],1L); if ( (K == 1)) {System.out.println(N); return ;} else {for ( int i = 0;(i < N);i++) {if ( (((A[i] % K) == 0) && T.containsKey(((long)A[i] / K)))) continue; int chainSize = 0;  long init = A[i]; while(T.containsKey(init)){chainSize++; init = (init * K); }ans += ((chainSize + 1) / 2); }}System.out.println(ans); } public static int[] shuffle( int[] A){ int N = A.length; for ( int i = 1;(i < N);i++) { int j = ((int)(Math.random() * 100000) % (i + 1));  int temp = A[i]; A[i] = A[j]; A[j] = temp; }return A;} public static int[] parseArray( String s, int N){ int A[] = new int[N];  StringTokenizer st = new StringTokenizer(s); for ( int i = 0;(i < N);i++) A[i] = Integer.parseInt(st.nextToken()); return A;} }
4	public class CF1515E{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int md = sc.nextInt();  int k = ((n + 1) / 2);  int[][] dp = new int[(k + 1)][(n + 1)]; dp[0][0] = 1; for ( int h = 1;(h <= k);h++) for ( int l = h;(l <= ((n - h) + 1));l++) dp[h][l] = (int)((((dp[h][(l - 1)] * 2L) + dp[(h - 1)][(l - 1)]) * h) % md); int ans = 0; for ( int h = 1;(h <= k);h++) ans = ((ans + dp[h][((n - h) + 1)]) % md); System.out.println(ans); } }
6	public class E{ static int n ; static int m ; static int[][][] DP ; static int[] dx = {0,0,1,-1}; static int[] dy = {1,-1,0,0}; static int inf = 1000000; public static int get( int x, int current, int last){ if ( (x == n)) {if ( (last == 0)) return 0; else return -inf;} if ( (DP[x][current][last] != -1)) return DP[x][current][last]; int max = 0; for ( int mask = 0;(mask < (1 << m));mask++) { int tempLast = last;  int tempCurrent = current;  int tempNext = ((1 << m) - 1); for ( int i = 0;(i < m);i++) if ( ((mask & (1 << i)) != 0)) {if ( (i > 0)) tempCurrent &= (1 << (i - 1)); if ( (i < (m - 1))) tempCurrent &= (1 << (i + 1)); tempNext &= (1 << i); tempLast &= (1 << i); } if ( (tempLast != 0)) continue; max = Math.max(max,((m - Integer.bitCount(mask)) + get((x + 1),tempNext,(tempCurrent & ~mask)))); }return DP[x][current][last] = max;} public static void main( String[] args){ Scanner in = new Scanner(System.in);  int x = in.nextInt();  int y = in.nextInt(); n = Math.max(x,y); m = Math.min(x,y); DP = new int[n][(1 << m)][(1 << m)]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < (1 << m));j++) Arrays.fill(DP[i][j],-1); System.out.println(get(0,((1 << m) - 1),0)); } }
2	public class D276{ Scanner sc = new Scanner(in); public void run(){ long l = sc.nextLong(),r = sc.nextLong();  long tes = (l ^ r);  int d = 0; while((tes != 0)){tes /= 2; d++; }ln(((1L << d) - 1)); } public static void main( String[] _){ new D276().run(); } public static void ln( Object o){ out.println(o); } public static void ln(){ out.println(); } }
2	public class a{ static long mod = 1000000009; static ArrayList<Integer>[] g ; public static void main( String[] args)throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out);  int n = input.nextInt(),m = input.nextInt(),k = input.nextInt();  long border = (n - (n / k)); if ( (m <= border)) out.println(m); else { long count = (m - border);  long first = ((((pow(2,(count + 1)) + mod) - 2) * k) % mod); first += (m - (k * count)); out.println((first % mod)); }out.close(); } static long pow( long x, long p){ if ( (p == 0)) return 1; if ( ((p & 1) > 0)) {return ((x * pow(x,(p - 1))) % mod);} long sqrt = pow(x,(p / 2)); return ((sqrt * sqrt) % mod);} static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} }
6	public class p105b{ static int[] b ,l ; static int n ; static int A ; static boolean[] masks ; static double max ; public static double work( int index, int k, int mask){ if ( (index == n)) {if ( ((Integer.bitCount(mask) * 2) <= n)) { int sum = 0; for ( int i = 0;(i < n);i++) {if ( (((1 << i) & mask) == 0)) {sum += b[i]; } }return ((A * 1.0) / ((A * 1.0) + sum));} return 1;} double max = 0;  int to = Math.min(k,((100 - l[index]) / 10)); for ( int i = to;(i >= 0);i--) { double loy = (l[index] + (i * 10));  double b = (((100.0 - loy) / 100.0) * work((index + 1),(k - i),mask));  double a = ((loy / 100.0) * work((index + 1),(k - i),(mask | (1 << index)))); max = Math.max(max,(a + b)); }return max;} public static void rec( int index, int k){ if ( (k == -1)) return ; if ( (index == n)) { double tot = 0; for ( int i = 0;(i < (1 << n));i++) { double temp = 1.0;  int bb = 0; for ( int j = 0;(j < n);j++) {if ( (l[j] > 100)) return ; if ( (((1 << j) & i) != 0)) {temp *= ((l[j] * 1.0) / 100.0); } else {bb += b[j]; temp *= ((100.0 - l[j]) / 100.0); }}if ( ((Integer.bitCount(i) * 2) <= n)) {temp *= ((A * 1.0) / ((A * 1.0) + bb)); } tot += temp; }max = Math.max(max,tot); return ;} l[index] += 10; rec(index,(k - 1)); l[index] -= 10; rec((index + 1),k); } public static void main( String[] args){ Scanner in = new Scanner(System.in); n = in.nextInt(); int k = in.nextInt(); A = in.nextInt(); b = new int[n]; l = new int[n]; for ( int i = 0;(i < n);i++) {b[i] = in.nextInt(); l[i] = in.nextInt(); }masks = new boolean[(1 << n)]; max = 0; rec(0,k); System.out.println(max); } }
6	public class BNew{ double gAns = 0; public static void main( String[] args)throws IOException { new BNew().solve(); } private void solve()throws IOException { MyScanner in = new MyScanner(new BufferedReader(new InputStreamReader(System.in)));  int n = in.nextInt();  int k = in.nextInt();  int A = in.nextInt();  List<Senator> allSenators = new ArrayList<Senator>(); for ( int i = 0;(i < n);i++) { int level = in.nextInt();  int loyalty = in.nextInt(); allSenators.add(new Senator(level,loyalty)); }allSenators = Collections.unmodifiableList(allSenators); int npow2 = (1 << n); rec(allSenators,0,k,A); for ( int okSenatorMask = 0;(okSenatorMask < npow2);okSenatorMask++) { List<Senator> okSenators = copy(getSenatorsByMask(okSenatorMask,allSenators)); liftLeastSenators(okSenators,k); List<Senator> updatedSenators = new ArrayList<Senator>(okSenators);  List<Senator> otherSenators = getSenatorsByMask(((npow2 - 1) - okSenatorMask),allSenators); updatedSenators.addAll(otherSenators); check(updatedSenators,A); }in.close(); PrintWriter pw = new PrintWriter(System.out); System.out.printf("%.6f\n",gAns); pw.close(); } private void rec( List<Senator> senators, int senatorId, int k, int A){ if ( (senatorId == senators.size())) {check(senators,A); return ;} Senator senator = senators.get(senatorId);  int up = Math.min(k,((100 - senator.loyalty) / 10)); final int old = senator.loyalty; for ( int i = 0;(i <= up);i++) {senator.loyalty = (old + (i * 10)); rec(senators,(senatorId + 1),(k - i),A); }senator.loyalty = old; } private void check( List<Senator> senators, double A){ double winProp = 0.0; for ( int mask = 0;(mask < (1 << senators.size()));mask++) { double caseP = 1.0;  int okCnt = 0;  int notOkLevelSum = 0; for ( int i = 0;(i < senators.size());i++) { Senator senator = senators.get(i);  double senatorLoyalty = (senator.loyalty / 100.0);  boolean ok = ((mask & (1 << i)) != 0); if ( ok) {caseP *= senatorLoyalty; okCnt++; } else {caseP *= (1 - senatorLoyalty); notOkLevelSum += senator.level; }}if ( ((okCnt * 2) > senators.size())) {winProp += caseP; } else { double killProp = (A / (A + notOkLevelSum)); winProp += (caseP * killProp); }}gAns = Math.max(gAns,winProp); } List<Senator> copy( List<Senator> senators){ List<Senator> copied = new ArrayList<Senator>(); for ( Senator senator :senators) {copied.add(new Senator(senator.level,senator.loyalty)); }return copied;} void liftLeastSenators( List<Senator> senators, int k){ if ( senators.isEmpty()) {return ;} for ( int i = 0;(i < k);i++) { Senator least = senators.get(0); for ( Senator senator :senators) {if ( (senator.loyalty < least.loyalty)) {least = senator; } }if ( (least.loyalty < 100)) {least.loyalty += 10; } }} List<Senator> getSenatorsByMask( int mask, List<Senator> allSenators){ List<Senator> list = new ArrayList<Senator>(); for ( int i = 0;(i < allSenators.size());i++) {if ( ((mask & (1 << i)) != 0)) {list.add(allSenators.get(i)); } }return list;} static class Senator{ final int level ; int loyalty ; Senator( int level, int loyalty){ this.level = level; this.loyalty = loyalty; } } static class MyScanner{ final BufferedReader myBr ; StringTokenizer st = new StringTokenizer(""); MyScanner( BufferedReader br){ myBr = br; } String nextToken()throws IOException { while(!st.hasMoreTokens()){st = new StringTokenizer(myBr.readLine()); }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} void close()throws IOException { myBr.close(); } } }
3	public class C{ public static void main( String[] args){ FastScanner scan = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int n = scan.nextInt(),r = scan.nextInt();  int[] x = scan.nextIntArray(n);  double[] y = new double[n]; for ( int i = 0;(i < n);i++) { double best = 0; for ( int j = 0;(j < i);j++) {if ( (Math.abs((dist(x[i],y[j],x[j],y[j]) - (2 * r))) <= 1e-7)) {best = Math.max(best,y[j]); continue;} double lo = ((y[j] - r) - r),hi = ((y[j] + r) + r); for ( int bs = 0;(bs < 200);bs++) { double mid = ((lo + hi) / 2.0); if ( ((dist(x[i],mid,x[j],y[j]) - (2 * r)) <= 1e-7)) lo = mid; else hi = mid; }if ( ((dist(x[i],lo,x[j],y[j]) - (2 * r)) <= 1e-7)) best = Math.max(best,lo); }if ( (best == 0)) y[i] = r; else y[i] = best; }for ( int i = 0;(i < n);i++) out.printf("%.6f ",y[i]); out.close(); } static double dist( double x, double y, double xx, double yy){ return Math.sqrt((((x - xx) * (x - xx)) + ((y - yy) * (y - yy))));} static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner(){ try{br = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(br.readLine()); }catch (Exception e){ e.printStackTrace(); } } public String next(){ if ( st.hasMoreTokens()) return st.nextToken(); try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ e.printStackTrace(); } return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} public double nextDouble(){ return Double.parseDouble(next());} public int[] nextIntArray( int n){ int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = nextInt(); return a;} } }
2	public class BT{ Scanner in ; PrintWriter out ; String INPUT = ""; int q( int r1, int c1, int r2, int c2){ out.printf("? %d %d %d %d\n",(r1 + 1),(c1 + 1),(r2 + 1),(c2 + 1)); out.flush(); return ni();} void e( int r1, int c1, int r2, int c2, int r3, int c3, int r4, int c4){ out.printf("! %d %d %d %d %d %d %d %d\n",(r1 + 1),(c1 + 1),(r2 + 1),(c2 + 1),(r3 + 1),(c3 + 1),(r4 + 1),(c4 + 1)); out.flush(); } void solve(){ int n = ni();  int cu = -1,cv = -1; { int low = -1,high = (n - 1); while(((high - low) > 1)){ int h = ((high + low) >> 1); if ( (q(0,0,(n - 1),h) >= 2)) {high = h; } else {low = h; }}cu = high; }{ int low = -1,high = (n - 1); while(((high - low) > 1)){ int h = ((high + low) >> 1); if ( (q(0,0,(n - 1),h) >= 1)) {high = h; } else {low = h; }}cv = high; } int du = -1,dv = -1; { int low = 0,high = n; while(((high - low) > 1)){ int h = ((high + low) >> 1); if ( (q(0,h,(n - 1),(n - 1)) >= 2)) {low = h; } else {high = h; }}du = low; }{ int low = 0,high = n; while(((high - low) > 1)){ int h = ((high + low) >> 1); if ( (q(0,h,(n - 1),(n - 1)) >= 1)) {low = h; } else {high = h; }}dv = low; } int eu = -1,ev = -1; { int low = -1,high = (n - 1); while(((high - low) > 1)){ int h = ((high + low) >> 1); if ( (q(0,0,h,(n - 1)) >= 2)) {high = h; } else {low = h; }}eu = high; }{ int low = -1,high = (n - 1); while(((high - low) > 1)){ int h = ((high + low) >> 1); if ( (q(0,0,h,(n - 1)) >= 1)) {high = h; } else {low = h; }}ev = high; } int fu = -1,fv = -1; { int low = 0,high = n; while(((high - low) > 1)){ int h = ((high + low) >> 1); if ( (q(h,0,(n - 1),(n - 1)) >= 2)) {low = h; } else {high = h; }}fu = low; }{ int low = 0,high = n; while(((high - low) > 1)){ int h = ((high + low) >> 1); if ( (q(h,0,(n - 1),(n - 1)) >= 1)) {low = h; } else {high = h; }}fv = low; } int[][][] canc = {{{du,cu},{dv,cv}},{{du,cv},{dv,cu}}};  int[][][] canr = {{{fu,eu},{fv,ev}},{{fu,ev},{fv,eu}}}; for ( int[][] cr :canr) {if ( (cr[0][0] > cr[0][1])) continue; if ( (cr[1][0] > cr[1][1])) continue; for ( int[][] cc :canc) {if ( (cc[0][0] > cc[0][1])) continue; if ( (cc[1][0] > cc[1][1])) continue; for ( int z = 0;(z < 2);z++) {if ( ((q(cr[0][0],cc[(0 ^ z)][0],cr[0][1],cc[(0 ^ z)][1]) == 1) && (q(cr[1][0],cc[(1 ^ z)][0],cr[1][1],cc[(1 ^ z)][1]) == 1))) {e(cr[0][0],cc[(0 ^ z)][0],cr[0][1],cc[(0 ^ z)][1],cr[1][0],cc[(1 ^ z)][0],cr[1][1],cc[(1 ^ z)][1]); return ;} }}}throw (new RuntimeException());} void run()throws Exception { in = (oj?new Scanner(System.in):new Scanner(INPUT)); 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 BT().run(); } int ni(){ return Integer.parseInt(in.next());} boolean oj = (System.getProperty("ONLINE_JUDGE") != null); void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
2	public class Main{ public static Character solve( long a, long b, long c){ long min = a;  long max ;  long xth = 0;  long index ; for ( index = (String.valueOf(a).length() - 1);;index++) { long numOfDigits = 0; max = ((long)Math.pow(10,(index + 1)) - 1); long count = (((max - min) / b) + 1); numOfDigits += (count * (index + 1)); if ( ((c - numOfDigits) <= 0)) {break;} c -= numOfDigits; min = (min + (count * b)); }if ( ((c % (index + 1)) == 0)) {xth = (c / (index + 1)); } else {xth = ((c / (index + 1)) + 1); } long lastNum = (min + (b * (xth - 1)));  int pos = (int)(c % (index + 1)); if ( (pos == 0)) {return String.valueOf(lastNum).charAt((int)index);} else {return String.valueOf(lastNum).charAt((pos - 1));}} public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long tc ; tc = sc.nextLong(); System.out.println(solve(1,1,tc)); } }
0	public class A{ public static void main( String[] args){ Scanner x = new Scanner(System.in);  int n = x.nextInt(); if ( ((n % 2) == 0)) {System.out.println((((n - 4) + " ") + "4")); } else {System.out.println((((n - 9) + " ") + "9")); }} }
0	public class Main{ public static void main( String[] args){ Scanner read = new Scanner(System.in);  int n = read.nextInt(); System.out.println(((n * 3) / 2)); } }
2	public class D{ public static void main( String[] args)throws IOException { try(Input input=new StandardInput();PrintWriter writer=new PrintWriter(System.out)){ long[] s = new long[40]; for ( int i = 1;(i < s.length);i++) {s[i] = (1 + (4 * s[(i - 1)])); if ( (i >= 32)) {s[i] = Long.MAX_VALUE; } } Function<Integer,Long> getS = (i)->((i < s.length)?s[i]:Long.MAX_VALUE);  int t = input.nextInt(); for ( int tt = 0;(tt < t);tt++) { int n = input.nextInt();  long k = input.nextLong();  long kk = 1;  BigInteger maxDivisions = BigInteger.ZERO; for ( int division = 1;(division <= n);division++) { long needToDivide = ((1L << division) - 1); if ( (needToDivide > k)) {writer.println("NO"); continue testCase;} k -= needToDivide; maxDivisions = maxDivisions.add(BigInteger.valueOf(kk).multiply(BigInteger.valueOf(getS.apply((n - division))))); if ( (maxDivisions.compareTo(BigInteger.valueOf(k)) >= 0)) {writer.println(("YES " + (n - division))); continue testCase;} kk += (1L << (division + 1)); }writer.println("NO"); } }} interface Input extends Closeable{ String next()throws IOException ; default int nextInt()throws IOException { return Integer.parseInt(next());} default long nextLong()throws IOException { return Long.parseLong(next());} } static private class StandardInput implements Input{ private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); private StringTokenizer stringTokenizer ; @Override public void close()throws IOException { reader.close(); } @Override public String next()throws IOException { if ( ((stringTokenizer == null) || !stringTokenizer.hasMoreTokens())) {stringTokenizer = new StringTokenizer(reader.readLine()); } return stringTokenizer.nextToken();} } }
0	public class A630{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  String s = sc.nextLine(); System.out.println("25"); } }
4	@SuppressWarnings("unused") public class Solution{ static long mod = -1; static long[] fact ,invfact ,pow ; static long[][] C ; static long[][] dp ; static final int N = 405; static int n ; public static void main( String[] args)throws IOException { FastScanner fs = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int tt = 1; outer:while((tt-- > 0)){n = fs.nextInt(); mod = fs.nextLong(); dp = new long[N][N]; precompute(); dp[0][0] = 1; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= i);j++) {for ( int k = 1;((i + k) <= n);k++) {dp[((i + k) + 1)][(j + k)] += ((((dp[i][j] * pow[(k - 1)]) % mod) * C[(j + k)][k]) % mod); dp[((i + k) + 1)][(j + k)] %= mod; }}} long ans = 0; for ( int i = 0;(i <= n);i++) {ans = ((ans + dp[(n + 1)][i]) % mod); }out.println(ans); }out.close(); } static void precompute(){ fact = new long[N]; invfact = new long[N]; C = new long[N][N]; pow = new long[N]; fact[0] = 1; for ( int i = 1;(i <= n);i++) fact[i] = ((fact[(i - 1)] * i) % mod); invfact[n] = inv(fact[n]); for ( int i = (n - 1);(i >= 0);i--) invfact[i] = ((invfact[(i + 1)] * (i + 1)) % mod); pow[0] = 1; for ( int i = 1;(i <= n);i++) pow[i] = ((pow[(i - 1)] * 2) % mod); for ( int i = 1;(i <= n);i++) {for ( int j = 0;(j <= i);j++) {if ( ((j == 0) || (j == i))) C[i][j] = 1; else C[i][j] = ((C[(i - 1)][(j - 1)] + C[(i - 1)][j]) % mod); }}} static long exp( long a, long n){ long res = 1; while((n > 0)){if ( ((n & 1) == 1)) res = ((res * a) % mod); a = ((a * a) % mod); n = (n >> 1); }return res;} static long inv( long n){ return exp(n,(mod - 2));} static final Random random = new Random(); static class FastScanner{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next(){ while(!st.hasMoreElements()){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} } }
5	public class test{ public static void main( String[] args){ Scanner s = new Scanner(System.in);  int n = s.nextInt();  int m = s.nextInt();  int arr[] = new int[n];  int max = Integer.MIN_VALUE;  long sum = 0; for ( int i = 0;(i < n);i++) {arr[i] = s.nextInt(); sum = (sum + arr[i]); max = Math.max(max,arr[i]); }Arrays.sort(arr); int i = 0;  int count = 0;  int d = 0; for ( i = 0;(i < n);i++) {if ( (arr[i] > d)) {count++; d++; } else if ( ((arr[i] == d) && (arr[i] > 0))) {count++; } }if ( ((max - d) > 0)) {count = ((count + max) - d); } System.out.println((sum - count)); } }
5	public class CoveredPointsCount{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  long[] myArray = new long[(2 * n)]; for ( int i = 0;(i < n);i++) { StringTokenizer st1 = new StringTokenizer(br.readLine()); myArray[(2 * i)] = (Long.parseLong(st1.nextToken()) * 2); myArray[((2 * i) + 1)] = ((Long.parseLong(st1.nextToken()) * 2) + 1); }Arrays.sort(myArray); long[] ans = new long[(n + 1)];  int cnt = 0; for ( int i = 0;(i < ((2 * n) - 1));i++) {if ( ((myArray[i] % 2) == 0)) cnt++; else cnt--; ans[cnt] += (((myArray[(i + 1)] + 1) / 2) - ((myArray[i] + 1) / 2)); } StringBuilder answer = new StringBuilder(); for ( int i = 1;(i < (n + 1));i++) {answer.append(ans[i]); answer.append(" "); }System.out.println(answer); } }
2	public class D{ public Object solve(){ long N = sc.nextLong(),K = (sc.nextLong() - 1); if ( (N >= 32)) return print("YES",(N - 1)); long A = (1L << (N - 1)),C = 4,T = (((A * A) - 1) / 3); while(((A > 1) && (K > T))){A /= 2; K -= (C - 1); C *= 2; T += (((C - 3) * ((A * A) - 1)) / 3); }if ( ((K >= 0) && (K <= T))) return print("YES",Long.numberOfTrailingZeros(A)); else return print("NO");} static private final boolean ONE_TEST_CASE = false; static private void init(){ } static private IOUtils.MyScanner sc = new IOUtils.MyScanner(); static private Object print( Object o, Object... A){ IOUtils.print(o,A); return null;} public static void main( String[] args){ init(); int N = (ONE_TEST_CASE?1:sc.nextInt()); IOUtils.run(N); } }
3	public class Main{ static int x[] = new int[1005]; static double ans[] = new double[1005]; static int nn ,r ; public static void main( String[] args)throws IOException { StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));  Scanner sc = new Scanner(System.in);  int huiwoqingchun = 0; nn = sc.nextInt(); r = sc.nextInt(); for ( int i = 1;(i <= nn);i++) {x[i] = sc.nextInt(); }ans[1] = r; int lajitimu = 0; for ( int i = 2;(i <= nn);i++) {ans[i] = r; for ( int j = 1;(j < i);j++) {if ( (Math.abs((x[j] - x[i])) > (2 * r))) continue; ans[i] = Math.max(ans[i],(ans[j] + Math.sqrt((((4 * r) * r) - ((x[j] - x[i]) * (x[j] - x[i])))))); }} double buzhidaoganma = 0; for ( int c = 1;(c <= nn);c++) System.out.printf("%.12f ",ans[c]); } }
6	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);  int T = in.nextInt(); for ( int cT = 1;(cT <= T);cT++) { Task solver = new Task(); solver.solve(cT,in,out); }out.close(); } static class data{ int val ,col ; data( int _val, int _col){ val = _val; col = _col; } } static class Task{ int[][] a ; int[][] b ; int[][] dp ; int[][] mb ; ArrayList<data> all = new ArrayList<>(); Set<Integer> st = new HashSet<>(); int n ,m ; int cal( int col, int mask){ if ( (col == m)) {if ( (Integer.bitCount(mask) == n)) return 0; return (int)1e9;} int ret = dp[col][mask]; if ( (ret != -1)) return ret; int rmask = (mask ^ ((1 << n) - 1)); for ( int mask2 = rmask;(mask2 > 0);mask2 = (rmask & (mask2 - 1))) { int now = (cal((col + 1),(mask | mask2)) + mb[col][mask2]); ret = Math.max(ret,now); }ret = Math.max(ret,cal((col + 1),mask)); dp[col][mask] = ret; return ret;} void prepMb(){ for ( int col = 0;(col < m);col++) {for ( int mask = 1;(mask < (1 << n));mask++) { int nmask = mask; while(((nmask & 1) == 0))nmask >>= 1; if ( (nmask == mask)) {for ( int shift = 0;(shift < n);shift++) { int sum = 0;  int tmask = mask; while((tmask > 0)){ int i = Integer.numberOfTrailingZeros(tmask); sum += b[((i + shift) % n)][col]; tmask ^= (1 << i); }mb[col][mask] = Math.max(mb[col][mask],sum); }} else {mb[col][mask] = mb[col][nmask]; }}}} void solve( int testNumber, InputReader in, PrintWriter out){ n = in.nextInt(); m = in.nextInt(); a = new int[n][m]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {a[i][j] = in.nextInt(); all.add(new data(a[i][j],j)); }}Collections.sort(all,new Comparator<data>(){}); for ( data it :all) {if ( (st.size() == n)) break; st.add(it.col); }b = new int[n][st.size()]; int rcol = 0; for ( int col :st) {for ( int row = 0;(row < n);row++) b[row][rcol] = a[row][col]; rcol++; }m = st.size(); dp = new int[n][(1 << n)]; mb = new int[m][(1 << n)]; prepMb(); for ( int i = 0;(i < n);i++) Arrays.fill(dp[i],-1); System.out.println(cal(0,0)); } } 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());} } }
0	public class Govnokod{ public static void main( String[] args){ try{ InputStreamReader isr = new InputStreamReader(System.in);  BufferedReader br = new BufferedReader(isr); while(true){ String str = br.readLine();  int i = Integer.parseInt(str); System.out.println(((i * 2) - (i / 2))); return ;} }catch (Exception e){ e.printStackTrace(); } } }
1	public class A{ public static int palin( String str){ int flag = 0;  int l = str.length(); for ( int i = 0;(i < (l / 2));i++) {if ( (str.charAt(i) != str.charAt(((l - i) - 1)))) {flag = 1; break;} }if ( (flag == 1)) return 0; else return 1;} public static void main( String[] args){ Scanner sc = new Scanner(System.in);  String str = sc.next();  HashSet<Character> hs = new HashSet<>(); for ( int i = 0;(i < str.length());i++) {hs.add(str.charAt(i)); }if ( (hs.size() == 1)) System.out.println(0); else if ( (palin(str) == 0)) System.out.println(str.length()); else System.out.println((str.length() - 1)); } }
2	@SuppressWarnings("unchecked") public class Solution 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 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 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 interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } static int num = (int)1e6; public static int random( int min, int max){ return (min + (int)((max - min) * Math.random()));} public static long pow( long n, int pow){ long res = 1; while((pow != 0)){if ( ((pow & 1) == 1)) {res *= n; } n *= n; pow = (pow >> 1); }return res;} public static int bsearch( int n, long k){ int l = 1;  int r = n; while((r > l)){ int mid = (((l + r) + 1) >> 1); if ( (((pow(2,(mid + 1)) - mid) - 2) <= k)) {l = mid; } else {r = (mid - 1); }}if ( ((((pow(2,(l + 1)) - l) - 2) == 0) && (((pow(2,(l + 1)) - l) - 2) == k))) {return 0;} else if ( (((pow(2,(l + 1)) - l) - 2) <= k)) {return l;} return 0;} public static boolean valid( int n, long k, int steps){ long total_max = ((pow(4,n) - 1) / 3);  long cant_be = (((pow(4,(n - steps)) - 1) / 3) * (pow(2,(steps + 1)) - 1));  long available = (total_max - cant_be); if ( (available >= k)) {return true;} return false;} public static void main( String[] args)throws Exception { new Thread(null,new Solution(),"Main",(1 << 26)).start(); } }
0	public class LCMChallenge{ public static void main( String[] args)throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  long n = Long.parseLong(f.readLine()); if ( ((n == 1) || (n == 2))) System.out.println(n); else if ( ((n % 2) == 1)) System.out.println(((n * (n - 1)) * (n - 2))); else { long prod = (n * (n - 1));  long x = (n - 2); while((((x > 0) && (gcd(n,x) > 1)) || (gcd((n - 1),x) > 1)))x--; prod *= x; if ( ((((n - 1) * (n - 2)) * (n - 3)) > prod)) prod = (((n - 1) * (n - 2)) * (n - 3)); System.out.println(prod); }} public static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} }
2	public class Main{ public static void main( String[] args)throws IOException { FastScanner sc = new FastScanner();  long K = sc.nextLong();  long nums = 9;  int digits = 1; while((K > (nums * digits))){K -= (nums * digits); nums *= 10; digits++; } long removal = ((K - 1) / digits);  int pos = (int)((K - 1) % digits);  long base = (long)Math.pow(10,(digits - 1));  String num = Long.toString((base + removal)); System.out.println(num.charAt(pos)); } static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} long nextLong(){ return Long.parseLong(next());} } }
4	public class D{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); StringTokenizer stringTokenizer ; String next()throws IOException { while(((stringTokenizer == null) || !stringTokenizer.hasMoreTokens())){stringTokenizer = new StringTokenizer(reader.readLine()); }return stringTokenizer.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} final int MOD = (((1000 * 1000) * 1000) + 7); @SuppressWarnings void solve()throws IOException { final int n = nextInt();  int m = nextInt();  int[] from = new int[m];  int[] to = new int[m]; for ( int i = 0;(i < m);i++) {from[i] = nextInt(); to[i] = nextInt(); } int ans = solve(n,m,from,to); writer.println(ans); writer.close(); } private int solve(final int n, int m, int[] from, int[] to){ final List<List<Integer>> g = new ArrayList<>(); final List<List<Integer>> rg = new ArrayList<>(); for ( int i = 0;(i <= n);i++) {g.add(new ArrayList<Integer>()); rg.add(new ArrayList<Integer>()); } int[] c = new int[(n + 1)];  int[] loop = new int[(n + 1)]; for ( int i = 0;(i < m);i++) { int u = from[i];  int v = to[i]; g.get(u).add(v); rg.get(v).add(u); c[u]++; c[v]++; if ( (u == v)) {loop[u]++; } } class Utils{ int[] prev = new int[(n + 1)]; int[] next = new int[(n + 1)]; int[] used = new int[(n + 1)]; int mark ; int forbidden ; int maxMatch(){ maxMatch = 0; for ( int i = 1;(i <= n);i++) {mark = i; if ( findPath(i)) {maxMatch++; } }return maxMatch;} boolean findPath( int u){ if ( (u == forbidden)) {return false;} used[u] = mark; for ( int v :g.get(u)) {if ( (v == forbidden)) {continue;} if ( ((prev[v] == 0) || ((used[prev[v]] != mark) && findPath(prev[v])))) {prev[v] = u; next[u] = v; return true;} }return false;} int maxMatch = 0; void amend( int u){ if ( findPath(u)) {maxMatch++; } } } int ans = Integer.MAX_VALUE; for ( int i = 1;(i <= n);i++) { Utils utils = new Utils(); utils.forbidden = i; utils.maxMatch(); ans = Math.min(ans,((((((2 * n) - 1) - c[i]) + loop[i]) + (((m - c[i]) + loop[i]) - utils.maxMatch)) + ((n - 1) - utils.maxMatch))); }return ans;} public static void main( String[] args)throws IOException { new D().solve(); } }
0	public class Main{ public static void main( String[] args){ new Main().run(); } void run(){ Locale.setDefault(Locale.US); try(Scanner in=new Scanner(System.in);PrintWriter out=new PrintWriter(System.out)){solve(in,out); }catch (Exception e){ e.printStackTrace(); } } private void solve( Scanner in, PrintWriter out){ String a = in.nextLine(); out.println("25"); } }
4	public class Main{ void run(){ Locale.setDefault(Locale.US); boolean oj = (System.getProperty("ONLINE_JUDGE") != null); try{if ( oj) {sc = new FastScanner(new InputStreamReader(System.in)); out = new PrintWriter(new OutputStreamWriter(System.out)); } else {sc = new FastScanner(new FileReader("in.txt")); out = new PrintWriter(new FileWriter("out.txt")); } }catch (Exception e){ System.exit(-1); } long tB = System.currentTimeMillis(); solve(); if ( !oj) System.err.println(("Time: " + ((System.currentTimeMillis() - tB) / 1e3))); out.flush(); } class FastScanner{ BufferedReader br ; StringTokenizer st = new StringTokenizer(""); FastScanner( InputStreamReader a){ br = new BufferedReader(a); } FastScanner( FileReader a){ br = new BufferedReader(a); } String next(){ while(!st.hasMoreTokens())try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ return null;} return st.nextToken();} String readLine(){ try{return br.readLine(); }catch (Exception e){ return null;} } int nextInt(){ return Integer.parseInt(next());} } FastScanner sc ; PrintWriter out ; public static void main( String[] args){ new Main().run(); } void exit( int val){ out.flush(); System.exit(val); } int n ,m ; boolean[][] grid ; ArrayList<Integer>[] gr ; int c ; int[] mt ; boolean[] u ; boolean try_kuhn( int v){ if ( u[v]) return false; u[v] = true; for ( int to :gr[v]) {if ( (to == c)) continue; if ( ((mt[to] == -1) || try_kuhn(mt[to]))) {mt[to] = v; return true;} }return false;} void solve(){ n = sc.nextInt(); m = sc.nextInt(); grid = new boolean[(n + 1)][(n + 1)]; gr = new ArrayList[(n + 1)]; for ( int v = 1;(v <= n);++v) gr[v] = new ArrayList<Integer>(); for ( int it = 0;(it < m);++it) { int a = sc.nextInt();  int b = sc.nextInt(); grid[a][b] = true; gr[a].add(b); } int ans = Integer.MAX_VALUE; for ( c = 1;(c <= n);++c) { int curAns = 0; for ( int v = 1;(v <= n);++v) if ( (v != c)) {if ( !grid[c][v]) ++curAns; if ( !grid[v][c]) ++curAns; } if ( !grid[c][c]) ++curAns; mt = new int[(n + 1)]; fill(mt,-1); for ( int i = 1;(i <= n);++i) if ( (i != c)) {u = new boolean[(n + 1)]; try_kuhn(i); } int szMt = 0; for ( int i = 1;(i <= n);++i) if ( (mt[i] != -1)) ++szMt; curAns += ((n - 1) - szMt); for ( int a = 1;(a <= n);++a) {for ( int b :gr[a]) {if ( ((a == c) || (b == c))) continue; if ( (a != mt[b])) ++curAns; }}ans = min(ans,curAns); }out.println(ans); } }
6	public class E{ public static void main( String[] args){ new E().solve(); } private int c( int n){ return ((n * (n - 1)) / 2);} public void solve(){ Locale.setDefault(Locale.US); Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  double[][] pb = new double[n][n]; for ( int i = 0;(i < n);++i) for ( int j = 0;(j < n);++j) pb[i][j] = sc.nextDouble(); int m = (1 << n);  double[] dp = new double[m]; dp[0] = 1.0f; for ( int i = 1;(i < m);++i) for ( int j = 0;(j < n);++j) if ( ((i & (1 << j)) != 0)) for ( int k = 0;(k < n);++k) if ( ((i & (1 << k)) == 0)) dp[i] += ((pb[k][j] * dp[(i & (1 << j))]) / c(((n - Integer.bitCount(i)) + 1)));  int w = ((1 << n) - 1); for ( int i = 0;(i < (n - 1));++i) System.out.printf("%.6f ",dp[(w & (1 << i))]); System.out.printf("%.6f\n",dp[(w & (1 << (n - 1)))]); } }
2	public class Dj{ public static long run( long l, long r){ if ( (l == r)) {return 0;} long[] sq2 = new long[62]; sq2[0] = 1; for ( int i = 1;(i < 62);i++) sq2[i] = (sq2[(i - 1)] * 2); for ( int i = (sq2.length - 1);(i >= 0);i--) {if ( ((l >= sq2[i]) && (r >= sq2[i]))) {l -= sq2[i]; r -= sq2[i]; } else if ( ((l < sq2[i]) && (sq2[i] <= r))) {break;} }for ( int i = (sq2.length - 1);(i >= 0);i--) {if ( ((l < sq2[i]) && (sq2[i] <= r))) {return (sq2[(i + 1)] - 1);} }return -1;} public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long l = sc.nextLong();  long r = sc.nextLong(); System.out.println(run(l,r)); } }
1	public class C01Easy{ public static void main( String[] args){ try(BufferedReader r=new BufferedReader(new InputStreamReader(System.in))){final String[] line = r.readLine().split(" "); final int N = Integer.parseInt(line[0]),P = Integer.parseInt(line[1]); final String[] numS = r.readLine().split(" "); if ( (numS.length != N)) throw (new IllegalArgumentException()); final int[] n = new int[N];  int sum1 = 0,sum2 = 0; for ( int i = 0;(i < N);i++) {n[i] = (Integer.parseInt(numS[i]) % P); sum2 += n[i]; if ( (sum2 >= P)) sum2 -= P; } int max = sum2; for ( int i = 0;(i < N);i++) {sum1 += n[i]; if ( (sum1 >= P)) sum1 -= P; sum2 -= n[i]; if ( (sum2 < 0)) sum2 += P; final int s = (sum1 + sum2); if ( (s > max)) max = s; }System.out.println(max); }catch (IOException e){ e.printStackTrace(); } } }
6	public class CF85C{ public static void main( String[] args){ reader = new BufferedReader(new InputStreamReader(System.in)); int height = nextInt(),width = nextInt(); if ( (width > height)) { int t = width; width = height; height = t; } final int INF = ((height * width) + 10); final int ALL_BITS = ((1 << width) - 1);  int[][][] dp = new int[(height + 1)][(1 << width)][(1 << width)]; for ( int[][] ints :dp) {for ( int[] anInt :ints) {Arrays.fill(anInt,INF); }}dp[0][0][0] = 0; for ( int r = 0;(r < height);++r) {for ( int uncovered = 0;(uncovered < (1 << width));++uncovered) {for ( int mask = 0;(mask < (1 << width));++mask) {if ( (dp[r][uncovered][mask] == INF)) {continue;} for ( int curMask = uncovered;(curMask < (1 << width));curMask = ((curMask + 1) | uncovered)) { int curCovered = (mask | curMask); curCovered |= (curMask >> 1); curCovered |= (ALL_BITS & (curMask << 1)); int curUncovered = (ALL_BITS ^ curCovered); dp[(r + 1)][curUncovered][curMask] = Math.min(dp[(r + 1)][curUncovered][curMask],(dp[r][uncovered][mask] + Integer.bitCount(curMask))); }}}} int res = INF; for ( int x :dp[height][0]) res = Math.min(res,x); System.out.println(((height * width) - res)); } public static BufferedReader reader ; public static StringTokenizer tokenizer = null; static String nextToken(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new StringTokenizer(reader.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return tokenizer.nextToken();} public static int nextInt(){ return Integer.parseInt(nextToken());} }
6	public class Main{ static long mod = 1000000007; static int INF = 1000000000; public static void main( String[] args){ FastScanner scanner = new FastScanner();  int n = scanner.nextInt();  int m = scanner.nextInt();  String s = scanner.next();  int[][] cnt = new int[20][20]; for ( int i = 0;(i < (n - 1));i++) {cnt[(s.charAt(i) - 'a')][(s.charAt((i + 1)) - 'a')]++; cnt[(s.charAt((i + 1)) - 'a')][(s.charAt(i) - 'a')]++; } int[] dp = new int[(1 << m)]; for ( int i = 0;(i < (1 << m));i++) {dp[i] = INF; }dp[0] = 0; for ( int i = 0;(i < (1 << m));i++) { int cost = 0; for ( int j = 0;(j < m);j++) {if ( (((i >> j) & 1) == 0)) {for ( int k = 0;(k < m);k++) {if ( (((~i >> k) & 1) == 0)) {cost += cnt[j][k]; } }} }for ( int j = 0;(j < m);j++) {dp[(i | (1 << j))] = Math.min(dp[(i | (1 << j))],(dp[i] + cost)); }}System.out.println(dp[((1 << m) - 1)]); } static private 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;} static private boolean isPrintableChar( int c){ return ((33 <= c) && (c <= 126));} public boolean hasNext(){ while((hasNextByte() && !isPrintableChar(buffer[ptr])))ptr++; 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(){ if ( !hasNext()) throw (new NoSuchElementException()); long n = 0;  boolean minus = false;  int b = readByte(); if ( (b == '-')) {minus = true; b = readByte(); } if ( ((b < '0') || ('9' < b))) {throw (new NumberFormatException());} while(true){if ( (('0' <= b) && (b <= '9'))) {n *= 10; n += (b - '0'); } else if ( ((b == -1) || !isPrintableChar(b))) {return (minus?-n:n);} else {throw (new NumberFormatException());}b = readByte(); }} public int nextInt(){ long nl = nextLong(); if ( ((nl < Integer.MIN_VALUE) || (nl > Integer.MAX_VALUE))) throw (new NumberFormatException()); return (int)nl;} } }
3	public class q4{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int query = in.nextInt(); while((query-- > 0)){ int n = in.nextInt();  int k = in.nextInt();  char[] arr = new char[n];  String code = in.next(); for ( int i = 0;(i < n);i++) {arr[i] = code.charAt(i); } int r = 0;  int g = 0;  int b = 0; for ( int i = 0;(i < k);i++) {if ( ((i % 3) == 0)) {if ( (arr[i] == 'R')) {g++; b++; } else if ( (arr[i] == 'G')) {r++; b++; } else {r++; g++; }} else if ( ((i % 3) == 1)) {if ( (arr[i] == 'G')) {g++; b++; } else if ( (arr[i] == 'B')) {r++; b++; } else {r++; g++; }} else {if ( (arr[i] == 'B')) {g++; b++; } else if ( (arr[i] == 'R')) {r++; b++; } else {r++; g++; }}} int rMin = r;  int gMin = g;  int bMin = b; for ( int j = k;(j < n);j++) {if ( (((((j % 3) == 0) && (arr[j] != 'R')) || (((j % 3) == 1) && (arr[j] != 'G'))) || (((j % 3) == 2) && (arr[j] != 'B')))) {r++; } if ( ((((((j - k) % 3) == 0) && (arr[(j - k)] != 'R')) || ((((j - k) % 3) == 1) && (arr[(j - k)] != 'G'))) || ((((j - k) % 3) == 2) && (arr[(j - k)] != 'B')))) {r--; } rMin = Math.min(r,rMin); if ( (((((j % 3) == 0) && (arr[j] != 'G')) || (((j % 3) == 1) && (arr[j] != 'B'))) || (((j % 3) == 2) && (arr[j] != 'R')))) {g++; } if ( ((((((j - k) % 3) == 0) && (arr[(j - k)] != 'G')) || ((((j - k) % 3) == 1) && (arr[(j - k)] != 'B'))) || ((((j - k) % 3) == 2) && (arr[(j - k)] != 'R')))) {g--; } gMin = Math.min(gMin,g); if ( (((((j % 3) == 0) && (arr[j] != 'B')) || (((j % 3) == 1) && (arr[j] != 'R'))) || (((j % 3) == 2) && (arr[j] != 'G')))) {b++; } if ( ((((((j - k) % 3) == 0) && (arr[(j - k)] != 'B')) || ((((j - k) % 3) == 1) && (arr[(j - k)] != 'R'))) || ((((j - k) % 3) == 2) && (arr[(j - k)] != 'G')))) {b--; } bMin = Math.min(bMin,b); }System.out.println(Math.min(Math.min(rMin,gMin),bMin)); }} }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastReader in = new FastReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ FastReader in ; PrintWriter out ; int n ; public void solve( int testNumber, FastReader in, PrintWriter out){ this.in = in; this.out = out; n = in.nextInt(); if ( ((n % 4) != 0)) {out.println("! -1"); return ;} int low = 0;  int high = (n >> 1); if ( (BValue(low) == 0)) {out.println(("! " + (low + 1))); return ;} boolean value = (BValue(low) > 0); while(((high - low) > 1)){ int mid = ((high + low) >> 1);  int BVal = BValue(mid); if ( (BVal == 0)) {out.println(("! " + (mid + 1))); return ;} if ( value) {if ( (BVal < 0)) {high = mid; } else {low = mid; }} else {if ( (BVal > 0)) {high = mid; } else {low = mid; }}}out.println("! -1"); } public int BValue( int index){ out.println(("? " + (index + 1))); out.flush(); int f = in.nextInt(); out.println(("? " + ((index + 1) + (n >> 1)))); out.flush(); int s = in.nextInt(); return (f - s);} } static class FastReader{ private InputStream stream ; private byte[] buf = new byte[8192]; private int curChar ; private int pnumChars ; public FastReader( InputStream stream){ this.stream = stream; } private int pread(){ if ( (pnumChars == -1)) {throw (new InputMismatchException());} if ( (curChar >= pnumChars)) {curChar = 0; try{pnumChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (pnumChars <= 0)) {return -1;} } return buf[curChar++];} public int nextInt(){ int c = pread(); while(isSpaceChar(c))c = pread(); int sgn = 1; if ( (c == '-')) {sgn = -1; c = pread(); } int res = 0; do {if ( (c == ',')) {c = pread(); } if ( ((c < '0') || (c > '9'))) {throw (new InputMismatchException());} res *= 10; res += (c - '0'); c = pread(); }while(!isSpaceChar(c));return (res * sgn);} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
2	public class Main{ static class Reader{ private InputStream mIs ; private byte[] buf = new byte[1024]; private int curChar ,numChars ; public Reader(){ this(System.in); } public Reader( InputStream is){ mIs = is; } public int read(){ if ( (numChars == -1)) throw (new InputMismatchException()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = mIs.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} public String s(){ 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 int i(){ 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 boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} } public static void main( String[] args)throws IOException { PrintWriter out = new PrintWriter(System.out);  Reader sc = new Reader();  int n = sc.i(); System.out.println(("? " + 1)); int a = sc.i(); System.out.println(("? " + (1 + (n / 2)))); int b = sc.i(); if ( (a == b)) {System.out.println(("! " + 1)); System.exit(0); } int inv = 0; if ( (a > b)) inv = 1;  int low = 2;  int high = (n / 2);  int q = 0; while((low <= high)){if ( (q == 60)) break; int mid = ((low + high) / 2); System.out.println(("? " + mid)); a = sc.i(); System.out.println(("? " + (mid + (n / 2)))); b = sc.i(); if ( (a == b)) {System.out.println(("! " + mid)); System.exit(0); } else if ( (a < b)) {if ( (inv == 0)) low = (mid + 1); else high = (mid - 1); } else {if ( (inv == 0)) high = (mid - 1); else low = (mid + 1); }q++; }System.out.println("! -1"); out.flush(); } }
2	public class B implements Runnable{ static private final boolean ONLINE_JUDGE = true; private BufferedReader in ; private PrintWriter out ; private StringTokenizer tok = new StringTokenizer(""); private void init()throws FileNotFoundException { Locale.setDefault(Locale.US); String fileName = ""; if ( (ONLINE_JUDGE && fileName.isEmpty())) {in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); } else {if ( fileName.isEmpty()) {in = new BufferedReader(new FileReader("input.txt")); out = new PrintWriter("output.txt"); } else {in = new BufferedReader(new FileReader((fileName + ".in"))); out = new PrintWriter((fileName + ".out")); }}} String readString(){ while(!tok.hasMoreTokens()){try{tok = new StringTokenizer(in.readLine()); }catch (Exception e){ return null;} }return tok.nextToken();} int readInt(){ return Integer.parseInt(readString());} public static void main( String[] args){ new B().run(); } long timeBegin ,timeEnd ; void time(){ timeEnd = System.currentTimeMillis(); System.err.println(("Time = " + (timeEnd - timeBegin))); } @Override public void run(){ try{timeBegin = System.currentTimeMillis(); init(); int n = readInt();  int[] rect1 = solve1(n);  int[] rect2 = solve2(n,rect1); out.printf("! %s %s %s %s %s %s %s %s\n",rect1[0],rect1[1],rect1[2],rect1[3],rect2[0],rect2[1],rect2[2],rect2[3]); out.flush(); out.close(); time(); }catch (Exception e){ e.printStackTrace(); System.exit(-1); } } int ask( int x1, int y1, int x2, int y2){ out.println(((((((("? " + x1) + " ") + y1) + " ") + x2) + " ") + y2)); out.flush(); return readInt();} int ask( int x1, int y1, int x2, int y2, int[] rect){ out.println(((((((("? " + x1) + " ") + y1) + " ") + x2) + " ") + y2)); out.flush(); int res = readInt(); if ( ((((rect[0] >= x1) && (rect[2] <= x2)) && (rect[1] >= y1)) && (rect[3] <= y2))) {res--; } return res;} int[] dropTopAndLeft1( int x2, int y2){ int x1 = x2,y1 = y2;  int left = 1,right = x2; while((left <= right)){ int mid = ((left + right) >> 1);  int count = ask(mid,1,x2,y2); if ( (count >= 1)) {x1 = mid; left = (mid + 1); } if ( (count == 0)) {right = (mid - 1); } }left = 1; right = y2; while((left <= right)){ int mid = ((left + right) >> 1);  int count = ask(x1,mid,x2,y2); if ( (count >= 1)) {y1 = mid; left = (mid + 1); } if ( (count == 0)) {right = (mid - 1); } }return new int[]{x1,y1,x2,y2};} private int[] solve1( int n){ int x = -1;  int left = 1,right = n; while((left <= right)){ int mid = ((left + right) >> 1);  int count = ask(1,1,mid,n); if ( (count >= 1)) {x = mid; right = (mid - 1); } if ( (count == 0)) {left = (mid + 1); } }left = 1; right = n; int y = -1; while((left <= right)){ int mid = ((left + right) >> 1);  int count = ask(1,1,x,mid); if ( (count >= 1)) {y = mid; right = (mid - 1); } if ( (count == 0)) {left = (mid + 1); } }return dropTopAndLeft1(x,y);} private int[] solve2( int n, int[] rect){ int x = -1;  int left = 1,right = n; while((left <= right)){ int mid = ((left + right) >> 1);  int count = ask(mid,1,n,n,rect); if ( (count >= 1)) {x = mid; left = (mid + 1); } if ( (count == 0)) {right = (mid - 1); } }left = 1; right = n; int y = -1; while((left <= right)){ int mid = ((left + right) >> 1);  int count = ask(x,mid,n,n,rect); if ( (count >= 1)) {y = mid; left = (mid + 1); } if ( (count == 0)) {right = (mid - 1); } }return dropTopAndLeft2(x,y,n,rect);} int[] dropTopAndLeft2( int x1, int y1, int n, int[] rect){ int x2 = x1,y2 = y1;  int left = x1,right = n; while((left <= right)){ int mid = ((left + right) >> 1);  int count = ask(x1,y1,mid,n,rect); if ( (count >= 1)) {x2 = mid; right = (mid - 1); } if ( (count == 0)) {left = (mid + 1); } }left = y1; right = n; while((left <= right)){ int mid = ((left + right) >> 1);  int count = ask(x1,y1,x2,mid,rect); if ( (count == 1)) {y2 = mid; right = (mid - 1); } if ( (count == 0)) {left = (mid + 1); } }return new int[]{x1,y1,x2,y2};} }
5	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);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  long k = in.nextLong();  long[] a = new long[n]; for ( int i = 0;(i < n);++i) a[i] = in.nextLong(); Arrays.sort(a); boolean[] take = new boolean[n]; Arrays.fill(take,true); int j = 0;  int res = n; for ( int i = 0;(i < n);++i) {while(((j < i) && ((a[j] * k) < a[i])))++j; if ( (((j < i) && take[j]) && ((a[j] * k) == a[i]))) {take[i] = false; --res; } }out.println(res); } } class InputReader{ public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); 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());} public long nextLong(){ return Long.parseLong(next());} }
3	public class MainG{ static StdIn in = new StdIn(); static PrintWriter out = new PrintWriter(System.out); static long M = ((long)1e9 + 7); public static void main( String[] args){ char[] cs = in.next().toCharArray();  int n = cs.length;  int[] x = new int[n]; for ( int i = 0;(i < n);++i) x[i] = (cs[i] - '0'); long[] dp1 = new long[(n + 1)]; for ( int i = 0;(i < n);++i) dp1[(i + 1)] = ((x[i] + (dp1[i] * 10)) % M); long ans = 0; for ( int d1 = 1;(d1 <= 9);++d1) { long[][] dp2 = new long[2][(n + 1)]; for ( int i = 0;(i < n);++i) {dp2[0][(i + 1)] = ((x[i] >= d1)?(((10 * dp2[0][i]) + 1) % M):dp2[0][i]); for ( int d2 = 0;(d2 < x[i]);++d2) dp2[1][(i + 1)] = ((((d2 >= d1)?(((10 * (dp2[0][i] + dp2[1][i])) + dp1[i]) + 1):(dp2[0][i] + dp2[1][i])) + dp2[1][(i + 1)]) % M); for ( int d2 = x[i];(d2 <= 9);++d2) dp2[1][(i + 1)] = ((((d2 >= d1)?((10 * dp2[1][i]) + dp1[i]):dp2[1][i]) + dp2[1][(i + 1)]) % M); }ans += (dp2[0][n] + dp2[1][n]); }out.println((ans % M)); out.close(); } interface Input{ public String next(); ; public int nextInt(); public long nextLong(); ; } static class StdIn implements Input{ private final int BUFFER_SIZE = (1 << 16); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ,bytesRead ; public StdIn(){ din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public StdIn( InputStream in){ try{din = new DataInputStream(in); }catch (Exception e){ throw (new RuntimeException());} buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String next(){ int c ; while((((c = read()) != -1) && (((c == ' ') || (c == '\n')) || (c == '\r')))); StringBuilder s = new StringBuilder(); while((c != -1)){if ( (((c == ' ') || (c == '\n')) || (c == '\r'))) break; s.append((char)c); c = read(); }return s.toString();} public int nextInt(){ 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(){ 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;} private void fillBuffer()throws IOException { bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) buffer[0] = -1; } private byte read(){ try{if ( (bufferPointer == bytesRead)) fillBuffer(); return buffer[bufferPointer++]; }catch (IOException e){ throw (new RuntimeException());} } public void close()throws IOException { if ( (din == null)) return ; din.close(); } } }
6	public class CF16E{ private void solve( InputReader in, PrintWriter out){ int n = in.nextInt();  double[][] prob = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {prob[i][j] = in.nextDouble(); }} int[] fish = new int[n]; for ( int i = 0;(i < n);i++) {fish[i] = (1 << i); } double[] res = new double[(1 << n)]; res[0] = 1.0; for ( int mask = 1;(mask < ((1 << n) - 1));mask++) {for ( int i = 0;(i < n);i++) {if ( ((mask & fish[i]) == 0)) {continue;} int lastMask = (mask ^ fish[i]);  int live = n; for ( int j = 0;(j < n);j++) {if ( ((lastMask & fish[j]) != 0)) {live--; } } double p = 0.0; for ( int j = 0;(j < n);j++) {if ( (((lastMask & fish[j]) != 0) || (j == i))) {continue;} p += prob[j][i]; }res[mask] += ((((res[lastMask] * p) * 2) / live) / (live - 1)); }}for ( int i = 0;(i < n);i++) {out.printf("%.6f ",res[(((1 << n) - 1) ^ fish[i])]); }} public static void main( String[] args){ InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out); new CF16E().solve(in,out); out.close(); } 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());} public double nextDouble(){ return Double.parseDouble(next());} } }
2	public class History{ static final int INF = (int)1E9; static final double EPS = 1E-9; static final long MOD = (INF + 9); static long powmod( long p){ long res = 1;  long d = 2; while((p > 0)){if ( ((p % 2) == 1)) {res = ((res * d) % MOD); p--; } else {d = ((d * d) % MOD); p /= 2; }}return (res % MOD);} public static void main( String[] args){ InputReader in = new InputReader(System.in);  long n = in.nextLong();  long m = in.nextLong();  long k = in.nextLong();  long ans = 0;  long t = ((k - 1) * (n - m)); if ( (t <= m)) {n -= (k * (n - m)); long g = (n / k); ans = (((2 * k) * (powmod(g) - 1)) + (n % k)); ans = ((ans + t) % MOD); } else {ans = m; }System.out.println((ans % MOD)); } } class InputReader{ public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); 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 long nextLong(){ return Long.parseLong(next());} }
6	public class Main{ public class BasicInputOutput{ private StringTokenizer strtoken ; private BufferedReader bufferReader ; private BufferedWriter bufferWriter ; private String delim = " \t\n\r\f"; BasicInputOutput(){ delim = " \t\n\r\f"; initialize(); } BasicInputOutput( String s){ delim = s; initialize(); } private void initialize(){ bufferReader = new BufferedReader(new InputStreamReader(System.in)); bufferWriter = new BufferedWriter(new PrintWriter(System.out)); strtoken = null; } private void checkStringTokenizer()throws IOException { if ( ((strtoken == null) || (strtoken.hasMoreTokens() == false))) strtoken = new StringTokenizer(bufferReader.readLine(),delim); } public int getNextInt()throws IOException { checkStringTokenizer(); return Integer.parseInt(strtoken.nextToken());} public double getNextDouble()throws IOException { checkStringTokenizer(); return Double.parseDouble(strtoken.nextToken());} public void write( String var)throws IOException { bufferWriter.write(var); } public <T> void write( char sep, T... var)throws IOException { if ( (var.length == 0)) return ; bufferWriter.write(var[0].toString()); for ( int i = 1;(i < var.length);i++) bufferWriter.write((sep + var[i].toString())); } public void flush()throws IOException { bufferWriter.flush(); } } public static void main( String[] args){ try{new Main().run(); }catch (Exception ex){ ex.printStackTrace(); } } private BasicInputOutput iohandler ; private int n ; private double[][] mat ; private double[][] sum ; private double[] dp ; private int tolive ; private void run()throws Exception { initialize(); solve(); } private void initialize()throws Exception { iohandler = new BasicInputOutput(); n = iohandler.getNextInt(); mat = new double[n][n]; sum = new double[((1 << n) + 10)][n]; dp = new double[(1 << n)]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) {mat[i][j] = iohandler.getNextDouble(); }} private int bitCount( int mask){ int ret = 0; while((mask > 0)){ret++; mask &= (mask - 1); }return ret;} private void solve()throws Exception { double[] ans = new double[n];  int ub = (1 << n); for ( int i = 1;(i < ub);i++) {for ( int j = 0;(j < n);j++) {sum[i][j] = 0; for ( int k = 0;(k < n);k++) if ( ((i & (1 << k)) != 0)) sum[i][j] += mat[k][j];  int cntbit = bitCount(i); if ( (cntbit > 1)) sum[i][j] /= (((double)cntbit * (cntbit - 1.)) / 2.); }}dp[(ub - 1)] = 1.; for ( int mask = (ub - 1);(mask >= 1);mask--) {if ( (dp[mask] == 0.)) continue; for ( int i = 0;(i < n);i++) {if ( ((mask & (1 << i)) == 0)) continue; dp[(mask - (1 << i))] += (sum[mask][i] * dp[mask]); }}for ( int i = 0;(i < n);i++) ans[i] = dp[(1 << i)]; iohandler.write((ans[0] + "")); for ( int i = 1;(i < n);i++) iohandler.write((" " + ans[i])); iohandler.write("\n"); iohandler.flush(); } }
6	public class E{ static int g[][] ; static int n ,m ; static char[] s ; static int dp[] ,inf = (int)2e9; public static void main( String[] args)throws Exception { Scanner in = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out); n = in.nextInt(); m = in.nextInt(); s = in.next().toCharArray(); g = new int[m][m]; for ( int i = 1;(i < n);i++) { int x = (s[(i - 1)] - 'a'),y = (s[i] - 'a'); if ( (x != y)) {g[x][y]++; g[y][x]++; } }dp = new int[(1 << m)]; Arrays.fill(dp,-1); pw.println(solve(0,0)); pw.close(); } static int solve( int pos, int mask){ if ( (pos >= m)) return 0; if ( (dp[mask] != -1)) return dp[mask]; int min = inf; for ( int i = 0;(i < m);i++) {if ( !check(mask,i)) { int res = 0; for ( int j = 0;(j < m);j++) {if ( check(mask,j)) res += (g[i][j] * pos); else res -= (g[i][j] * pos); }res += solve((pos + 1),set(mask,i)); min = min(min,res); } }return dp[mask] = min;} static boolean check( int N, int pos){ return ((N & (1 << pos)) != 0);} static int set( int N, int pos){ return N = (N | (1 << pos));} }
5	public class A{ static StringTokenizer st ; static BufferedReader in ; public static void main( String[] args)throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  int n = nextInt();  int k = nextInt();  Integer[] a = new Integer[(n + 1)]; for ( int i = 1;(i <= n);i++) {a[i] = nextInt(); }if ( (k == 1)) {System.out.println(n); return ;} Arrays.sort(a,1,(n + 1)); Set<Integer> set = new HashSet<Integer>();  int ans = 0;  int INF = (int)1e9; for ( int i = 1;(i <= n);i++) {if ( set.contains(a[i])) continue; int t = a[i];  int s = 1; while((((long)t * k) <= INF)){t *= k; if ( (Arrays.binarySearch(a,1,(n + 1),t) >= 0)) {set.add(t); s++; } else break;}if ( ((s % 2) == 0)) ans += (s / 2); else ans += ((s / 2) + 1); }System.out.println(ans); pw.close(); } static private int nextInt()throws IOException { return Integer.parseInt(next());} static private String next()throws IOException { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(in.readLine()); }return st.nextToken();} }
6	public class e2{ static int n ; static int m ; static int[][] mat ; public static void main( String[] args){ JS scan = new JS();  PrintWriter out = new PrintWriter(System.out);  int t = scan.nextInt();  long start = System.currentTimeMillis(); for ( int q = 1;(q <= t);q++) {n = scan.nextInt(); m = scan.nextInt(); mat = new int[n][m]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {mat[i][j] = scan.nextInt(); }} int[] max = new int[m];  PriorityQueue<Item> pq = new PriorityQueue<Item>(); for ( int i = 0;(i < m);i++) {for ( int j = 0;(j < n);j++) {max[i] = max(max[i],mat[j][i]); }pq.add(new Item(i,max[i])); } ArrayList<Item> guys = new ArrayList<Item>(); while((!pq.isEmpty() && (guys.size() < n))){ Item tt = pq.poll(); guys.add(tt); } int[][] cost = new int[guys.size()][(1 << n)]; for ( int i = 0;(i < guys.size());i++) { int g = guys.get(i).a; for ( int s = 0;(s < n);s++) {for ( int j = 0;(j < (1 << n));j++) { int sum = 0; for ( int k = 0;(k < n);k++) {if ( ((j & (1 << k)) > 0)) {sum += mat[((k + s) % n)][g]; } }cost[i][j] = max(cost[i][j],sum); }}} int full = ((1 << n) - 1);  int[][] dp = new int[(guys.size() + 1)][(1 << n)];  int ans = 0; for ( int c = 0;(c < guys.size());c++) {for ( int j = 0;(j < (1 << n));j++) {for ( int i = j;(i < (1 << n));i = ((i + 1) | j)) {dp[(c + 1)][i] = max(dp[(c + 1)][i],(cost[c][j] + dp[c][(i ^ j)])); ans = max(ans,dp[(c + 1)][i]); }}}out.println(ans); }out.flush(); } static int max( int a, int b){ return ((a > b)?a:b);} static class Item implements Comparable<Item>{ int a ; int b ; public Item( int a, int b){ this.a = a; this.b = b; } } static class JS{ public int BS = (1 << 16); public char NC = (char)0; byte[] buf = new byte[BS]; int bId = 0,size = 0; char c = NC; double num = 1; BufferedInputStream in ; public JS(){ in = new BufferedInputStream(System.in,BS); } public JS( String s)throws FileNotFoundException{ in = new BufferedInputStream(new FileInputStream(new File(s)),BS); } public char nextChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ num = 1; boolean neg = false; if ( (c == NC)) c = nextChar(); for ( ;((c < '0') || (c > '9'));c = nextChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = nextChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); num *= 10; }return (neg?-res:res);} } }
4	public class E{ static long mod ; static long[][] dp ; static int n ; static long[] nWaysToPlaceGroupOfSize ; public static void main( String[] args){ FastScanner fs = new FastScanner(); n = fs.nextInt(); mod = fs.nextInt(); precomp(); dp = new long[(n + 1)][(n + 1)]; for ( int i = 0;(i < dp.length);i++) Arrays.fill(dp[i],-1); long ans = 0; for ( int nXsLeft = 2;(nXsLeft <= n);nXsLeft++) { long curAns = go(0,nXsLeft); ans = add(ans,curAns); }System.out.println(ans); } static long go( int position, int nXsLeft){ if ( (position == n)) {return 0;} if ( (position == (n + 1))) {if ( (nXsLeft == 0)) return 1; return 0;} if ( (dp[position][nXsLeft] != -1)) {return dp[position][nXsLeft];} long ways = 0; for ( int nPlace = 1;(nPlace <= Math.min(nXsLeft,(n - position)));nPlace++) { long futureWays = go(((position + nPlace) + 1),(nXsLeft - nPlace));  long waysToPlaceMe = nCk(nXsLeft,nPlace); if ( (nPlace > 1)) waysToPlaceMe = mul(waysToPlaceMe,nWaysToPlaceGroupOfSize[nPlace]); ways = add(ways,mul(waysToPlaceMe,futureWays)); }return dp[position][nXsLeft] = ways;} static long nCk( int n, int k){ if ( (k > n)) throw (null); return mul(facts[n],mul(factInvs[k],factInvs[(n - k)]));} static long add( long a, long b){ return ((a + b) % mod);} static long mul( long a, long b){ return ((a * b) % mod);} static long fastPow( long base, long e){ if ( (e == 0)) return 1; long half = fastPow(base,(e / 2)); if ( ((e % 2) == 0)) return mul(half,half); return mul(half,mul(half,base));} static long[] facts = new long[1_000_00]; static long[] factInvs = new long[1_000_00]; static void precomp(){ facts[0] = 1; for ( int i = 1;(i < facts.length);i++) facts[i] = mul(facts[(i - 1)],i); for ( int i = 0;(i < factInvs.length);i++) factInvs[i] = fastPow(facts[i],(mod - 2)); nWaysToPlaceGroupOfSize = new long[500]; for ( int finalSize = 1;(finalSize < nWaysToPlaceGroupOfSize.length);finalSize++) {for ( int firstPos = 0;(firstPos < finalSize);firstPos++) { int l = firstPos,r = ((finalSize - 1) - firstPos); nWaysToPlaceGroupOfSize[finalSize] = add(nWaysToPlaceGroupOfSize[finalSize],nCk((l + r),l)); }}System.err.println("Done with precomp."); } static void sort( int[] a){ ArrayList<Integer> l = new ArrayList<>(); for ( int i :a) l.add(i); Collections.sort(l); for ( int i = 0;(i < a.length);i++) a[i] = l.get(i); } static class FastScanner{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); String next(){ while(!st.hasMoreTokens())try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
4	public class Solve{ public static void main( String[] args)throws Exception { Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int size = ((int)1e7 + 1);  int[] pr = new int[size]; for ( int i = 0;(i < size);i++) {pr[i] = i; }for ( int i = 2;((i * i) < size);i++) {if ( (pr[i] == i)) { int val = (i * i); for ( int j = val;(j <= size);j += val) {pr[j] = (j / val); }} } int t = sc.nextInt();  int[] dp = new int[size]; Arrays.fill(dp,-1); while((t-- > 0)){ int n = sc.nextInt();  int k = sc.nextInt();  int[] ar = new int[n]; for ( int i = 0;(i < n);i++) { int a = sc.nextInt(); ar[i] = pr[a]; } int[] ans = new int[(k + 1)];  int[] ind = new int[(k + 1)]; for ( int i = 0;(i < n);i++) {for ( int h = k;(h >= 0);h--) {if ( (dp[ar[i]] >= ind[h])) {ans[h]++; ind[h] = i; } if ( ((h > 0) && ((ans[(h - 1)] < ans[h]) || ((ans[(h - 1)] == ans[h]) && (ind[(h - 1)] > ind[h]))))) {ans[h] = ans[(h - 1)]; ind[h] = ind[(h - 1)]; } }dp[ar[i]] = i; }out.println((ans[k] + 1)); for ( int i = 0;(i < n);i++) dp[ar[i]] = -1; }out.close(); } }
2	public class C{ String line ; StringTokenizer inputParser ; BufferedReader is ; FileInputStream fstream ; DataInputStream in ; String FInput = ""; void openInput( String file){ if ( (file == null)) is = new BufferedReader(new InputStreamReader(System.in)); else {try{fstream = new FileInputStream(file); in = new DataInputStream(fstream); is = new BufferedReader(new InputStreamReader(in)); }catch (Exception e){ System.err.println(e); } }} void readNextLine(){ try{line = is.readLine(); inputParser = new StringTokenizer(line," "); }catch (IOException e){ System.err.println(("Unexpected IO ERROR: " + e)); } } int NextInt(){ String n = inputParser.nextToken();  int val = Integer.parseInt(n); return val;} void closeInput(){ try{is.close(); }catch (IOException e){ System.err.println(("Unexpected IO ERROR: " + e)); } } public static void main( String[] argv){ String filePath = null; if ( (argv.length > 0)) filePath = argv[0]; new C(filePath); } final int MOD = 1000000009; public C( String inputFile){ openInput(inputFile); StringBuilder sb = new StringBuilder(); readNextLine(); int N = NextInt(),M = NextInt(),K = NextInt(); if ( ((N / K) <= (N - M))) {sb.append(M); } else { int x = ((N / K) - (N - M));  long ret = (pow(2,x) - 1); ret *= K; ret %= MOD; ret *= 2; ret %= MOD; ret += (M - (x * K)); ret %= MOD; sb.append((ret + "\n")); }System.out.println(sb); closeInput(); } long pow( long b, long exponent){ long ret = 1; while((exponent > 0)){if ( ((exponent % 2) == 1)) ret = ((ret * b) % MOD); exponent = (exponent >> 1); b = ((b * b) % MOD); }return ret;} }
6	public class Main{ void solve(){ int m = ni();  long a[][] = new long[m][];  HashMap<Long,Integer> mp = new HashMap<>();  long TS = 0;  long sm[] = new long[m]; for ( int i = 0;(i < m);i++) { int sz = ni(); a[i] = new long[sz]; for ( int j = 0;(j < sz);j++) {a[i][j] = nl(); mp.put(a[i][j],i); sm[i] += a[i][j]; }TS += sm[i]; }if ( ((TS % m) != 0)) {pw.println("No"); return ;} TS /= m; ArrayList<Node> ansForMask[] = new ArrayList[(1 << m)]; for ( int i = 0;(i < (1 << m));i++) ansForMask[i] = new ArrayList<>(); ArrayList<Node> tempList = new ArrayList<>();  int vis[] = new int[m]; for ( int i = 0;(i < m);i++) {for ( int j = 0;(j < a[i].length);j++) { int mask = 0; tempList.clear(); long val = a[i][j],req = Long.MAX_VALUE;  int idx = i,idx2 ; Arrays.fill(vis,0); if ( (sm[i] == TS)) {mask = (1 << i); if ( (ansForMask[mask].size() == 0)) ansForMask[mask].add(new Node(val,i,i)); continue;} while((vis[idx] == 0)){req = (TS - (sm[idx] - val)); if ( !mp.containsKey(req)) continue out; idx2 = mp.get(req); if ( ((vis[idx] == 1) || (idx == idx2))) continue out; if ( (vis[idx2] == 1)) break; vis[idx] = 1; mask += (1 << idx); tempList.add(new Node(req,idx2,idx)); idx = idx2; val = req; }if ( (req != a[i][j])) continue out; mask += (1 << idx); tempList.add(new Node(a[i][j],i,idx)); if ( (ansForMask[mask].size() == 0)) {ansForMask[mask].addAll(tempList); } }} int dp[] = new int[(1 << m)]; dp[0] = 1; for ( int mask = 1;(mask < (1 << m));mask++) {if ( (ansForMask[mask].size() != 0)) {dp[mask] = 1; continue;} for ( int s = mask;(s > 0);s = ((s - 1) & mask)) {if ( ((dp[s] == 1) && (dp[(mask ^ s)] == 1))) {dp[mask] = 1; ansForMask[mask].addAll(ansForMask[s]); ansForMask[mask].addAll(ansForMask[(mask ^ s)]); continue out;} }}if ( (dp[((1 << m) - 1)] == 0)) {pw.println("No"); return ;} pw.println("Yes"); Pair ans[] = new Pair[m]; for ( Node p :ansForMask[((1 << m) - 1)]) {ans[p.id1] = new Pair(p.c,p.id2); }for ( int i = 0;(i < m);i++) pw.println(((ans[i].c + " ") + (ans[i].p + 1))); } class Pair{ long c ; int p ; public Pair( long c, int p){ this.c = c; this.p = p; } } class Node{ long c ; int id1 ; int id2 ; public Node( long c, int id1, int id2){ this.c = c; this.id1 = id1; this.id2 = id2; } } long M = ((long)1e9 + 7); PrintWriter pw ; StringTokenizer st ; BufferedReader br ; void run()throws Exception { br = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(System.out); long s = System.currentTimeMillis(); solve(); pw.flush(); } public static void main( String[] args)throws Exception { new Main().run(); } String ns(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int ni(){ return Integer.parseInt(ns());} long nl(){ return Long.parseLong(ns());} }
0	public class LCM{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  long n = scan.nextLong(); if ( (n <= 2)) System.out.println(n); else if ( ((n % 2) == 1)) System.out.println(((n * (n - 1)) * (n - 2))); else if ( ((n % 3) == 0)) System.out.println((((n - 1) * (n - 2)) * (n - 3))); else System.out.println(((n * (n - 1)) * (n - 3))); } }
6	public class EdA{ static long[] mods = {1000000007,998244353,1000000009}; static long mod = mods[0]; public static MyScanner sc ; public static PrintWriter out ; public static void main( String[] omkar)throws Exception { sc = new MyScanner(); out = new PrintWriter(System.out); int n = sc.nextInt();  int m = sc.nextInt();  int[][] cnt = new int[m][m];  String s = sc.next(); for ( int j = 0;(j < (n - 1));j++) {if ( (s.charAt(j) != s.charAt((j + 1)))) {cnt[(s.charAt(j) - 'a')][(s.charAt((j + 1)) - 'a')]++; cnt[(s.charAt((j + 1)) - 'a')][(s.charAt(j) - 'a')]++; } } int[] st = new int[(m + 1)]; for ( int j = 0;(j <= m);j++) {st[j] = (1 << j); } int[][] arr = new int[m][(1 << m)]; for ( int j = 0;(j < m);j++) {for ( int k = 1;(k < (1 << m));k++) { int z = Integer.lowestOneBit(k);  int count = 0; while(((z != 0) && ((z % 2) == 0))){z /= 2; count++; }arr[j][k] = (arr[j][(k ^ Integer.lowestOneBit(k))] + cnt[j][count]); }} int[] dp = new int[(1 << m)]; Arrays.fill(dp,Integer.MAX_VALUE); dp[0] = 0; for ( int j = 1;(j < st[m]);j++) {for ( int k = 0;(k < m);k++) { int y = st[k]; if ( ((y & j) != 0)) { int sum = ((2 * arr[k][j]) - arr[k][((1 << m) - 1)]); dp[j] = Math.min(dp[j],(dp[(y ^ j)] + (sum * Integer.bitCount(j)))); } }}out.println(dp[((1 << m) - 1)]); out.close(); } public static void sort( int[] array){ ArrayList<Integer> copy = new ArrayList<Integer>(); for ( int i :array) copy.add(i); Collections.sort(copy); for ( int i = 0;(i < array.length);i++) array[i] = copy.get(i); } static long power( long x, long y){ if ( (y == 0)) return 1; if ( ((y % 2) == 1)) return ((x * power(x,(y - 1))) % mod); return (power(((x * x) % mod),(y / 2)) % mod);} public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} double nextDouble(){ return Double.parseDouble(next());} } }
6	public class Main{ static Scanner scn = new Scanner(System.in); static FastScanner sc = new FastScanner(); static Mathplus mp = new Mathplus(); static PrintWriter ot = new PrintWriter(System.out); static Random rand = new Random(); static int mod = 1000000007; static long inf = (long)1e17; static int[] dx = {0,1,0,-1}; static int[] dy = {1,0,-1,0}; static int max ; public static void main( String[] args){ int N = sc.nextInt();  ArrayList<Integer>[] l = new ArrayList[N];  HashMap<Long,Integer> map = new HashMap<Long,Integer>();  long sum = 0;  long[] s = new long[N]; for ( int i = 0;(i < N);i++) {l[i] = new ArrayList<Integer>(); int n = sc.nextInt(); for ( int j = 0;(j < n);j++) { int a = sc.nextInt(); map.put((long)a,i); s[i] += a; sum += a; l[i].add(a); }}if ( ((Math.abs(sum) % N) != 0)) {System.out.println("NO"); return ;} long make = (sum / N);  boolean[] dp = new boolean[(1 << N)];  int[] first = new int[(1 << N)];  int[] bef = new int[(1 << N)]; Arrays.fill(first,mod); for ( int i = 0;(i < N);i++) {for ( int a :l[i]) { int used = 0;  boolean f = true;  long now = a;  int see = i; while(true){ long next = (make - (s[see] - now)); if ( (next == a)) {break;} if ( !map.containsKey(next)) {f = false; break;} else { int k = map.get(next); if ( (mp.contains(used,k) && (k != i))) {f = false; break;} else {used = mp.bitadd(used,k); now = next; see = k; }}}if ( f) {dp[mp.bitadd(used,i)] = true; first[mp.bitadd(used,i)] = a; } }}dp[0] = true; for ( int i = 1;(i < (1 << N));i++) {for ( int j = i;(j > 0);j = ((j - 1) & i)) {if ( (dp[(i ^ j)] && dp[j])) {dp[i] = true; bef[i] = j; } }}if ( !dp[((1 << N) - 1)]) {System.out.println("NO"); } else {System.out.println("YES"); ArrayDeque<Integer> q = new ArrayDeque<Integer>();  int[] ans1 = new int[N];  int[] ans2 = new int[N]; q.add(((1 << N) - 1)); while(!q.isEmpty()){ int Q = q.poll(); if ( (first[Q] == mod)) {q.add(bef[Q]); q.add((Q ^ bef[Q])); } else { int a = first[Q];  long now = a;  int befo = map.get((long)a); while(true){ long next = (make - (s[befo] - now)); if ( (next == a)) { int k = map.get(next); ans1[k] = (int)next; ans2[k] = befo; break;} int k = map.get(next); ans1[k] = (int)next; ans2[k] = befo; now = next; befo = k; }}}for ( int i = 0;(i < N);i++) {System.out.println(((ans1[i] + " ") + (ans2[i] + 1))); }}} } class TrieNode{ int[] Exist = new int[26]; int weight = 0; TrieNode(){ for ( int i = 0;(i < 26);i++) {Exist[i] = -1; }} } class Range{ int l ; int r ; int length ; Range( int L, int R){ l = L; r = R; length = ((R - L) + 1); } boolean isIn( int x){ return ((l <= x) && (x <= r));} } class UnionFindTree{ int[] root ; int[] rank ; int[] size ; int[] edge ; int num ; UnionFindTree( int N){ root = new int[N]; rank = new int[N]; size = new int[N]; edge = new int[N]; num = N; for ( int i = 0;(i < N);i++) {root[i] = i; size[i] = 1; }} public int find( int x){ if ( (root[x] == x)) {return x;} else {return find(root[x]);}} public void unite( int x, int y){ x = find(x); y = find(y); if ( (x == y)) {edge[x]++; return ;} else {num--; if ( (rank[x] < rank[y])) {root[x] = y; size[y] += size[x]; edge[y] += (edge[x] + 1); } else {root[y] = x; size[x] += size[y]; edge[x] += (edge[y] + 1); if ( (rank[x] == rank[y])) {rank[x]++; } }}} public boolean same( int x, int y){ return (find(x) == find(y));} } class Graph{ ArrayList<Edge>[] list ; int size ; TreeSet<LinkEdge> Edges = new TreeSet<LinkEdge>(new LinkEdgeComparator()); Graph( int N){ size = N; list = new ArrayList[N]; for ( int i = 0;(i < N);i++) {list[i] = new ArrayList<Edge>(); }} void addEdge( int a, int b){ list[a].add(new Edge(b,1)); } void addWeightedEdge( int a, int b, long c){ list[a].add(new Edge(b,c)); } long[][] bfs( int s){ long[][] L = new long[2][size]; for ( int i = 0;(i < size);i++) {L[0][i] = -1; L[1][i] = -1; }L[0][s] = 0; ArrayDeque<Integer> Q = new ArrayDeque<Integer>(); Q.add(s); while(!Q.isEmpty()){ int v = Q.poll(); for ( Edge e :list[v]) { int w = e.to;  long c = e.cost; if ( (L[0][w] == -1)) {L[0][w] = (L[0][v] + c); L[1][w] = v; Q.add(w); } }}return L;} RootedTree dfsTree( int i){ int[] u = new int[size];  RootedTree r = new RootedTree(size); dfsTree(i,u,r); return r;} private void dfsTree( int i, int[] u, RootedTree r){ u[i] = 1; for ( Edge e :list[i]) {if ( (u[e.to] == 0)) {r.list[i].add(e); u[e.to] = 1; dfsTree(e.to,u,r); } }} } class RootedTree extends Graph{ RootedTree( int N){ super(N); } } class LinkEdge{ long L ; int a ; int b ; LinkEdge( long l, int A, int B){ L = l; a = A; b = B; } public boolean equals( Object o){ LinkEdge O = (LinkEdge)o; return (((O.a == this.a) && (O.b == this.b)) && (O.L == this.L));} } class Edge{ int to ; long cost ; Edge( int a, long b){ to = a; cost = b; } } class LinkEdgeComparator implements Comparator<LinkEdge>{ } class Pair{ long a ; long b ; Pair( long p, long q){ this.a = p; this.b = q; } public boolean equals( Object o){ Pair O = (Pair)o; return ((O.a == this.a) && (O.b == this.b));} } class SampleComparator implements Comparator<Pair>{ } class LongIntPair{ long a ; int b ; LongIntPair( long p, int q){ this.a = p; this.b = q; } public boolean equals( Object o){ Pair O = (Pair)o; return ((O.a == this.a) && (O.b == this.b));} } class LongIntSampleComparator implements Comparator<LongIntPair>{ } class IntIntPair{ int a ; int b ; IntIntPair( int p, int q){ this.a = p; this.b = q; } public boolean equals( Object o){ Pair O = (Pair)o; return ((O.a == this.a) && (O.b == this.b));} } class DoubleTriplet{ double a ; double b ; double c ; DoubleTriplet( double p, double q, double r){ this.a = p; this.b = q; this.c = r; } public boolean equals( Object o){ DoubleTriplet O = (DoubleTriplet)o; return (((O.a == this.a) && (O.b == this.b)) && (O.c == this.c));} } class FastScanner{ private final java.io.InputStream in = System.in; private final byte[] b = new byte[1024]; private int p = 0; private int bl = 0; private boolean hNB(){ if ( (p < bl)) {return true;} else {p = 0; try{bl = in.read(b); }catch (IOException e){ e.printStackTrace(); } if ( (bl <= 0)) {return false;} }return true;} private int rB(){ if ( hNB()) return b[p++]; else return -1;} static private boolean iPC( int c){ return ((33 <= c) && (c <= 126));} private void sU(){ while((hNB() && !iPC(b[p])))p++; } public boolean hN(){ sU(); return hNB();} public String next(){ if ( !hN()) throw (new NoSuchElementException()); StringBuilder sb = new StringBuilder();  int b = rB(); while(iPC(b)){sb.appendCodePoint(b); b = rB(); }return sb.toString();} public long nextLong(){ if ( !hN()) throw (new NoSuchElementException()); long n = 0;  boolean m = false;  int b = rB(); if ( (b == '-')) {m = true; b = rB(); } if ( ((b < '0') || ('9' < b))) {throw (new NumberFormatException());} while(true){if ( (('0' <= b) && (b <= '9'))) {n *= 10; n += (b - '0'); } else if ( ((b == -1) || !iPC(b))) {return (m?-n:n);} else {throw (new NumberFormatException());}b = rB(); }} public int nextInt(){ if ( !hN()) throw (new NoSuchElementException()); long n = 0;  boolean m = false;  int b = rB(); if ( (b == '-')) {m = true; b = rB(); } if ( ((b < '0') || ('9' < b))) {throw (new NumberFormatException());} while(true){if ( (('0' <= b) && (b <= '9'))) {n *= 10; n += (b - '0'); } else if ( ((b == -1) || !iPC(b))) {return (int)(m?-n:n);} else {throw (new NumberFormatException());}b = rB(); }} } class Mathplus{ int mod = 1000000007; long[] fac ; long[] revfac ; long[][] comb ; long[] pow ; long[] revpow ; boolean isBuild = false; boolean isBuildc = false; boolean isBuildp = false; int mindex = -1; int maxdex = -1; void buildFac(){ fac = new long[10000003]; revfac = new long[10000003]; fac[0] = 1; for ( int i = 1;(i <= 10000002);i++) {fac[i] = ((fac[(i - 1)] * i) % mod); }revfac[10000002] = (rev(fac[10000002]) % mod); for ( int i = 10000001;(i >= 0);i--) {revfac[i] = ((revfac[(i + 1)] * (i + 1)) % mod); }isBuild = true; } public boolean contains( int S, int i){ return (((S >> i) & 1) == 1);} public int bitremove( int S, int i){ return (S & (1 << i));} public int bitadd( int S, int i){ return (S | (1 << i));} long max( long[] a){ long M = 0; for ( int i = 0;(i < a.length);i++) {if ( (M < a[i])) {M = a[i]; maxdex = i; } }return M;} int max( int[] a){ int M = 0; for ( int i = 0;(i < a.length);i++) {if ( (M < a[i])) {M = a[i]; maxdex = i; } }return M;} long min( long[] a){ long m = Long.MAX_VALUE; for ( int i = 0;(i < a.length);i++) {if ( (m > a[i])) {m = a[i]; mindex = i; } }return m;} int min( int[] a){ int m = Integer.MAX_VALUE; for ( int i = 0;(i < a.length);i++) {if ( (m > a[i])) {m = a[i]; mindex = i; } }return m;} long gcd( long a, long b){ a = Math.abs(a); b = Math.abs(b); if ( (a == 0)) return b; if ( (b == 0)) return a; if ( ((a % b) == 0)) return b; else return gcd(b,(a % b));} int igcd( int a, int b){ if ( ((a % b) == 0)) return b; else return igcd(b,(a % b));} public long comb( int a, int num){ if ( ((a - num) < 0)) return 0; if ( (num < 0)) return 0; if ( !isBuild) buildFac(); return ((fac[a] * ((revfac[num] * revfac[(a - num)]) % mod)) % mod);} long rev( long l){ return pow(l,(mod - 2));} void buildpow( int l, int i){ pow = new long[(i + 1)]; pow[0] = 1; for ( int j = 1;(j <= i);j++) {pow[j] = (pow[(j - 1)] * l); if ( (pow[j] > mod)) pow[j] %= mod; }} void buildrevpow( int l, int i){ revpow = new long[(i + 1)]; revpow[0] = 1; for ( int j = 1;(j <= i);j++) {revpow[j] = (revpow[(j - 1)] * l); if ( (revpow[j] > mod)) revpow[j] %= mod; }} long pow( long l, long i){ if ( (i == 0)) return 1; else {if ( ((i % 2) == 0)) { long val = pow(l,(i / 2)); return ((val * val) % mod);} else return ((pow(l,(i - 1)) * l) % mod);}} }
6	public class CF1209E2{ public static void main( String[] args)throws Exception { boolean local = (System.getSecurityManager() == null);  boolean async = false;  Charset charset = Charset.forName("ascii");  FastIO io = (local?new FastIO(new FileInputStream("D:\\DATABASE\\TESTCASE\\Code.in"),System.out,charset):new FastIO(System.in,System.out,charset));  Task task = new Task(io,new Debug(local)); if ( async) { Thread t = new Thread(null,task,"dalt",(1 << 27)); t.setPriority(Thread.MAX_PRIORITY); t.start(); t.join(); } else {task.run(); }if ( local) {io.cache.append((("\n\n--memory -- \n" + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20)) + "M")); } io.flush(); } public static class Task implements Runnable{ final FastIO io ; final Debug debug ; int inf = (int)1e8; public Task( FastIO io, Debug debug){ this.io = io; this.debug = debug; } @Override public void run(){ int t = io.readInt(); while((t-- > 0))solve(); } int[][] prefix = new int[12][(1 << 12)]; int[][] profits = new int[12][(1 << 12)]; Col[] cols = new Col[2000]; {for ( int i = 0;(i < 2000);i++) {cols[i] = new Col(12); }}public void solve(){ int n = io.readInt();  int m = io.readInt(); for ( int i = 0;(i < m);i++) {cols[i].max = 0; cols[i].n = n; }for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {cols[j].data[i] = io.readInt(); cols[j].max = Math.max(cols[j].max,cols[j].data[i]); }}Arrays.sort(cols,0,m,(a,b)->(a.max - b.max)); Col[] cols = Arrays.copyOf(this.cols,Math.min(m,n));  int mask = ((1 << n) - 1);  SubsetGenerator sg = new SubsetGenerator();  SubsetGenerator2 sg2 = new SubsetGenerator2();  BitOperator bo = new BitOperator(); for ( int i = 0;(i < cols.length);i++) {Arrays.fill(profits[i],0); for ( int j = 0;(j < n);j++) {cols[i].rotate(); for ( int k = 0;(k < n);k++) {sg2.values[k] = cols[i].data[k]; }sg2.setSet(mask); while(sg2.hasNext()){profits[i][sg2.next] = Math.max(profits[i][sg2.next],sg2.val); sg2.next(); }}}prefix[0] = profits[0]; for ( int i = 1;(i < cols.length);i++) {for ( int j = 0;(j <= mask);j++) {sg.setSet(j); prefix[i][j] = prefix[(i - 1)][j]; while(sg.hasNext()){ int next = sg.next(); prefix[i][j] = Math.max(prefix[i][j],(profits[i][next] + prefix[(i - 1)][(j ^ next)])); }}}io.cache.append(prefix[(cols.length - 1)][mask]).append('\n'); } } public static class BitOperator{ public long intersect( long x, long y){ return (x & y);} } public static class SubsetGenerator2{ private int[] meanings = new int[33]; private int[] values = new int[33]; private int[] bits = new int[33]; private int remain ; private int next ; private int val ; public void setSet( int set){ int bitCount = 0; while((set != 0)){meanings[bitCount] = (set & -set); bits[bitCount] = 0; set -= meanings[bitCount]; bitCount++; }remain = (1 << bitCount); next = 0; val = 0; } public boolean hasNext(){ return (remain > 0);} private void consume(){ remain = (remain - 1); int i ; for ( i = 0;(bits[i] == 1);i++) {bits[i] = 0; next -= meanings[i]; val -= values[i]; }bits[i] = 1; next += meanings[i]; val += values[i]; } public int next(){ int returned = next; consume(); return returned;} } public static class SubsetGenerator{ private int[] meanings = new int[33]; private int[] bits = new int[33]; private int remain ; private int next ; public void setSet( int set){ int bitCount = 0; while((set != 0)){meanings[bitCount] = (set & -set); bits[bitCount] = 0; set -= meanings[bitCount]; bitCount++; }remain = (1 << bitCount); next = 0; } public boolean hasNext(){ return (remain > 0);} private void consume(){ remain = (remain - 1); int i ; for ( i = 0;(bits[i] == 1);i++) {bits[i] = 0; next -= meanings[i]; }bits[i] = 1; next += meanings[i]; } public int next(){ int returned = next; consume(); return returned;} } public static class Col{ int[] data ; int max ; int n ; public void rotate(){ int end = data[(n - 1)]; System.arraycopy(data,0,data,1,(n - 1)); data[0] = end; } public Col( int n){ data = new int[n]; } } public static class FastIO{ public final StringBuilder cache = new StringBuilder((1 << 13)); private final InputStream is ; private final OutputStream os ; private final Charset charset ; private StringBuilder defaultStringBuf = new StringBuilder((1 << 13)); private byte[] buf = new byte[(1 << 13)]; private int bufLen ; private int bufOffset ; private int next ; public FastIO( InputStream is, OutputStream os, Charset charset){ this.is = is; this.os = os; this.charset = charset; } public FastIO( InputStream is, OutputStream os){ this(is,os,Charset.forName("ascii")); } private int read(){ while((bufLen == bufOffset)){bufOffset = 0; try{bufLen = is.read(buf); }catch (IOException e){ throw (new RuntimeException(e));} if ( (bufLen == -1)) {return -1;} }return buf[bufOffset++];} public void skipBlank(){ while(((next >= 0) && (next <= 32))){next = read(); }} public int readInt(){ int sign = 1; skipBlank(); if ( ((next == '+') || (next == '-'))) {sign = ((next == '+')?1:-1); next = read(); } int val = 0; if ( (sign == 1)) {while(((next >= '0') && (next <= '9'))){val = (((val * 10) + next) - '0'); next = read(); }} else {while(((next >= '0') && (next <= '9'))){val = (((val * 10) - next) + '0'); next = read(); }}return val;} public String readString( StringBuilder builder){ skipBlank(); while((next > 32)){builder.append((char)next); next = read(); }return builder.toString();} public String readString(){ defaultStringBuf.setLength(0); return readString(defaultStringBuf);} public int readString( char[] data, int offset){ skipBlank(); int originalOffset = offset; while((next > 32)){data[offset++] = (char)next; next = read(); }return (offset - originalOffset);} public int readString( byte[] data, int offset){ skipBlank(); int originalOffset = offset; while((next > 32)){data[offset++] = (byte)next; next = read(); }return (offset - originalOffset);} public void flush()throws IOException { os.write(cache.toString().getBytes(charset)); os.flush(); cache.setLength(0); } } public static class Debug{ private boolean allowDebug ; public Debug( boolean allowDebug){ this.allowDebug = allowDebug; } public void fail(){ throw (new RuntimeException());} private void outputName( String name){ System.out.print((name + " = ")); } } }
0	public class loser{ static class InputReader{ public BufferedReader br ; public StringTokenizer token ; public InputReader( InputStream stream){ br = new BufferedReader(new InputStreamReader(stream),32768); token = null; } public String next(){ while(((token == null) || !token.hasMoreTokens())){try{token = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return token.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } static void shuffle( long[] a){ List<Long> l = new ArrayList<>(); for ( int i = 0;(i < a.length);i++) l.add(a[i]); Collections.shuffle(l); for ( int i = 0;(i < a.length);i++) a[i] = l.get(i); } public static void main( String[] args){ InputReader sc = new InputReader(System.in);  int k = sc.nextInt();  int n = sc.nextInt();  int s = sc.nextInt();  int p = sc.nextInt();  long d = (long)Math.ceil(((double)n / s)); if ( (d == 0)) d = 1; d = (k * d); long ans = (long)Math.ceil(((double)d / p)); System.out.println(ans); } }
2	public class DigitalSequence{ public static void print( String s){ System.out.println(s); } public static void main( String[] args){ long k = new Scanner(System.in).nextLong();  long i = 1,t = 0,c = 9,digits = 0,l = 0,k2 = k; while((t < k)){l = t; t += (i * c); i++; c *= 10; digits++; }k = (k - l); long lastNumber = ((long)Math.pow(10,(digits - 1)) - 1);  long p = (k / digits),q = (k % digits);  long finalNumber = (lastNumber + p); if ( (q != 0)) {finalNumber++; } k = (k - (digits * p)); if ( (k <= 0)) k += digits;  String ans = ("" + finalNumber);  int index = (int)(k - 1); print(("" + ans.charAt(index))); } }
4	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastScanner in = new FastScanner(inputStream);  FastPrinter out = new FastPrinter(outputStream);  TaskD solver = new TaskD(); solver.solve(1,in,out); out.close(); } } class TaskD{ public void solve( int testNumber, FastScanner in, FastPrinter out){ int n = in.nextInt();  int m = in.nextInt();  int[] from = new int[m];  int[] to = new int[m]; for ( int i = 0;(i < m);i++) {from[i] = (in.nextInt() - 1); to[i] = (in.nextInt() - 1); } int ans = Integer.MAX_VALUE; for ( int i = 0;(i < n);i++) { KuhnMatchingGraph g = new KuhnMatchingGraph(n,n);  int count = 0; for ( int j = 0;(j < m);j++) {if ( ((from[j] != i) && (to[j] != i))) {g.addEdge(from[j],to[j]); ++count; } } int cur = (((n - 1) + count) - (2 * g.getMaximalMatching()));  boolean[] a = new boolean[n];  boolean[] b = new boolean[n]; for ( int j = 0;(j < m);j++) {if ( (from[j] == i)) {a[to[j]] = true; } if ( (to[j] == i)) {b[from[j]] = true; } }for ( int j = 0;(j < n);j++) {if ( (j == i)) {if ( !a[j]) ++cur; } else {if ( !a[j]) ++cur; if ( !b[j]) ++cur; }}ans = Math.min(ans,cur); }out.println(ans); } } class FastScanner extends BufferedReader{ public FastScanner( InputStream is){ super(new InputStreamReader(is)); } public int read(){ try{ int ret = super.read(); return ret; }catch (IOException e){ throw (new InputMismatchException());} } static boolean isWhiteSpace( int c){ return ((c >= 0) && (c <= 32));} public int nextInt(){ int c = read(); while(isWhiteSpace(c)){c = read(); } int sgn = 1; if ( (c == '-')) {sgn = -1; c = read(); } int ret = 0; while(((c >= 0) && !isWhiteSpace(c))){if ( ((c < '0') || (c > '9'))) {throw (new NumberFormatException((("digit expected " + (char)c) + " found")));} ret = (((ret * 10) + c) - '0'); c = read(); }return (ret * sgn);} } class FastPrinter extends PrintWriter{ public FastPrinter( OutputStream out){ super(out); } } class KuhnMatchingGraph{ int n ; int m ; List<Integer>[] edges ; int[] p1 ; int[] p2 ; int[] was ; int VER ; public KuhnMatchingGraph( int n, int m){ this.n = n; this.m = m; edges = new ArrayList[n]; for ( int i = 0;(i < n);i++) {edges[i] = new ArrayList<Integer>(2); }} public void addEdge( int from, int to){ edges[from].add(to); } public int getMaximalMatching(){ p1 = new int[n]; p2 = new int[m]; was = new int[n]; VER = 0; Arrays.fill(p1,-1); Arrays.fill(p2,-1); int answer = 0; for ( int i = 0;(i < n);i++) {for ( int j :edges[i]) {if ( (p2[j] < 0)) {p2[j] = i; p1[i] = j; answer++; break;} }}for ( int i = 0;(i < n);i++) {if ( (p1[i] >= 0)) {continue;} VER++; if ( dfs(i)) {answer++; } }return answer;} boolean dfs( int v){ if ( (was[v] == VER)) {return false;} was[v] = VER; for ( int i = 0;(i < edges[v].size());i++) { int e = edges[v].get(i); if ( ((p2[e] < 0) || dfs(p2[e]))) {p2[e] = v; p1[v] = e; return true;} }return false;} }
6	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskE solver = new TaskE(); solver.solve(1,in,out); out.close(); } } class TaskE{ public void solve( int testNumber, InputReader in, OutputWriter out){ int n = in.nextInt();  double[][] probability = in.next2DDoubleArray(n,n);  double[] dp = new double[(1 << n)]; dp[(dp.length - 1)] = 1; for ( int mask = ((1 << n) - 1);(mask >= 0);mask--) { int count = Integer.bitCount(mask); if ( (count <= 1)) continue; double multi = (1. / calc(count)); for ( int i = 0;(i < n);i++) {if ( NumberUtils.checkBit(mask,i)) {for ( int j = (i + 1);(j < n);j++) {if ( NumberUtils.checkBit(mask,j)) {dp[(mask - (1 << j))] += ((multi * probability[i][j]) * dp[mask]); dp[(mask - (1 << i))] += ((multi * probability[j][i]) * dp[mask]); } }} }} double[] answer = new double[n]; for ( int i = 0;(i < n);i++) {answer[i] = dp[(1 << i)]; }out.printLine(ArrayUtils.asList(answer).toArray()); } static private int calc( int x){ return ((x * (x - 1)) / 2);} } class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } public int read(){ if ( (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 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 & 15); c = read(); }while(!isSpaceChar(c));return (res * sgn);} public static boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} 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 double[] nextDoubleArray( int count){ double[] result = new double[count]; for ( int i = 0;(i < count);i++) {result[i] = nextDouble(); }return result;} public double[][] next2DDoubleArray( int n, int m){ double[][] result = new double[n][]; for ( int i = 0;(i < n);i++) {result[i] = nextDoubleArray(m); }return result;} } class OutputWriter{ PrintWriter writer ; public OutputWriter( OutputStream stream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object obj){ writer.print(obj); } public void println(){ writer.println(); } public void print( char c){ writer.print(c); } public void close(){ writer.close(); } public void printItems( Object... items){ for ( int i = 0;(i < items.length);i++) {if ( (i != 0)) {print(' '); } print(items[i]); }} public void printLine( Object... items){ printItems(items); println(); } }
0	public class P1{ public static void main( String[] args){ System.out.println("25"); } }
4	public class EdA{ static long[] mods = {1000000007,998244353,1000000009}; static long mod = mods[0]; public static MyScanner sc ; public static PrintWriter out ; public static void main( String[] havish)throws Exception { sc = new MyScanner(); out = new PrintWriter(System.out); int n = sc.nextInt(); mod = sc.nextLong(); long[] fact = new long[401];  long[] twopowers = new long[401]; fact[0] = 1; twopowers[0] = 1; for ( int j = 1;(j <= 400);j++) {twopowers[j] = (twopowers[(j - 1)] * 2L); twopowers[j] %= mod; fact[j] = (fact[(j - 1)] * j); fact[j] %= mod; } long[][] choose = new long[401][401]; for ( int j = 0;(j <= 400);j++) {for ( int k = 0;(k <= j);k++) {choose[j][k] = fact[j]; choose[j][k] *= inv(fact[k]); choose[j][k] %= mod; choose[j][k] *= inv(fact[(j - k)]); choose[j][k] %= mod; }} long[][] dp = new long[(n + 1)][(n + 1)]; for ( int j = 1;(j <= n);j++) {dp[j][0] = twopowers[(j - 1)]; }for ( int k = 0;(k < n);k++) {for ( int j = 1;(j <= n);j++) {if ( (k > j)) continue; for ( int add = 2;((j + add) <= n);add++) { long prod = (dp[j][k] * choose[(((j - k) + add) - 1)][(add - 1)]); prod %= mod; prod *= twopowers[(add - 2)]; dp[(j + add)][(k + 1)] += prod; dp[(j + add)][(k + 1)] %= mod; }}} long ans = 0; for ( int s = 0;(s <= n);s++) {ans += dp[n][s]; ans %= mod; }out.println(ans); out.close(); } public static long inv( long n){ return power(n,(mod - 2));} public static void sort( int[] array){ ArrayList<Integer> copy = new ArrayList<>(); for ( int i :array) copy.add(i); Collections.sort(copy); for ( int i = 0;(i < array.length);i++) array[i] = copy.get(i); } static long power( long x, long y){ if ( (y == 0)) return 1; if ( ((y % 2) == 1)) return ((x * power(x,(y - 1))) % mod); return (power(((x * x) % mod),(y / 2)) % mod);} public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} double nextDouble(){ return Double.parseDouble(next());} } }
5	public class A{ final int MOD = ((int)1e9 + 7); final double eps = 1e-12; final int INF = (int)1e9; public A(){ int N = sc.nextInt();  int K = sc.nextInt();  Long[] A = sc.nextLongs(); sort(A); Set<Long> S = new HashSet<Long>(); for ( long a :A) {if ( (((a % K) == 0) && S.contains(H((a / K))))) continue; S.add(H(a)); } int res = S.size(); exit(res); } long P = probablePrime(60,new Random()).longValue(); long Q = probablePrime(60,new Random()).longValue(); long H( long x){ return ((P * x) + Q);} static MyScanner sc = new MyScanner(); static class MyScanner{ public String next(){ newLine(); return line[index++];} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} public double nextDouble(){ return Double.parseDouble(next());} public String[] nextStrings(){ line = null; return readLine().split(" ");} public Integer[] nextInts(){ String[] L = nextStrings();  Integer[] res = new Integer[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Integer.parseInt(L[i]); return res;} public Long[] nextLongs(){ String[] L = nextStrings();  Long[] res = new Long[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Long.parseLong(L[i]); return res;} public Double[] nextDoubles(){ String[] L = nextStrings();  Double[] res = new Double[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Double.parseDouble(L[i]); return res;} public String[] next( int N){ String[] res = new String[N]; for ( int i = 0;(i < N);++i) res[i] = sc.next(); return res;} public Integer[] nextInt( int N){ Integer[] res = new Integer[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInt(); return res;} public Long[] nextLong( int N){ Long[] res = new Long[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLong(); return res;} public Double[] nextDouble( int N){ Double[] res = new Double[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDouble(); return res;} public String[][] nextStrings( int N){ String[][] res = new String[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextStrings(); return res;} public Integer[][] nextInts( int N){ Integer[][] res = new Integer[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInts(); return res;} public Long[][] nextLongs( int N){ Long[][] res = new Long[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLongs(); return res;} public Double[][] nextDoubles( int N){ Double[][] res = new Double[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDoubles(); return res;} private boolean eol(){ return (index == line.length);} private String readLine(){ try{return r.readLine(); }catch (Exception e){ throw (new Error(e));} } private final BufferedReader r ; MyScanner(){ this(new BufferedReader(new InputStreamReader(System.in))); } MyScanner( BufferedReader r){ try{this.r = r; while(!r.ready())Thread.sleep(1); start(); }catch (Exception e){ throw (new Error(e));} } private String[] line ; private int index ; private void newLine(){ if ( ((line == null) || eol())) {line = readLine().split(" "); index = 0; } } } static void print( Object o, Object... a){ printDelim(" ",o,a); } static void printDelim( String delim, Object o, Object... a){ pw.println(build(delim,o,a)); } static void exit( Object o, Object... a){ print(o,a); exit(); } static void exit(){ pw.close(); System.out.flush(); System.err.println("------------------"); System.err.println(("Time: " + ((millis() - t) / 1000.0))); System.exit(0); } static String build( String delim, Object o, Object... a){ StringBuilder b = new StringBuilder(); append(b,o,delim); for ( Object p :a) append(b,p,delim); return b.toString().trim();} static void append( StringBuilder b, Object o, String delim){ if ( o.getClass().isArray()) { int L = Array.getLength(o); for ( int i = 0;(i < L);++i) append(b,Array.get(o,i),delim); } else if ( (o instanceof Iterable<?>)) {for ( Object p :(Iterable<?>)o) append(b,p,delim); } else b.append(delim).append(o); } public static void main( String[] args){ new A(); exit(); } static void start(){ t = millis(); } static PrintWriter pw = new PrintWriter(System.out); static long t ; static long millis(){ return System.currentTimeMillis();} }
3	public class C extends PrintWriter{ void run(){ int n = nextInt();  int r = nextInt();  int[] x = nextArray(n);  double[] y = new double[n]; Arrays.fill(y,r); for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < i);j++) { int dx = abs((x[i] - x[j]));  int sdy = (((4 * r) * r) - (dx * dx)); if ( (sdy >= 0)) { double dy = sqrt(sdy); y[i] = max(y[i],(y[j] + dy)); } }}for ( double v :y) {printf(Locale.ENGLISH,"%.10f ",v); }} String next(){ while(!tokenizer.hasMoreTokens())tokenizer = new StringTokenizer(nextLine()); return tokenizer.nextToken();} boolean hasNext(){ while(!tokenizer.hasMoreTokens()){ String line = nextLine(); if ( (line == null)) {return false;} tokenizer = new StringTokenizer(line); }return true;} int[] nextArray( int n){ int[] array = new int[n]; for ( int i = 0;(i < n);i++) {array[i] = nextInt(); }return array;} int nextInt(){ return Integer.parseInt(next());} String nextLine(){ try{return reader.readLine(); }catch (IOException err){ return null;} } public C( OutputStream outputStream){ super(outputStream); } static BufferedReader reader ; static StringTokenizer tokenizer = new StringTokenizer(""); static Random rnd = new Random(); static boolean OJ ; public static void main( String[] args)throws IOException { OJ = (System.getProperty("ONLINE_JUDGE") != null); C solution = new C(System.out); if ( OJ) {reader = new BufferedReader(new InputStreamReader(System.in)); solution.run(); } else {reader = new BufferedReader(new FileReader(new File((C.class.getName() + ".txt")))); long timeout = System.currentTimeMillis(); while(solution.hasNext()){solution.run(); solution.println(); solution.println("----------------------------------"); }solution.println(("time: " + (System.currentTimeMillis() - timeout))); }solution.close(); reader.close(); } }
6	public class E implements Runnable{ public static void main( String[] args){ new Thread(null,new E(),"_cf",(1 << 28)).start(); } int n ,m ; char[] str ; int[][] occs ,cost ; int[] dp ; int oo = (int)1e9; int solve( int mask){ if ( (mask == ((1 << m) - 1))) return 0; if ( (dp[mask] != -1)) return dp[mask]; int res = oo;  int addOn = 0; for ( int nxt = 0;(nxt < m);nxt++) {if ( (((1 << nxt) & mask) > 0)) continue; addOn += cost[nxt][mask]; }for ( int nxt = 0;(nxt < m);nxt++) {if ( (((1 << nxt) & mask) > 0)) continue; int ret = (addOn + solve((mask | (1 << nxt)))); res = Math.min(res,ret); }return dp[mask] = res;} class FastScanner{ public int BS = (1 << 16); public char NC = (char)0; byte[] buf = new byte[BS]; int bId = 0,size = 0; char c = NC; double num = 1; BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } public char nextChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ num = 1; boolean neg = false; if ( (c == NC)) c = nextChar(); for ( ;((c < '0') || (c > '9'));c = nextChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = nextChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); num *= 10; }return (neg?-res:res);} public String next(){ StringBuilder res = new StringBuilder(); while((c <= 32))c = nextChar(); while((c > 32)){res.append(c); c = nextChar(); }return res.toString();} } }
6	public class Code implements Runnable{ public static void main( String[] args)throws IOException { new Thread(new Code()).start(); } private void solve()throws IOException { int n = nextInt(),m = nextInt(); if ( (n > m)) {n ^= m; m ^= n; n ^= m; } int[][][] dp = new int[41][64][64]; for ( int i = 0;(i < 41);++i) for ( int j = 0;(j < 64);++j) for ( int k = 0;(k < 64);++k) dp[i][j][k] = (Integer.MAX_VALUE / 2); for ( int i = 0;(i < 64);++i) dp[0][0][i] = countBit(i); for ( int i = 1;(i <= m);++i) {for ( int cur = 0;(cur < 64);++cur) {for ( int next = 0;(next < 64);++next) {for ( int prev = 0;(prev < 64);++prev) {if ( !isBad(prev,cur,next,n)) {dp[i][cur][next] = min(dp[i][cur][next],(dp[(i - 1)][prev][cur] + countBit(next))); } }}}} int ans = Integer.MAX_VALUE; for ( int i = 0;(i < 64);++i) ans = min(ans,dp[m][i][0]); writer.println(((n * m) - ans)); } private boolean isBit( int bits, int pos){ return ((pos < 0)?false:((bits & (1 << pos)) != 0));} private boolean isBad( int prev, int cur, int next, int count){ for ( int i = 0;(i < count);++i) if ( ((((isBit(cur,(i - 1)) || isBit(cur,i)) || isBit(cur,(i + 1))) || isBit(prev,i)) || isBit(next,i))) return true; return false;} private int countBit( int bits){ int ans = 0; for ( int i = 0;(i < 6);++i) ans += (((bits & (1 << i)) > 0)?1:0); return ans;} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} private String nextToken()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(reader.readLine()); return st.nextToken();} private String in = "",out = ""; private BufferedReader reader ; private PrintWriter writer ; private StringTokenizer st ; }
6	public class Main{ public static double p[] ; static double s[] ; static double m[] ; static int n ; public static double a[][] ; public static int index = 0; public static boolean vis[] ; public static HashMap<Integer,Integer> permMap ; public static void main( String[] g){ Scanner sc = new Scanner(System.in); n = sc.nextInt(); m = new double[((1 << n) + 1)]; vis = new boolean[((1 << n) + 1)]; a = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {a[i][j] = sc.nextDouble(); }}s = new double[(1 << n)]; int perm = 0; m[0] = 1; p(); int c = ((1 << n) - 1); for ( int i = 0;(i < n);i++) {perm = (c - (1 << i)); System.out.printf("%.6f ",m[perm]); }{}} public static void p(){ for ( int k = 0;(k < (1 << n));k++) { int perm = k; for ( int j = 0;(j < n);j++) {if ( bitTest(perm,j)) {continue;} int newPerm = (perm | (1 << j)); for ( int i = 0;(i < n);i++) {if ( ((i == j) || bitTest(newPerm,i))) {continue;} int L = (n - countO(perm)); if ( (L < 2)) {continue;} double pm = (2.0 / (L * (L - 1))); m[newPerm] += ((m[perm] * a[i][j]) * pm); }}}} static private int countO( int marked){ int count = 0; for ( int i = 0;(i < n);i++) { int test = (1 << i); if ( ((test & marked) == test)) count++; }return count;} static private boolean bitTest( int perm, int i){ int test = (1 << i); if ( ((test & perm) == test)) return true; return false;} }
1	public class Main{ static int n = 5; static int[] arr = new int[5]; public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int arr[] = new int[n]; for ( int i = 0;(i < n);i++) {arr[i] = sc.nextInt(); }for ( int i = 0;(i < n);i++) {if ( (arr[i] >= 0)) {arr[i] = (-arr[i] - 1); } }if ( ((n % 2) != 0)) { int min = 0; for ( int i = 1;(i < n);i++) {if ( (arr[i] < arr[min])) min = i; }arr[min] = (-arr[min] - 1); } for ( int x :arr) {System.out.print((x + " ")); }} }
2	public class CodeForces{ static boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null); private final long MOD = 1000000009; long power( long a, long b){ long res = 1; while((b > 0)){if ( ((b & 1) == 1)) {res *= a; if ( (res >= MOD)) res %= MOD; } a *= a; if ( (a >= MOD)) a %= MOD; b >>= 1; }return res;} void runCase( int caseNum)throws IOException { long n = nextLong();  long m = nextLong();  long k = nextLong(); if ( ((n - m) >= (n / k))) {System.out.println(m); return ;} long res = 0;  long rem = ((k - 1) * (n - m)); m -= rem; long bound = (m / k); res = (((power(2,(bound + 1)) + MOD) - 2) % MOD); res *= k; res %= MOD; res += rem; res += (m % k); res %= MOD; System.out.println(res); } public static void main( String[] args)throws IOException { if ( ONLINE_JUDGE) {System.out.println(); in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); } else {in = new BufferedReader(new FileReader("input.txt")); out = new PrintWriter(System.out); }new CodeForces().runIt(); out.flush(); out.close(); return ;} static BufferedReader in ; private StringTokenizer st ; static PrintWriter out ; static int pos ; static String curInput = ""; String next()throws IOException { while(!st.hasMoreTokens()){ String line = in.readLine(); if ( (line == null)) {return null;} st = new StringTokenizer(line); }return st.nextToken();} long nextLong()throws IOException { return Long.parseLong(next());} void runIt()throws IOException { st = new StringTokenizer(""); runCase(0); out.flush(); } }
4	public class Main{ static int m ; static long pow( long b, int p){ long ret = 1; while((p > 0)){if ( ((p & 1) == 1)) ret = ((b * ret) % m); b = ((b * b) % m); p >>= 1; }return ret;} public static void main( String[] args)throws IOException { int n = readInt(); m = readInt(); long[] fac = new long[(n + 1)],pow2 = new long[(n + 1)];  long[][] C = new long[(n + 1)][(n + 1)],dp = new long[(n + 1)][(n + 1)]; fac[0] = pow2[0] = 1; for ( int i = 1;(i <= n);++i) {fac[i] = ((i * fac[(i - 1)]) % m); pow2[i] = ((2 * pow2[(i - 1)]) % m); for ( int j = 0;(j <= i);++j) C[i][j] = ((fac[i] * ((pow(fac[j],(m - 2)) * pow(fac[(i - j)],(m - 2))) % m)) % m); }for ( int i = 1;(i <= n);++i) {dp[i][i] = pow2[(i - 1)]; for ( int j = 0;(j <= i);++j) for ( int k = 1;(((i + k) + 1) <= n);++k) dp[((i + k) + 1)][(j + k)] = ((dp[((i + k) + 1)][(j + k)] + (dp[i][j] * ((C[(j + k)][k] * pow2[(k - 1)]) % m))) % m); } long ans = 0; for ( int i = 1;(i <= n);++i) ans = ((ans + dp[n][i]) % m); System.out.println(ans); } static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st ; static String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} static int readInt()throws IOException { return Integer.parseInt(next());} }
2	public class Main{ static class Task{ int NN = 500005; int MOD = 1000000007; int INF = 2000000000; long INFINITY = 2000000000000000000L; public void solve( InputReader in, PrintWriter out){ int t = in.nextInt(); while((t-- > 0)){ long n = in.nextLong();  long k = in.nextLong(); if ( ((n < 32) && (k > (((1L << (2L * n)) - 1L) / 3L)))) {out.println("NO"); continue;} if ( ((n == 2) && (k == 3))) {out.println("NO"); continue;} if ( (n >= 32)) {out.println(("YES " + (n - 1))); continue;} boolean done = false; for ( long i = 1;(i <= n);++i) {if ( (k < (((1L << (i + 2L)) - i) - 3L))) {done = true; out.println(("YES " + (n - i))); break;} }if ( !done) {out.println("YES 0"); } }} } static void prepareIO( boolean isFileIO){ Task solver = new Task(); if ( !isFileIO) { InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream); solver.solve(in,out); out.close(); } else { String IPfilePath = (System.getProperty("user.home") + "/Downloads/ip.in");  String OPfilePath = (System.getProperty("user.home") + "/Downloads/op.out");  InputReader fin = new InputReader(IPfilePath);  PrintWriter fout = null; try{fout = new PrintWriter(new File(OPfilePath)); }catch (FileNotFoundException e){ e.printStackTrace(); } solver.solve(fin,fout); fout.close(); }} public static void main( String[] args){ prepareIO(false); } static class InputReader{ public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream),32768); tokenizer = null; } public InputReader( String filePath){ File file = new File(filePath); try{reader = new BufferedReader(new FileReader(file)); }catch (FileNotFoundException e){ e.printStackTrace(); } 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());} public long nextLong(){ return Long.parseLong(next());} } }
2	public class Main{ public static void main( String[] args)throws FileNotFoundException { ConsoleIO io = new ConsoleIO(new InputStreamReader(System.in),new PrintWriter(System.out)); new Main(io).solve(); io.close(); } ConsoleIO io ; Main( ConsoleIO io){ this.io = io; } ConsoleIO opt ; Main( ConsoleIO io, ConsoleIO opt){ this.io = io; this.opt = opt; } List<List<Integer>> gr = new ArrayList<>(); long MOD = 1_000_000_007; public void solve(){ StringBuilder sb = new StringBuilder();  int q = io.ri(); for ( int i = 0;(i < q);i++) { long n = io.readLong();  long k = io.readLong(); if ( (i > 0)) sb.append(System.lineSeparator());  boolean done = false; if ( ((n == 2) && (k == 3))) {sb.append("NO"); done = true; } for ( int p = 0;((n > 0) && !done);p++,n--) { long count = (1L << (p * 2)); if ( (k > count)) {k -= count; } else { long path = ((p == 0)?1:((((1L << (p - 1)) * 2) + (((1L << (p - 1)) - 1) * 2)) + 1)); if ( (k < path)) {sb.append(("YES " + n)); } else {sb.append(("YES " + (n - 1))); }done = true; }}if ( !done) {sb.append("NO"); } }io.writeLine(sb.toString()); } } class ConsoleIO{ BufferedReader br ; PrintWriter out ; public ConsoleIO( Reader reader, PrintWriter writer){ br = new BufferedReader(reader); out = writer; } public void flush(){ this.out.flush(); } public void close(){ this.out.close(); } public void writeLine( String s){ this.out.println(s); } public int read( char[] buf, int len){ try{return br.read(buf,0,len); }catch (Exception ex){ return -1;} } public String readLine(){ try{return br.readLine(); }catch (Exception ex){ return "";} } public int ri(){ try{ int r = 0;  boolean start = false;  boolean neg = false; while(true){ int c = br.read(); if ( ((c >= '0') && (c <= '9'))) {r = (((r * 10) + c) - '0'); start = true; } else if ( (!start && (c == '-'))) {start = true; neg = true; } else if ( (start || (c == -1))) return (neg?-r:r); } }catch (Exception ex){ return -1;} } public long readLong(){ try{ long r = 0;  boolean start = false;  boolean neg = false; while(true){ int c = br.read(); if ( ((c >= '0') && (c <= '9'))) {r = (((r * 10) + c) - '0'); start = true; } else if ( (!start && (c == '-'))) {start = true; neg = true; } else if ( (start || (c == -1))) return (neg?-r:r); } }catch (Exception ex){ return -1;} } }
0	public class FunctionHeight{ public static void main( String[] args){ MyScanner sc = new MyScanner();  long n = sc.nl();  long k = sc.nl();  long ans = (((n + k) - 1) / n); System.out.println(ans); } static private class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} long nl(){ return Long.parseLong(next());} } }
0	public class Main{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(); if ( (n < 3)) System.out.println(n); else if ( ((n % 2) != 0)) System.out.println((((long)n * (n - 1)) * (n - 2))); else if ( ((n % 3) != 0)) System.out.println((((long)n * (n - 1)) * (n - 3))); else System.out.println((((long)(n - 1) * (n - 2)) * (n - 3))); in.close(); } }
0	public class Solution{ public static void main( String[] args)throws Exception { Scanner in = new Scanner(System.in);  int n = in.nextInt(); if ( ((n % 2) == 0)) System.out.println(("4 " + (n - 4))); else System.out.println(("9 " + (n - 9))); } }
2	public class cf337c{ static long mod ,n ,m ,k ; public static void main( String[] args){ FastIO in = new FastIO(),out = in; n = in.nextLong(); m = in.nextLong(); k = in.nextLong(); mod = ((long)1e9 + 9); long x = ((m - (((n - (n % k)) / k) * (k - 1))) - (n % k)); if ( (x < 0)) x = 0;  long ans = ((((pow(2,(x + 1)) - 2) * k) + m) - (x * k)); ans = (((ans % mod) + mod) % mod); out.println(ans); out.close(); } static long pow( long x, long p){ if ( (p == 0)) return (1 % mod); long ans = pow(x,(p / 2)); ans = ((ans * ans) % mod); if ( ((p % 2) == 1)) ans = ((ans * x) % mod); return ans;} static class FastIO extends PrintWriter{ BufferedReader br ; StringTokenizer st ; public FastIO(){ this(System.in,System.out); } public FastIO( InputStream in, OutputStream out){ super(new BufferedWriter(new OutputStreamWriter(out))); br = new BufferedReader(new InputStreamReader(in)); scanLine(); } public void scanLine(){ try{st = new StringTokenizer(br.readLine().trim()); }catch (Exception e){ throw (new RuntimeException(e.getMessage()));} } public int numTokens(){ if ( !st.hasMoreTokens()) {scanLine(); return numTokens();} return st.countTokens();} public String next(){ if ( !st.hasMoreTokens()) {scanLine(); return next();} return st.nextToken();} public long nextLong(){ return Long.parseLong(next());} } }
6	public class Main{ static int[][] memo ; static int n ,m ,in[][] ; static int dp( int col, int maxRowMask){ if ( ((col >= Math.min(n,m)) || (maxRowMask == ((1 << n) - 1)))) return 0; if ( (memo[col][maxRowMask] != -1)) return memo[col][maxRowMask]; int ans = 0;  int availableBits = (maxRowMask ^ ((1 << n) - 1)); for ( int colMask = availableBits;(colMask != 0);colMask = ((colMask - 1) & availableBits)) {ans = Math.max(ans,(maxMask[col][colMask] + dp((col + 1),(maxRowMask | colMask)))); }return memo[col][maxRowMask] = ans;} static int[][] sumOfMask ; static int[][] maxMask ; public static void main( String[] args)throws Exception { pw = new PrintWriter(System.out); sc = new MScanner(System.in); int tc = sc.nextInt(); while((tc-- > 0)){n = sc.nextInt(); m = sc.nextInt(); int[] maxInCol = new int[m]; in = new int[m][(n + 1)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {in[j][i] = sc.nextInt(); maxInCol[j] = Math.max(maxInCol[j],in[j][i]); in[j][n] = j; }}Arrays.sort(in,(x,y)->(maxInCol[y[n]] - maxInCol[x[n]])); memo = new int[n][(1 << n)]; sumOfMask = new int[n][(1 << n)]; maxMask = new int[n][(1 << n)]; for ( int i = 0;(i < n);i++) {for ( int msk = 0;(msk < memo[i].length);msk++) {memo[i][msk] = -1; if ( (i >= m)) continue; for ( int bit = 0;(bit < n);bit++) {if ( (((msk >> bit) & 1) != 0)) {sumOfMask[i][msk] += in[i][bit]; } }}}for ( int col = 0;(col < n);col++) {for ( int msk = 0;(msk < (1 << n));msk++) { int curMask = msk; for ( int cyclicShift = 0;(cyclicShift < n);cyclicShift++) {maxMask[col][msk] = Math.max(maxMask[col][msk],sumOfMask[col][curMask]); int lastBit = (curMask & 1); curMask >>= 1; curMask |= (lastBit << (n - 1)); }}}pw.println(dp(0,0)); }pw.flush(); } static PrintWriter pw ; static MScanner sc ; static class MScanner{ StringTokenizer st ; BufferedReader br ; public MScanner( InputStream system){ br = new BufferedReader(new InputStreamReader(system)); } public MScanner( String file)throws Exception{ br = new BufferedReader(new FileReader(file)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public long nextLong()throws IOException { return Long.parseLong(next());} public boolean ready()throws IOException { return br.ready();} } static void shuffle( int[] in){ for ( int i = 0;(i < in.length);i++) { int idx = (int)(Math.random() * in.length);  int tmp = in[i]; in[i] = in[idx]; in[idx] = tmp; }} static void shuffle( long[] in){ for ( int i = 0;(i < in.length);i++) { int idx = (int)(Math.random() * in.length);  long tmp = in[i]; in[i] = in[idx]; in[idx] = tmp; }} }
1	public class SequenceTransformation{ void solve(){ int p = 1,n = in.nextInt(); while((n > 0)){if ( (n == 1)) {out.print((p + " ")); break;} if ( (n == 2)) {out.print((p + " ")); out.print(((2 * p) + " ")); break;} if ( (n == 3)) {out.print((p + " ")); out.print((p + " ")); out.print(((3 * p) + " ")); break;} for ( int i = 0;(i < ((n + 1) / 2));i++) {out.print((p + " ")); }p *= 2; n /= 2; }} public static void main( String[] args){ in = new FastScanner(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); new SequenceTransformation().solve(); out.close(); } static FastScanner in ; static PrintWriter out ; static class FastScanner{ BufferedReader in ; StringTokenizer st ; public FastScanner( BufferedReader in){ this.in = in; } public String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} public int nextInt(){ return Integer.parseInt(nextToken());} } }
6	public class Main implements Runnable{ boolean multiple = false; long MOD ; @SuppressWarnings void solve()throws Exception { int k = sc.nextInt();  long tar = 0;  long[][] arr = new long[k][];  long[] sum = new long[k];  HashMap<Long,Pair<Integer,Integer>> map = new HashMap<>(); for ( int i = 0;(i < k);i++) { int ni = sc.nextInt(); arr[i] = new long[ni]; for ( int j = 0;(j < ni);j++) {sum[i] += arr[i][j] = sc.nextInt(); map.put(arr[i][j],new Pair<>(i,j)); }tar += sum[i]; }if ( ((tar % k) != 0)) {System.out.println("No"); return ;} tar /= k; works = new HashMap<>(); for ( int i = 0;(i < k);i++) {for ( int j = 0;(j < arr[i].length);j++) { long val = arr[i][j];  long want = ((tar - sum[i]) + val); if ( !map.containsKey(want)) continue; int key = (1 << i);  int next = map.get(want).getKey();  HashSet<Integer> seen = new HashSet<>(); seen.add(i); while(true){if ( seen.contains(next)) {if ( ((next == i) && (want == arr[i][j]))) works.put(key,(((long)i << 32) + (long)j)); break;} val = arr[next][map.get(want).getValue()]; want = ((tar - sum[next]) + val); if ( !map.containsKey(want)) continue outer; key |= (1 << next); seen.add(next); next = map.get(want).getKey(); }}}dp = new long[(1 << k)]; done = new boolean[(1 << k)]; yes = new boolean[(1 << k)]; yes[0] = done[0] = true; long ans = r(((1 << k) - 1));  long[] val = new long[k];  int[] pos = new int[k]; if ( !yes[((1 << k) - 1)]) System.out.println("No"); else {System.out.println("Yes"); while(((ans >> 32) != 0)){ long p = works.get((int)(ans >> 32));  int i = (int)(p >> 32),j = (int)(p & ((1L << 32) - 1));  long VAL = arr[i][j];  long want = ((tar - sum[i]) + VAL);  int key = (1 << i);  int next = map.get(want).getKey();  int prev = i; while(true){if ( (next == i)) {val[map.get(want).getKey()] = want; pos[map.get(want).getKey()] = (prev + 1); if ( (want == arr[i][j])) works.put(key,(((long)i << 32) + (long)j)); break;} val[map.get(want).getKey()] = want; pos[map.get(want).getKey()] = (prev + 1); VAL = arr[next][map.get(want).getValue()]; want = ((tar - sum[next]) + VAL); key |= (1 << next); prev = next; next = map.get(want).getKey(); }ans = dp[(int)(ans & ((1L << 32) - 1))]; }for ( int i = 0;(i < k);i++) System.out.println(((val[i] + " ") + pos[i])); }} HashMap<Integer,Long> works ; long[] dp ; boolean[] done ,yes ; long r( int mask){ if ( done[mask]) return dp[mask]; done[mask] = true; for ( int s = mask;(s != 0);s = ((s - 1) & mask)) if ( works.keySet().contains(s)) { int tempMask = mask; for ( int i = 0;(i < 16);i++) if ( ((s & (1 << i)) != 0)) tempMask ^= (1 << i); r(tempMask); if ( yes[tempMask]) {yes[mask] = true; return dp[mask] = (((long)s << 32) + tempMask);} } return 0;} StringBuilder ANS = new StringBuilder(); public static void main( String[] args)throws Throwable { Thread thread = new Thread(null,new Main(),"",(1 << 26)); thread.start(); thread.join(); if ( (Main.uncaught != null)) {throw (Main.uncaught);} } static Throwable uncaught ; BufferedReader in ; FastScanner sc ; PrintWriter out ; } class FastScanner{ BufferedReader in ; StringTokenizer st ; public FastScanner( BufferedReader in){ this.in = in; } public String nextToken()throws Exception { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(in.readLine()); }return st.nextToken();} public int nextInt()throws Exception { return Integer.parseInt(nextToken());} }
1	public class Main{ static private void solve( InputReader in, OutputWriter out){ int n = in.nextInt(); if ( (n < 6)) {out.println(-1); } else { int m = (n - 2); for ( int i = 2;(i <= m);i++) {out.println(("1 " + i)); }out.println(((m + " ") + (m + 1))); out.println(((m + " ") + (m + 2))); }for ( int i = 2;(i <= n);i++) {out.println(("1 " + i)); }} public static void main( String[] args){ InputReader in = new InputReader(System.in);  OutputWriter out = new OutputWriter(System.out); solve(in,out); in.close(); out.close(); } static private class InputReader{ private BufferedReader br ; private StringTokenizer st ; InputReader( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); st = null; } String nextLine(){ String line = null; try{line = br.readLine(); }catch (IOException e){ e.printStackTrace(); } return line;} String next(){ while(((st == null) || !st.hasMoreTokens())){ String line = nextLine(); if ( (line == null)) return null; st = new StringTokenizer(line); }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} void close(){ try{br.close(); }catch (IOException e){ e.printStackTrace(); } } } static private class OutputWriter{ BufferedWriter bw ; OutputWriter( OutputStream os){ bw = new BufferedWriter(new OutputStreamWriter(os)); } void print( int i){ print(Integer.toString(i)); } void println( int i){ println(Integer.toString(i)); } void print( long l){ print(Long.toString(l)); } void println( long l){ println(Long.toString(l)); } void print( double d){ print(Double.toString(d)); } void println( double d){ println(Double.toString(d)); } void print( boolean b){ print(Boolean.toString(b)); } void println( boolean b){ println(Boolean.toString(b)); } void print( char c){ try{bw.write(c); }catch (IOException e){ e.printStackTrace(); } } void println( char c){ println(Character.toString(c)); } void print( String s){ try{bw.write(s); }catch (IOException e){ e.printStackTrace(); } } void println( String s){ print(s); print('\n'); } void close(){ try{bw.close(); }catch (IOException e){ e.printStackTrace(); } } } }
1	public class LectureSleep{ static class InputReader{ BufferedReader reader ; StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream),32768); tokenizer = null; } 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());} } static InputReader r = new InputReader(System.in); static PrintWriter pw = new PrintWriter(System.out); public static void main( String[] args){ int n = r.nextInt();  int k = r.nextInt();  int[] theorems = new int[(n + 1)]; for ( int i = 1;(i <= n);i++) {theorems[i] = r.nextInt(); } int[] mishka = new int[(n + 1)]; for ( int i = 1;(i <= n);i++) {mishka[i] = r.nextInt(); } int[] sums = new int[(n + 1)]; for ( int i = 1;(i <= n);i++) {if ( (mishka[i] == 0)) {sums[i] = (sums[(i - 1)] + theorems[i]); } else {sums[i] = sums[(i - 1)]; }} int max = 0; for ( int i = 1;(i <= ((n - k) + 1));i++) { int sum = (sums[((i + k) - 1)] - sums[(i - 1)]); max = Math.max(max,sum); } int totalSum = 0; for ( int i = 1;(i <= n);i++) {if ( (mishka[i] == 1)) {totalSum += theorems[i]; } }pw.println((totalSum + max)); pw.close(); } }
3	public class curling{ public static void main( String[] args)throws IOException { Scanner input = new Scanner(System.in);  int numD = input.nextInt();  double rad = input.nextInt();  int[] xC = new int[numD]; for ( int i = 0;(i < numD);i++) {xC[i] = input.nextInt(); } double[] maxY = new double[1001]; for ( int i = 0;(i < numD);i++) { double h = rad; for ( int j = Math.max(1,(xC[i] - (int)(2 * rad)));(j <= Math.min(1000,(xC[i] + (2 * rad))));j++) {if ( (maxY[j] > 0)) {h = Math.max(h,(Math.sqrt((((4 * rad) * rad) - ((j - xC[i]) * (j - xC[i])))) + maxY[j])); } }System.out.print((h + " ")); maxY[xC[i]] = h; }} }
4	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{ final int MOD = (int)(1e9 + 7); long[][] C ; long[] fact ; public void solve( int testNumber, FastScanner in, PrintWriter out){ int n = in.nextInt(); precalc(n); int[] a = new int[n]; for ( int i = 0;(i < n);i++) {a[i] = in.nextInt(); a[i] = removeSquares(a[i]); } int[] g = getGroupSizes(a);  long ans = solve(g); for ( int x :g) {ans = ((ans * fact[x]) % MOD); }out.println(ans); } private long solve( int[] a){ long[] d = new long[1]; d[0] = 1; int totalPositions = 1; for ( int x :a) { long[] nd = new long[((d.length + x) + 1)]; for ( int s = 0;(s < d.length);s++) {if ( (d[s] == 0)) {continue;} for ( int m = 1;(m <= x);m++) {for ( int p = 0;((p <= s) && (p <= m));p++) { long cur = d[s]; cur = ((cur * C[s][p]) % MOD); cur = ((cur * C[(totalPositions - s)][(m - p)]) % MOD); cur = ((cur * f(x,m)) % MOD); int ns = (((s + x) - m) - p); nd[ns] += cur; if ( (nd[ns] >= MOD)) {nd[ns] -= MOD; } }}}totalPositions += x; d = nd; }return d[0];} private long f( int n, int k){ if ( (n < k)) {return 0;} n -= k; return C[((n + k) - 1)][(k - 1)];} private void precalc( int n){ fact = new long[(n + 1)]; fact[0] = 1; for ( int i = 1;(i < fact.length);i++) {fact[i] = ((i * fact[(i - 1)]) % MOD); }C = new long[1000][1000]; C[0][0] = 1; for ( int i = 1;(i < C.length);i++) {C[i][0] = 1; for ( int j = 1;(j < C.length);j++) {C[i][j] = (C[(i - 1)][(j - 1)] + C[(i - 1)][j]); if ( (C[i][j] >= MOD)) {C[i][j] -= MOD; } }}} private int[] getGroupSizes( int[] a){ Arrays.sort(a); List<Integer> res = new ArrayList<>(); for ( int i = 0;(i < a.length);) { int j = i; while(((j < a.length) && (a[i] == a[j]))){++j; }res.add((j - i)); i = j; } int[] r = new int[res.size()]; for ( int i = 0;(i < r.length);i++) {r[i] = res.get(i); }return r;} private int removeSquares( int n){ int res = 1; for ( int d = 2;((d * d) <= n);d++) {if ( ((n % d) == 0)) { int cur = 0; while(((n % d) == 0)){n /= d; ++cur; }if ( ((cur % 2) == 1)) {res *= d; } } }if ( (n > 1)) {res *= n; } return res;} } static class FastScanner{ private BufferedReader in ; private StringTokenizer st ; public FastScanner( InputStream stream){ in = new BufferedReader(new InputStreamReader(stream)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
6	public class E1{ public static void main( String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  ArrayList<Integer>[] reps = new ArrayList[13];  int[][] index = new int[13][];  int[][] eqcl = new int[13][];  ArrayList<Integer>[][] nexts = new ArrayList[13][]; for ( int n = 1;(n <= 12);n++) {eqcl[n] = new int[(1 << n)]; reps[n] = new ArrayList<Integer>(); index[n] = new int[(1 << n)]; int ind = 0; for ( int mask = 0;(mask < (1 << n));mask++) { boolean add = true; for ( int k = 0;(k < n);k++) {if ( (rot(mask,k,n) < mask)) add = false; }if ( add) {reps[n].add(mask); index[n][mask] = ind; ind++; } }nexts[n] = new ArrayList[reps[n].size()]; for ( int i = 0;(i < reps[n].size());i++) { int mask = reps[n].get(i); for ( int k = 0;(k < n);k++) {eqcl[n][rot(mask,k,n)] = i; }nexts[n][i] = new ArrayList<>(); for ( int y = 0;(y < (1 << n));y++) {if ( ((mask & y) == 0)) {nexts[n][i].add(y); } }}} int T = Integer.parseInt(br.readLine());  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); for ( int test = 0;(test < T);test++) { StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int m = Integer.parseInt(st.nextToken());  int[][] arrt = new int[m][n]; for ( int i = 0;(i < n);i++) {st = new StringTokenizer(br.readLine()); for ( int j = 0;(j < m);j++) {arrt[j][i] = Integer.parseInt(st.nextToken()); }} Column[] cols = new Column[m]; for ( int j = 0;(j < m);j++) {cols[j] = new Column(arrt[j]); }Arrays.sort(cols,Collections.reverseOrder()); m = Integer.min(n,m); int[][] arr = new int[n][m]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {arr[i][j] = cols[j].arr[i]; }} int[][] max = new int[m][reps[n].size()]; for ( int c = 0;(c < m);c++) {for ( int mask = 0;(mask < (1 << n));mask++) { int curr = 0; for ( int i = 0;(i < n);i++) {if ( ((mask & (1 << i)) > 0)) curr += arr[i][c]; } int cl = eqcl[n][mask]; max[c][cl] = Integer.max(max[c][cl],curr); }} int[][] dp = new int[(m + 1)][reps[n].size()]; for ( int c = 0;(c < m);c++) {for ( int i = 0;(i < reps[n].size());i++) { int mask = reps[n].get(i); for ( int next :nexts[n][i]) { int cl = eqcl[n][next];  int dl = eqcl[n][(mask | next)]; if ( ((dp[c][i] + max[c][cl]) > dp[(c + 1)][dl])) {dp[(c + 1)][dl] = (dp[c][i] + max[c][cl]); } }}}bw.write((dp[m][(reps[n].size() - 1)] + "\n")); }bw.flush(); } static int rot( int x, int k, int n){ int a = (x << k);  int b = (x >> (n - k)); return ((a + b) & ((1 << n) - 1));} static class Column implements Comparable<Column>{ int[] arr ; int max ; public Column( int[] arr){ this.arr = arr; max = 0; for ( int k :arr) {max = Integer.max(max,k); }} } }
5	public class Main{ public static void main( String[] args){ try{ String str ;  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  BufferedOutputStream bos = new BufferedOutputStream(System.out);  String eol = System.getProperty("line.separator");  byte[] eolb = eol.getBytes();  byte[] spaceb = " ".getBytes(); str = br.readLine(); int blank = str.indexOf(" ");  int n = Integer.parseInt(str.substring(0,blank));  int m = Integer.parseInt(str.substring((blank + 1)));  long[] num = new long[n];  int j = 0;  int s = 0;  int k = 0; str = br.readLine(); int length = str.length(); while((j < length)){while((j < length)){if ( (str.charAt(j) == ' ')) {break;} else {j++; }}num[k] = Long.parseLong(str.substring(s,j)); k++; j++; s = j; }Arrays.sort(num); int count = 0; if ( (m == 1)) {count = 1; for ( int i = 1;(i < n);i++) {if ( (num[i] != num[(i - 1)])) {count++; } }} else { TreeSet<Long> take = new TreeSet<Long>();  TreeSet<Long> notTake = new TreeSet<Long>(); for ( int i = 0;(i < n);i++) { long temp = num[i]; if ( !notTake.contains(temp)) {take.add(temp); temp *= (long)m; notTake.add(temp); } }count = take.size(); }bos.write(new Integer(count).toString().getBytes()); bos.write(eolb); bos.flush(); }catch (IOException ioe){ ioe.printStackTrace(); } } }
2	public class Main{ public static void main( String[] args)throws IOException { new Main().run(); } StreamTokenizer in ; PrintWriter out ; int nextInt()throws IOException { in.nextToken(); return (int)in.nval;} static int nn ; void run()throws IOException { in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(new OutputStreamWriter(System.out)); solve(); out.flush(); } static long MOD = 1000000009; static long modPow( long a, int pow){ long res = 1; while((pow > 0)){if ( ((pow & 1) != 0)) {res = ((res * a) % MOD); } pow >>= 1; a = ((a * a) % MOD); }return res;} void solve()throws IOException { int n = nextInt(),m = nextInt(),k = nextInt();  int an = (((n / k) * (k - 1)) + (n % k));  long ans = 0; if ( (an >= m)) {System.out.println(m); return ;} int rem = (m - an); ans = (modPow(2,(rem + 1)) - 2); ans *= k; ans += (m - (rem * k)); ans %= MOD; if ( (ans < 0)) ans += MOD; System.out.println(ans); } }
0	public class A{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); System.out.println(((3 * n) / 2)); } }
0	public class A{ static StringTokenizer st ; static BufferedReader br ; static PrintWriter pw ; public static void main( String[] args)throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); BigInteger a = new BigInteger(next()); System.out.println(BigInteger.valueOf(5).modPow(a,BigInteger.valueOf(100))); pw.close(); } static private String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} }
0	public class Solution{ public static void main( String[] args){ Scanner stdin = new Scanner(System.in);  long n = stdin.nextLong(); if ( (n < 3)) System.out.println(n); else {if ( ((n % 2) == 0)) { long a = 0,b = 0; if ( ((n % 3) != 0)) a = ((n * (n - 1)) * (n - 3)); n--; b = ((n * (n - 1)) * (n - 2)); System.out.println(Math.max(a,b)); } else System.out.println(((n * (n - 1)) * (n - 2))); }} }
6	public class B{ static int[] loyality ; static int[] level ; static int mid ; static int a ,n ; static double sol ; public static void getMax( int idx, int rem){ if ( (idx == loyality.length)) { double pos = 0; for ( int i = 0;(i < (1 << n));i++) pos += solve(i); sol = Math.max(sol,pos); return ;} int cur = loyality[idx];  int r = 0; while((((r + cur) <= 10) && (r <= rem))){loyality[idx] = (cur + r); getMax((idx + 1),(rem - r)); r++; }loyality[idx] = cur; } public static double solve( int mask){ int c = 0;  int sum = 0;  double b = 1; for ( int i = 0;(i < n);i++) {if ( (((1 << i) | mask) == mask)) {c++; b *= (loyality[i] / 10.0); } else {sum += level[i]; b *= (1 - (loyality[i] / 10.0)); }}if ( (c >= mid)) return b; return ((b * (a * 1.0)) / (a + sum));} public static void main( String[] args){ Scanner sc = new Scanner(System.in); n = sc.nextInt(); int k = sc.nextInt(); a = sc.nextInt(); level = new int[n]; loyality = new int[n]; for ( int i = 0;(i < n);i++) {level[i] = sc.nextInt(); loyality[i] = (sc.nextInt() / 10); }mid = ((n / 2) + 1); sol = 0; getMax(0,k); System.out.println(sol); } }
2	public class ProblemD{ private BufferedReader in ; private PrintWriter out ; private StringTokenizer tok ; private final String DELIMETER = " "; private final boolean ENABLE_MULTITEST = false; private final boolean DEBUG = true; private final String FILENAME = null; public void run()throws Exception { initInputOutput(); do {init(); solve(); }while((hasMoreTokens() && ENABLE_MULTITEST));finish(); } private void init()throws Exception { } private void solve()throws Exception { String a = Long.toBinaryString(nextLong());  String b = Long.toBinaryString(nextLong()); while((a.length() < 64)){a = ("0" + a); }while((b.length() < 64)){b = ("0" + b); } char[] res = new char[a.length()];  int cur = 0; while(((cur < a.length()) && (a.charAt(cur) == b.charAt(cur)))){res[cur] = '0'; cur++; }while((cur < res.length)){res[cur] = '1'; cur++; }out.println(Long.valueOf(new String(res),2)); } public static void main( String[] args)throws Exception { ProblemD solution = new ProblemD(); solution.run(); } private void initInputOutput()throws Exception { if ( (FILENAME == null)) {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"); }} private String nextWord()throws Exception { if ( updateTokenizer()) {return null;} else {return tok.nextToken();}} private boolean hasMoreTokens()throws Exception { return !updateTokenizer();} private boolean updateTokenizer()throws Exception { while(((tok == null) || !tok.hasMoreTokens())){ String nextLine = in.readLine(); if ( ((nextLine == null) || nextLine.isEmpty())) {return true;} tok = new StringTokenizer(nextLine,DELIMETER); }return false;} private int nextInt()throws Exception { return Integer.parseInt(nextWord());} private long nextLong()throws Exception { return Long.parseLong(nextWord());} private void finish()throws Exception { in.close(); out.close(); } private void print( String s){ if ( DEBUG) {System.out.print(s); } } private void println( String s){ if ( DEBUG) {System.out.println(s); } } private void println(){ if ( DEBUG) {System.out.println(); } } }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,kk ,bb ; int[] uu ,vv ,uv ,cost ,cost_ ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; kk = new int[n_]; bb = new int[n_]; uu = new int[m_]; vv = new int[m_]; uv = new int[m_]; cost = new int[m_]; cost_ = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; uv[h] = (u ^ v); cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } boolean dijkstra( int s, int t){ Arrays.fill(pi,INF); pi[s] = 0; TreeSet<Integer> pq = new TreeSet<>((u,v)->((pi[u] != pi[v])?(pi[u] - pi[v]):((kk[u] != kk[v])?(kk[u] - kk[v]):(u - v)))); pq.add(s); Integer first ; while(((first = pq.pollFirst()) != null)){ int u = first;  int k = (kk[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost_[h]:-cost_[h]));  int v = (u ^ uv[h]); if ( ((pi[v] > p) || ((pi[v] == p) && (kk[v] > k)))) {if ( (pi[v] != INF)) pq.remove(v); pi[v] = p; kk[v] = k; bb[v] = h_; pq.add(v); } } }return (pi[t] != INF);} void push1( int s, int t){ for ( int u = t,h_ ,h ;(u != s);u ^= uv[h]) {h = ((h_ = bb[u]) >> 1); cc[h_]--; cc[(h_ ^ 1)]++; }} int edmonds_karp( int s, int t){ System.arraycopy(cost,0,cost_,0,m_); while(dijkstra(s,t)){push1(s,t); for ( int h = 0;(h < m_);h++) { int u = uu[h],v = vv[h]; if ( ((pi[u] != INF) && (pi[v] != INF))) cost_[h] += (pi[u] - pi[v]); }} int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
4	public class C2{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni();  int[] a = na(n); for ( int i = 0;(i < n);i++) { int v = a[i]; for ( int j = 2;((j * j) <= v);j++) {while(((v % (j * j)) == 0)){v /= (j * j); }}a[i] = v; }Arrays.sort(a); int[] f = new int[n];  int p = 0; for ( int i = 0;(i < n);i++) {if ( ((i > 0) && (a[i] != a[(i - 1)]))) {p++; } f[p]++; }f = Arrays.copyOf(f,(p + 1)); int mod = 1000000007;  int[][] fif = enumFIF(1000,mod);  long[] res = countSameNeighborsSequence(f,fif,mod);  long ans = res[0]; for ( int v :f) {ans = ((ans * fif[0][v]) % mod); }out.println(ans); } public static int[][] enumFIF( int n, int mod){ int[] f = new int[(n + 1)];  int[] invf = new int[(n + 1)]; f[0] = 1; for ( int i = 1;(i <= n);i++) {f[i] = (int)(((long)f[(i - 1)] * i) % mod); } long a = f[n];  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)); }invf[n] = (int)((p < 0)?(p + mod):p); for ( int i = (n - 1);(i >= 0);i--) {invf[i] = (int)(((long)invf[(i + 1)] * (i + 1)) % mod); }return new int[][]{f,invf};} public static long[] countSameNeighborsSequence( int[] a, int[][] fif, int mod){ int n = a.length;  int bef = a[0];  int aft = a[0];  long[] dp = new long[bef]; dp[(bef - 1)] = 1; for ( int u = 1;(u < n);u++) { int v = a[u]; aft += v; long[][] ldp = new long[bef][aft]; for ( int i = 0;(i < dp.length);i++) {ldp[i][0] = dp[i]; }for ( int i = 0;(i < v);i++) { long[][] ndp = new long[bef][aft]; for ( int j = 0;(j < bef);j++) {for ( int k = 0;((j + k) < aft);k++) {if ( (ldp[j][k] == 0)) continue; if ( (j > 0)) {ndp[(j - 1)][k] += (ldp[j][k] * j); ndp[(j - 1)][k] %= mod; } ndp[j][(k + 1)] += (ldp[j][k] * ((2 * i) - k)); ndp[j][(k + 1)] %= mod; ndp[j][k] += (ldp[j][k] * (((((bef + i) + 1) - j) - k) - (2 * (i - k)))); ndp[j][k] %= mod; }}ldp = ndp; }dp = new long[aft]; for ( int j = 0;(j < bef);j++) {for ( int k = 0;((j + k) < aft);k++) {dp[(j + k)] += ldp[j][k]; if ( (dp[(j + k)] >= mod)) dp[(j + k)] -= mod; }}for ( int j = 0;(j < aft);j++) dp[j] = ((dp[j] * fif[1][v]) % mod); bef = aft; }return dp;} 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 C2().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
4	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ static final int MODULO = (int)(1e9 + 7); public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  int[] a = new int[n]; for ( int i = 0;(i < n);++i) a[i] = removeSquares(in.nextInt()); Arrays.sort(a); int[][] c = new int[(n + 1)][(n + 1)]; c[0][0] = 1; for ( int i = 1;(i < c.length);++i) {c[i][0] = 1; for ( int j = 1;(j < c.length);++j) {c[i][j] = ((c[(i - 1)][(j - 1)] + c[(i - 1)][j]) % MODULO); }} int[] fact = new int[(n + 1)]; fact[0] = 1; for ( int i = 1;(i < fact.length);++i) {fact[i] = (int)((i * (long)fact[(i - 1)]) % MODULO); } int i = 0;  int[] ways = new int[]{1}; while((i < n)){ int j = i; while(((j < n) && (a[j] == a[i])))++j; int m = (j - i);  int[] nways = new int[(j + 1)]; for ( int old = 0;(old < ways.length);++old) { long w = ways[old]; for ( int blocks = 1;(blocks <= m);++blocks) {for ( int intoOld = 0;((intoOld <= old) && (intoOld <= blocks));++intoOld) {nways[((old - intoOld) + (m - blocks))] = (int)((nways[((old - intoOld) + (m - blocks))] + ((((((((w * c[old][intoOld]) % MODULO) * c[((i + 1) - old)][(blocks - intoOld)]) % MODULO) * c[(m - 1)][(blocks - 1)]) % MODULO) * fact[m]) % MODULO)) % MODULO); }}}i = j; ways = nways; }out.println(ways[0]); } private int removeSquares( int x){ for ( int i = 2;((i * i) <= x);++i) {while(((x % (i * i)) == 0)){x /= (i * i); }}return x;} } 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());} } }
4	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskG2 solver = new TaskG2(); solver.solve(1,in,out); out.close(); } static class TaskG2{ static final int MOD = (1000000000 + 7); static final int MAXN = 51; int getWays( int i, int j, int k, int l, int[][][][] ways, boolean[][][][] cached){ if ( (((i + j) + k) == 0)) return ((l == -1)?1:0); if ( (l < 0)) return 0; if ( cached[i][j][k][l]) return ways[i][j][k][l]; int s = ((i + j) + k);  long value = 0; if ( ((l == 0) && (i != 0))) {for ( int x = -1;(x < 3);x++) if ( (x != l)) {value += getWays((i - 1),j,k,x,ways,cached); } } if ( ((l == 1) && (j != 0))) {for ( int x = -1;(x < 3);x++) if ( (x != l)) {value += getWays(i,(j - 1),k,x,ways,cached); } } if ( ((l == 2) && (k != 0))) {for ( int x = -1;(x < 3);x++) if ( (x != l)) {value += getWays(i,j,(k - 1),x,ways,cached); } } ways[i][j][k][l] = (int)(value % MOD); cached[i][j][k][l] = true; return ways[i][j][k][l];} int totalWays( int i, int j, int k, int[][][][] ways, boolean[][][][] cached, int[] factorial){ long ret = 0; for ( int l = 0;(l < 3);l++) ret += getWays(i,j,k,l,ways,cached); ret *= factorial[i]; ret %= MOD; ret *= factorial[j]; ret %= MOD; ret *= factorial[k]; ret %= MOD; return (int)ret;} int add( int type, int value, int[] sizes, int sum, int[][][][] dp){ sizes[type]++; if ( (type == 0)) {for ( int s = (sum + value);(s >= value);s--) {for ( int i = 1;(i <= sizes[0]);i++) for ( int j = 0;(j <= sizes[1]);j++) for ( int k = 0;(k <= sizes[2]);k++) {dp[i][j][k][s] += dp[(i - 1)][j][k][(s - value)]; if ( (dp[i][j][k][s] >= MOD)) dp[i][j][k][s] -= MOD; }}} if ( (type == 1)) {for ( int s = (sum + value);(s >= value);s--) {for ( int i = 0;(i <= sizes[0]);i++) for ( int j = 1;(j <= sizes[1]);j++) for ( int k = 0;(k <= sizes[2]);k++) {dp[i][j][k][s] += dp[i][(j - 1)][k][(s - value)]; if ( (dp[i][j][k][s] >= MOD)) dp[i][j][k][s] -= MOD; }}} if ( (type == 2)) {for ( int s = (sum + value);(s >= value);s--) {for ( int i = 0;(i <= sizes[0]);i++) for ( int j = 0;(j <= sizes[1]);j++) for ( int k = 1;(k <= sizes[2]);k++) {dp[i][j][k][s] += dp[i][j][(k - 1)][(s - value)]; if ( (dp[i][j][k][s] >= MOD)) dp[i][j][k][s] -= MOD; }}} return (sum + value);} public void solve( int testNumber, InputReader in, OutputWriter out){ int[][][][] ways = new int[MAXN][MAXN][MAXN][3];  boolean[][][][] cached = new boolean[MAXN][MAXN][MAXN][3];  int n = in.nextInt(),T = in.nextInt();  ArrayList<Integer>[] ar = new ArrayList[3]; for ( int i = 0;(i < 3);i++) ar[i] = new ArrayList<Integer>(); int total_sum = 0; for ( int i = 0;(i < n);i++) { int t = in.nextInt(),g = in.nextInt(); ar[(g - 1)].add(t); total_sum += t; }if ( (T > total_sum)) {out.println(0); return ;} int min_index = 0,mn = 0; for ( int i = 0;(i < 3);i++) {if ( (ar[i].size() > mn)) {mn = ar[i].size(); min_index = i; } } int[][][][] dp = new int[(ar[((1 + min_index) % 3)].size() + 1)][(ar[((2 + min_index) % 3)].size() + 1)][1][(total_sum + 1)];  int[][][][] dp2 = new int[1][1][(mn + 1)][(total_sum + 1)]; dp[0][0][0][0] = dp2[0][0][0][0] = 1; int[] sizes = {0,0,0};  int sum = 0;  int[] order = {((min_index + 1) % 3),((min_index + 2) % 3)};  int type = 0; for ( int i :order) {for ( int v :ar[i]) sum = add(type,v,sizes,sum,dp); type++; }sum = 0; sizes[0] = sizes[1] = sizes[2] = 0; for ( int i :ar[min_index]) sum = add(2,i,sizes,sum,dp2); int[] factorial = new int[MAXN]; factorial[0] = 1; for ( int i = 1;(i < MAXN);i++) factorial[i] = (int)(((factorial[(i - 1)] * 1L) * i) % MOD); long answer = 0; for ( int i = 0;(i < dp.length);i++) for ( int j = 0;(j < dp[0].length);j++) for ( int k = 0;(k <= mn);k++) for ( int s = 0;(s <= T);s++) { long x = (((dp[i][j][0][s] * 1L) * totalWays(i,j,k,ways,cached,factorial)) % MOD); x *= dp2[0][0][k][(T - s)]; x %= MOD; answer += x; }out.println((answer % MOD)); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputReader.SpaceCharFilter filter ; 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 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 boolean isSpaceChar( int c){ if ( (filter != null)) {return filter.isSpaceChar(c);} return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void println( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }writer.print('\n'); } public void close(){ writer.close(); } } }
0	public class A{ public static void main( String[] args){ Scanner s = new Scanner(System.in);  int n = s.nextInt(); s.close(); if ( ((n % 2) == 0)) System.out.print(("4 " + (n - 4))); else System.out.print(("9 " + (n - 9))); } }
6	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);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ double ans = 0; int[] candy ; int[] b ; int[] l ; int[] curLoyal ; int n ; int k ; int A ; public void solve( int testNumber, InputReader in, PrintWriter out){ n = in.nextInt(); k = in.nextInt(); A = in.nextInt(); b = new int[n]; l = new int[n]; for ( int i = 0;(i < n);i++) {b[i] = in.nextInt(); l[i] = in.nextInt(); }candy = new int[n]; curLoyal = new int[n]; comb(0,k); out.println(ans); } void comb( int ind, int unusedCandy){ if ( (ind == n)) {for ( int i = 0;(i < n);i++) {curLoyal[i] = Math.min(((candy[i] * 10) + l[i]),100); }calc(); } else {for ( int i = 0;(i <= unusedCandy);i++) {candy[ind] = i; comb((ind + 1),(unusedCandy - i)); }}} void calc(){ double res = 0;  int allBits = ((1 << n) - 1); for ( int vote = 0;(vote <= allBits);vote++) { double curProb = 1;  int sumPower = A;  int enemyCnt = 0; for ( int voteInd = 0;(voteInd < n);voteInd++) {if ( ((vote & (1 << voteInd)) == 0)) {curProb *= (100 - curLoyal[voteInd]); sumPower += b[voteInd]; enemyCnt++; } else {curProb *= curLoyal[voteInd]; }curProb /= 100; }if ( ((2 * enemyCnt) >= n)) {curProb *= A; curProb /= sumPower; } res += curProb; }ans = Math.max(ans,res); } } static class InputReader{ private BufferedReader reader ; private StringTokenizer stt ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); } public String nextLine(){ try{return reader.readLine(); }catch (IOException e){ return null;} } public String next(){ while(((stt == null) || !stt.hasMoreTokens())){stt = new StringTokenizer(nextLine()); }return stt.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
2	public class cf276d{ static BufferedReader br ; static Scanner sc ; static PrintWriter out ; public static void initA(){ try{br = new BufferedReader(new InputStreamReader(System.in)); sc = new Scanner(System.in); out = new PrintWriter(System.out); }catch (Exception e){ } } public static Long[] getLongArr(){ try{ StringTokenizer temp = new StringTokenizer(br.readLine());  int n = temp.countTokens();  Long temp2[] = new Long[n]; for ( int i = 0;(i < n);i++) {temp2[i] = Long.parseLong(temp.nextToken()); }return temp2; }catch (Exception e){ } return null;} public static void print( Object a){ out.println(a); } public static int nextInt(){ return sc.nextInt();} public static double nextDouble(){ return sc.nextDouble();} public static void main( String[] ar){ initA(); solve(); out.flush(); } public static void print2( Object o){ System.out.println(o); } public static void solve(){ Long xx[] = getLongArr();  long l = xx[0];  long r = xx[1];  BigInteger a = BigInteger.valueOf(l);  BigInteger b = BigInteger.valueOf(r); if ( (l == r)) {print(0); return ;} String a2 = a.toString(2);  String b2 = b.toString(2);  int selisihpjg = Math.abs((a2.length() - b2.length())); while((selisihpjg-- > 0)){a2 = ("0" + a2); } String out = ""; for ( int i = 0;(i < b2.length());i++) {if ( (a2.charAt(i) != b2.charAt(i))) {for ( int ii = i;(ii < b2.length());ii++) {out += "1"; }print2(new BigInteger(out,2)); return ;} }} }
6	public class E{ public static void main( String[] args){ FastScanner scanner = new FastScanner();  PrintWriter out = new PrintWriter(System.out,false);  int n = scanner.nextInt();  int m = scanner.nextInt();  char[] str = scanner.next().toCharArray();  int maxMask = (1 << m);  long[] dp = new long[maxMask];  int[][] dists = new int[m][m]; for ( int i = 1;(i < n);i++) { int c1 = (str[i] - 'a');  int c2 = (str[(i - 1)] - 'a'); dists[c1][c2]++; dists[c2][c1]++; } int[] pre = new int[maxMask]; for ( int mask = 0;(mask < maxMask);mask++) {for ( int i = 0;(i < m);i++) {if ( (((1 << i) & mask) == 0)) continue; for ( int j = 0;(j < m);j++) {if ( (((1 << j) & mask) > 0)) continue; pre[mask] += dists[i][j]; }}}Arrays.fill(dp,(Long.MAX_VALUE / 4)); dp[0] = 0; for ( int mask = 0;(mask < maxMask);mask++) {if ( (dp[mask] == (Long.MAX_VALUE / 4))) continue; for ( int i = 0;(i < m);i++) {if ( (((1 << i) & mask) > 0)) continue; int nmask = (mask | (1 << i)); dp[nmask] = Math.min(dp[nmask],(dp[mask] + pre[nmask])); }}out.println(dp[(maxMask - 1)]); out.flush(); } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( Reader in){ br = new BufferedReader(in); } public FastScanner(){ this(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputStreamReader in = new InputStreamReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ int MOD = 1000000009; public void solve( int testNumber, InputStreamReader inSt, PrintWriter out){ InputReader in = new InputReader(inSt);  long n = in.nextInt();  long m = in.nextInt();  long k = in.nextInt();  long t = find(n,m,k);  long twoPow = binPow(2,(int)t); twoPow--; long result = ((2 * ((k * twoPow) % MOD)) % MOD); result += (m - (t * k)); result = (result % MOD); out.println(result); } int binPow( int a, int n){ if ( (n == 0)) {return 1;} if ( ((n % 2) == 1)) {return (int)((binPow(a,(n - 1)) * (a + 0l)) % MOD);} else { int b = (binPow(a,(n / 2)) % MOD); return (int)(((b + 0l) * b) % MOD);}} long find( long n, long m, long k){ long l = 0;  long r = (m / k); while((l < r)){ long mid = ((l + r) / 2);  long m1 = (m - (mid * k));  long n1 = (n - (mid * k)); if ( isPossible(n1,m1,k)) {r = mid; } else {l = (mid + 1); }}return l;} boolean isPossible( long n, long m, long k){ long r = (m / (k - 1));  long q = (m - ((k - 1) * r)); if ( (q == 0)) {return ((((r * (k - 1)) + r) - 1) <= n);} return ((((r * (k - 1)) + q) + r) <= n);} class InputReader{ public BufferedReader reader ; private String[] currentArray ; int curPointer ; public InputReader( InputStreamReader inputStreamReader){ reader = new BufferedReader(inputStreamReader); } public int nextInt(){ if ( ((currentArray == null) || (curPointer >= currentArray.length))) {try{currentArray = reader.readLine().split(" "); }catch (IOException e){ throw (new RuntimeException(e));} curPointer = 0; } return Integer.parseInt(currentArray[curPointer++]);} } }
4	public class E2_SquareFreeDivision2{ static FastScanner sc = new FastScanner(); static PrintWriter out = new PrintWriter(System.out); public static void main( String[] args){ int T = sc.nextInt();  int MAX = (int)1e7;  int[] canonical = new int[(MAX + 1)]; canonical[1] = 1; for ( int factor = 2;(factor <= MAX);factor++) {if ( (canonical[factor] == 0)) {for ( int mult = factor;(mult <= MAX);mult += factor) { int prev = canonical[(mult / factor)]; if ( ((prev % factor) == 0)) {canonical[mult] = (prev / factor); } else {canonical[mult] = (prev * factor); }}} } int[] freq = new int[(MAX + 1)]; while((T-- > 0)){ int N = sc.nextInt();  int K = sc.nextInt();  int[] a = new int[(N + 1)]; for ( int i = 1;(i <= N);i++) {a[i] = canonical[sc.nextInt()]; } int[][] transition = new int[(K + 1)][(N + 1)]; for ( int k = 0;(k <= K);k++) { int l = (N + 1);  int duplicates = 0; for ( int r = N;(r >= 1);r--) {while(((l - 1) >= 1)){ int nextDuplicates = duplicates; if ( (freq[a[(l - 1)]] >= 1)) {nextDuplicates++; } if ( (nextDuplicates <= k)) {duplicates = nextDuplicates; freq[a[(l - 1)]]++; l--; } else {break;}}transition[k][r] = l; if ( (--freq[a[r]] >= 1)) {duplicates--; } }} int[][] dp = new int[(K + 1)][(N + 1)];  int oo = (int)1e9; for ( int[] row :dp) {Arrays.fill(row,oo); }for ( int k = 0;(k <= K);k++) {dp[k][0] = 0; }for ( int r = 1;(r <= N);r++) {for ( int k = 0;(k <= K);k++) {for ( int delta = 0;(delta <= k);delta++) {dp[k][r] = min(dp[k][r],(dp[(k - delta)][(transition[delta][r] - 1)] + 1)); }}}out.println(dp[K][N]); }out.close(); } static class FastScanner{ private int BS = (1 << 16); private char NC = (char)0; private byte[] buf = new byte[BS]; private int bId = 0,size = 0; private char c = NC; private double cnt = 1; private BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } char getChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} int nextInt(){ return (int)nextLong();} long nextLong(){ cnt = 1; boolean neg = false; if ( (c == NC)) c = getChar(); for ( ;((c < '0') || (c > '9'));c = getChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = getChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); cnt *= 10; }return (neg?-res:res);} } }
0	public class cf{ static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner(){ try{br = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(br.readLine()); }catch (Exception e){ e.printStackTrace(); } } public String next(){ if ( st.hasMoreTokens()) return st.nextToken(); try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ e.printStackTrace(); } return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } public static void main( String[] args){ FastScanner sc = new FastScanner();  PrintWriter pw = new PrintWriter(System.out);  int n = sc.nextInt(); pw.println(((n / 2) + 1)); pw.close(); } }
5	public class A implements Runnable{ static BufferedReader in ; static PrintWriter out ; static StringTokenizer st ; static Random rnd ; void solve()throws IOException { int n = nextInt();  long k = nextLong(); if ( (k == 1)) {out.println(n); } else { TreeMap<Long,ArrayList<Integer>> numbers = new TreeMap<Long,ArrayList<Integer>>(); for ( int i = 0;(i < n);i++) { long m = nextLong();  int howMuch = 0; while(((m % k) == 0)){m /= k; ++howMuch; }if ( !numbers.containsKey(m)) {numbers.put(m,new ArrayList<Integer>()); } numbers.get(m).add(howMuch); } int res = 0; for ( ArrayList<Integer> oneGroup :numbers.values()) {res += parseOneGroup(oneGroup); }out.println(res); }} private int parseOneGroup( ArrayList<Integer> oneGroup){ Collections.sort(oneGroup); int res = 0,prevValue = Integer.MIN_VALUE; for ( int i = 0;(i < oneGroup.size());i++) { int curValue = oneGroup.get(i); if ( ((prevValue + 1) != curValue)) {++res; prevValue = curValue; } }return res;} public static void main( String[] args){ new A().run(); } public void run(){ try{in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); rnd = new Random(); solve(); out.close(); }catch (IOException e){ e.printStackTrace(); System.exit(42); } } String nextToken()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String line = in.readLine(); if ( (line == null)) return null; st = new StringTokenizer(line); }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} long nextLong()throws IOException { return Long.parseLong(nextToken());} }
0	public class Main{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(); if ( ((n % 2) == 0)) {System.out.println((((n - 4) + " ") + (n - (n - 4)))); } else {System.out.println((((n - 9) + " ") + (n - (n - 9)))); }} }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskD solver = new TaskD(); solver.solve(1,in,out); out.close(); } static class TaskD{ long maxk = (long)1e18; public void solve( int testNumber, InputReader in, OutputWriter out){ int t = in.nextInt();  long maxn = 1;  long val = 0; for ( long i = 1;;i++) {val = (1 + (4 * val)); if ( (val >= maxk)) {maxn = i; break;} } long[] vala = new long[((int)maxn + 1)]; vala[1] = 1; for ( int i = 2;(i <= maxn);i++) {vala[i] = (1 + (4 * vala[(i - 1)])); }o:while((t-- > 0)){ long n = in.nextInt();  long k = in.nextLong(); if ( ((n - 1) >= maxn)) {out.println(("YES " + (n - 1))); continue;} k--; if ( (k <= vala[((int)n - 1)])) {out.println(("YES " + (n - 1))); continue;} long cs = (n - 1);  long cc = 3;  int ind = 2;  long end = -1; while((k > 0)){if ( ((k >= cc) && (cs > 0))) {k -= cc; cc += (1l << ind); cs--; ind++; } else {end = ind; break;}} long fcs = cs; if ( (k == 0)) {out.println(("YES " + cs)); continue;} k -= vala[((int)n - 1)]; cs = (n - 1); cc = 3; ind = 2; long rv = 5;  long sind = 3; while(((k > 0) && (ind < end))){k -= (rv * vala[((int)cs - 1)]); rv += (1l << sind); sind++; cs--; ind++; }if ( (k <= 0)) {out.println(("YES " + fcs)); } else {out.println("NO"); }}} } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }} public void println( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputReader.SpaceCharFilter filter ; public InputReader( InputStream stream){ this.stream = stream; } public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} 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 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 boolean isSpaceChar( int c){ if ( (filter != null)) {return filter.isSpaceChar(c);} return isWhitespace(c);} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } }
0	public class TaskA1{ void run(){ int n = nextInt();  int ans = ((2 * n) - (n / 2)); System.out.println(ans); } int nextInt(){ try{ int c = System.in.read(); if ( (c == -1)) return c; while(((c != '-') && ((c < '0') || ('9' < c)))){c = System.in.read(); if ( (c == -1)) return c; }if ( (c == '-')) return -nextInt(); int res = 0; do {res *= 10; res += (c - '0'); c = System.in.read(); }while((('0' <= c) && (c <= '9')));return res; }catch (Exception e){ return -1;} } long nextLong(){ try{ int c = System.in.read(); if ( (c == -1)) return -1; while(((c != '-') && ((c < '0') || ('9' < c)))){c = System.in.read(); if ( (c == -1)) return -1; }if ( (c == '-')) return -nextLong(); long res = 0; do {res *= 10; res += (c - '0'); c = System.in.read(); }while((('0' <= c) && (c <= '9')));return res; }catch (Exception e){ return -1;} } String next(){ try{ StringBuilder res = new StringBuilder("");  int c = System.in.read(); while(Character.isWhitespace(c))c = System.in.read(); do {res.append((char)c); }while(!Character.isWhitespace(c = System.in.read()));return res.toString(); }catch (Exception e){ return null;} } public static void main( String[] args){ new TaskA1().run(); } }
0	public class TA{ public void solve( long n){ long a = 0,b = 0; if ( ((n % 2) == 0)) {if ( ((n % 4) == 0)) {a = (n / 2); b = (n / 2); } else {a = ((n / 2) - 1); b = ((n / 2) + 1); }} else {a = 4; b = (n - a); while(((b > 0) && ((b % 3) != 0))){a += 2; b = (n - a); }}System.out.println(((a + " ") + b)); } public static void main( String[] args){ FastScanner in = new FastScanner(); new TA().solve(in.nextLong()); } static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( String s){ try{br = new BufferedReader(new FileReader(s)); }catch (FileNotFoundException e){ 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){ e.printStackTrace(); } }return st.nextToken();} long nextLong(){ return Long.parseLong(nextToken());} } }
1	public class Solution{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  HashSet<Integer> set = new HashSet<>(); for ( int i = 0;(i < n);i++) { int a = sc.nextInt(); if ( (a != 0)) {set.add(a); } }System.out.println(set.size()); } }
0	public class Solution{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt(); out.print(((n / 2) + n)); out.close(); in.close(); } }
0	public class Main{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long n = in.nextLong(); if ( (n == 1)) System.out.println(1); else if ( (n == 2)) System.out.println(2); else if ( ((n % 2) == 0)) { int cnt = nPrime(n); if ( (cnt == 1)) System.out.println(((n * (n - 1)) * (n - 3))); else if ( (cnt > 1)) System.out.println((((n - 1) * (n - 2)) * (n - 3))); } else System.out.println(((n * (n - 1)) * (n - 2))); } public static int nPrime( long n){ int cnt = 1; if ( ((n % 3) == 0)) cnt++; return cnt;} }
0	public class A{ public static void main( String[] args)throws IOException { BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  String s = r.readLine();  int n = Integer.parseInt(s); System.out.println(((n * 3) / 2)); } }
6	public class CF1238E{ public static void main( String[] args)throws Exception { boolean local = (System.getSecurityManager() == null);  boolean async = false;  Charset charset = Charset.forName("ascii");  FastIO io = (local?new FastIO(new FileInputStream("D:\\DATABASE\\TESTCASE\\Code.in"),System.out,charset):new FastIO(System.in,System.out,charset));  Task task = new Task(io,new Debug(local)); if ( async) { Thread t = new Thread(null,task,"dalt",(1 << 27)); t.setPriority(Thread.MAX_PRIORITY); t.start(); t.join(); } else {task.run(); }if ( local) {io.cache.append((("\n\n--memory -- \n" + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20)) + "M")); } io.flush(); } public static class Task implements Runnable{ final FastIO io ; final Debug debug ; int inf = (int)1e8; long lInf = (long)1e18; double dInf = 1e50; public Task( FastIO io, Debug debug){ this.io = io; this.debug = debug; } @Override public void run(){ solve(); } int[][] fee ; int m ; long[] dp ; int mask ; int[][] maskFee ; public void solve(){ int n = io.readInt(); m = io.readInt(); char[] s = new char[n]; io.readString(s,0); for ( int i = 0;(i < n);i++) {s[i] -= 'a'; }fee = new int[m][m]; for ( int i = 1;(i < n);i++) {fee[s[i]][s[(i - 1)]]++; fee[s[(i - 1)]][s[i]]++; }mask = ((1 << m) - 1); maskFee = new int[m][(mask + 1)]; SubsetGenerator sg = new SubsetGenerator(); for ( int i = 0;(i < m);i++) {for ( int j = 0;(j < m);j++) {sg.meanings[j] = fee[i][j]; }for ( int j = 0;(j <= mask);j++) {maskFee[i][j] = sg.next(); }}dp = new long[(mask + 1)]; Arrays.fill(dp,-1); dp[0] = 0; io.cache.append(dp(mask)); } BitOperator bo = new BitOperator(); public long dp( int s){ if ( (dp[s] == -1)) { long extra = 0;  int remainSet = (mask - s); for ( int j = 0;(j < m);j++) {if ( (bo.bitAt(s,j) == 0)) {continue;} extra += maskFee[j][remainSet]; }dp[s] = lInf; for ( int j = 0;(j < m);j++) {if ( (bo.bitAt(s,j) == 0)) {continue;} int ss = bo.setBit(s,j,false); dp[s] = Math.min(dp[s],(extra + dp(ss))); }} return dp[s];} } public static class BitOperator{ public int bitAt( int x, int i){ return ((x >> i) & 1);} public int bitAt( long x, int i){ return (int)((x >> i) & 1);} public int setBit( int x, int i, boolean v){ if ( v) {x |= (1 << i); } else {x &= (1 << i); }return x;} public long setBit( long x, int i, boolean v){ if ( v) {x |= (1L << i); } else {x &= (1L << i); }return x;} public long intersect( long x, long y){ return (x & y);} } public static class SubsetGenerator{ private int[] meanings = new int[33]; private int[] bits = new int[33]; private int remain ; private int next ; private void consume(){ remain = (remain - 1); int i ; for ( i = 0;(bits[i] == 1);i++) {bits[i] = 0; next -= meanings[i]; }bits[i] = 1; next += meanings[i]; } public int next(){ int returned = next; consume(); return returned;} } public static class FastIO{ public final StringBuilder cache = new StringBuilder((1 << 13)); private final InputStream is ; private final OutputStream os ; private final Charset charset ; private StringBuilder defaultStringBuf = new StringBuilder((1 << 13)); private byte[] buf = new byte[(1 << 13)]; private int bufLen ; private int bufOffset ; private int next ; public FastIO( InputStream is, OutputStream os, Charset charset){ this.is = is; this.os = os; this.charset = charset; } public FastIO( InputStream is, OutputStream os){ this(is,os,Charset.forName("ascii")); } private int read(){ while((bufLen == bufOffset)){bufOffset = 0; try{bufLen = is.read(buf); }catch (IOException e){ throw (new RuntimeException(e));} if ( (bufLen == -1)) {return -1;} }return buf[bufOffset++];} public void skipBlank(){ while(((next >= 0) && (next <= 32))){next = read(); }} public int readInt(){ int sign = 1; skipBlank(); if ( ((next == '+') || (next == '-'))) {sign = ((next == '+')?1:-1); next = read(); } int val = 0; if ( (sign == 1)) {while(((next >= '0') && (next <= '9'))){val = (((val * 10) + next) - '0'); next = read(); }} else {while(((next >= '0') && (next <= '9'))){val = (((val * 10) - next) + '0'); next = read(); }}return val;} public String readString( StringBuilder builder){ skipBlank(); while((next > 32)){builder.append((char)next); next = read(); }return builder.toString();} public String readString(){ defaultStringBuf.setLength(0); return readString(defaultStringBuf);} public int readString( char[] data, int offset){ skipBlank(); int originalOffset = offset; while((next > 32)){data[offset++] = (char)next; next = read(); }return (offset - originalOffset);} public int readString( byte[] data, int offset){ skipBlank(); int originalOffset = offset; while((next > 32)){data[offset++] = (byte)next; next = read(); }return (offset - originalOffset);} public void flush()throws IOException { os.write(cache.toString().getBytes(charset)); os.flush(); cache.setLength(0); } } public static class Debug{ private boolean allowDebug ; public Debug( boolean allowDebug){ this.allowDebug = allowDebug; } public void fail(){ throw (new RuntimeException());} private void outputName( String name){ System.out.print((name + " = ")); } } }
6	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskE1 solver = new TaskE1();  int testCount = Integer.parseInt(in.next()); for ( int i = 1;(i <= testCount);i++) {solver.solve(i,in,out); }out.close(); } static class TaskE1{ public void solve( int testNumber, InputReader in, OutputWriter out){ int n = in.nextInt();  int m = in.nextInt();  int[][] d = new int[2][(1 << n)];  int[] buf = new int[(1 << n)];  int[][] a = new int[m][n]; for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < m);++j) {a[j][i] = in.nextInt(); }} ArrayList<Integer> inds = new ArrayList<>(); for ( int i = 0;(i < m);++i) {inds.add(i); } int[][] finalA = a; Collections.sort(inds,new Comparator<Integer>(){public int compare( Integer i1, Integer i2){ int val1 = 0,val2 = 0; for ( int i = 0;(i < n);++i) {if ( (finalA[i1][i] > val1)) {val1 = finalA[i1][i]; } }for ( int i = 0;(i < n);++i) {if ( (finalA[i2][i] > val2)) {val2 = finalA[i2][i]; } }return -Integer.compare(val1,val2);} }); int newM = Math.min(m,(n + 1));  int[][] na = new int[newM][]; for ( int i = 0;(i < newM);++i) { int ind = inds.get(i); na[i] = a[ind]; }m = newM; a = na; for ( int i = 0;(i < m);++i) { int[] prev = d[(i % 2)],nx = d[((i + 1) % 2)]; for ( int shift = 0;(shift < n);++shift) { int[] b = new int[n]; for ( int j = 0;(j < n);++j) {b[j] = a[i][((j + shift) % n)]; }System.arraycopy(prev,0,buf,0,prev.length); for ( int j = 0;(j < n);++j) { int inc = b[j]; for ( int mask = 0;(mask < (1 << n));++mask) {if ( (((mask >> j) % 2) == 0)) { int val = (buf[mask] + inc);  int nm = (mask ^ (1 << j)); if ( (val > buf[nm])) {buf[nm] = val; } } }}for ( int mask = 0;(mask < (1 << n));++mask) {if ( (nx[mask] < buf[mask])) {nx[mask] = buf[mask]; } }}}out.printLine(d[(m % 2)][((1 << n) - 1)]); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } } static class InputReader{ private InputStream stream ; private byte[] buffer = new byte[10000]; private int cur ; private int count ; public InputReader( InputStream stream){ this.stream = stream; } public static boolean isSpace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public int read(){ if ( (count == -1)) {throw (new InputMismatchException());} try{if ( (cur >= count)) {cur = 0; count = stream.read(buffer); if ( (count <= 0)) {return -1;} } }catch (IOException e){ throw (new InputMismatchException());} return buffer[cur++];} public int readSkipSpace(){ int c ; do {c = read(); }while(isSpace(c));return c;} public String nextToken(){ int c = readSkipSpace();  StringBuilder sb = new StringBuilder(); while(!isSpace(c)){sb.append((char)c); c = read(); }return sb.toString();} public String next(){ return nextToken();} public int nextInt(){ int sgn = 1;  int c = readSkipSpace(); if ( (c == '-')) {sgn = -1; c = read(); } int res = 0; do {if ( ((c < '0') || (c > '9'))) {throw (new InputMismatchException());} res = (((res * 10) + c) - '0'); c = read(); }while(!isSpace(c));res *= sgn; return res;} } }
6	public class P111C{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); double EPS = 1e-9; int h ,w ; void run(){ h = sc.nextInt(); w = sc.nextInt(); solve(); } void solve(){ n = (w * h); g = new long[n]; int[] dx = {0,0,-1,1};  int[] dy = {-1,1,0,0}; for ( int y = 0;(y < h);y++) {for ( int x = 0;(x < w);x++) {for ( int k = 0;(k < 4);k++) { int x2 = (x + dx[k]);  int y2 = (y + dy[k]); if ( ((((x2 >= 0) && (x2 < w)) && (y2 >= 0)) && (y2 < h))) {g[((y * w) + x)] |= (1L << ((y2 * w) + x2)); } }}}mds = ((1L << n) - 1); mds(0,0,0); println(((n - Long.bitCount(mds)) + "")); } int n ; long[] g ; long mds ; void mds( long choosed, long removed, long covered){ if ( (Long.bitCount(choosed) >= Long.bitCount(mds))) return ; if ( (covered == ((1L << n) - 1))) {mds = choosed; return ;} long s = covered; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); s |= ((1L << i) | g[i]); }if ( (s != ((1L << n) - 1))) return ; int k = -1; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); if ( (((covered >>> i) & 1) == 1)) {if ( (Long.bitCount((g[i] & ~covered)) == 0)) {mds(choosed,(removed | (1L << i)),covered); return ;} else if ( ((Long.bitCount((g[i] & ~covered)) == 1) && (((g[i] & ~covered) & ~removed) != 0))) {mds(choosed,(removed | (1L << i)),covered); return ;} } else {if ( (Long.bitCount((g[i] & ~removed)) == 0)) {mds((choosed | (1L << i)),(removed | (1L << i)),((covered | (1L << i)) | g[i])); return ;} else if ( ((Long.bitCount((g[i] & ~removed)) == 1) && (((g[i] & ~removed) | (g[i] & ~covered)) == (g[i] & ~removed)))) { int j = Long.numberOfTrailingZeros((g[i] & ~removed)); mds((choosed | (1L << j)),((removed | (1L << i)) | (1L << j)),((covered | (1L << j)) | g[j])); return ;} }if ( ((k == -1) || (Long.bitCount((g[i] & ~covered)) > Long.bitCount((g[k] & ~covered))))) k = i; }if ( (k == -1)) return ; mds((choosed | (1L << k)),(removed | (1L << k)),((covered | (1L << k)) | g[k])); mds(choosed,(removed | (1L << k)),covered); } void println( String s){ System.out.println(s); } public static void main( String[] args){ Locale.setDefault(Locale.US); new P111C().run(); } }
2	public class CFDiv1{ FastScanner in ; PrintWriter out ; boolean canBe( int from, long curVal, long l, long r){ if ( (curVal > r)) return false; for ( int i = 0;(i <= from);i++) curVal += (1L << i); if ( (curVal >= l)) return true; return false;} long solve2( long l, long r){ long min = 0;  long max = 0; for ( int i = 62;(i >= 0);i--) { boolean max0 = canBe((i - 1),max,l,r);  boolean max1 = canBe((i - 1),(max | (1L << i)),l,r);  boolean min0 = canBe((i - 1),min,l,r);  boolean min1 = canBe((i - 1),(min | (1L << i)),l,r); if ( ((max0 && min1) && (max > min))) {min = (min | (1L << i)); } else {if ( (max1 && min0)) {max |= (1L << i); } else {if ( (max1 && min1)) {max |= (1L << i); min |= (1L << i); } else {}}}}return (min ^ max);} void solve(){ out.println(solve2(in.nextLong(),in.nextLong())); } void runIO(){ in = new FastScanner(System.in); out = new PrintWriter(System.out); solve(); out.close(); } class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( File f){ try{br = new BufferedReader(new FileReader(f)); }catch (FileNotFoundException e){ e.printStackTrace(); } } public FastScanner( InputStream f){ br = new BufferedReader(new InputStreamReader(f)); } String next(){ while(((st == null) || !st.hasMoreTokens())){ String s = null; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } if ( (s == null)) return null; st = new StringTokenizer(s); }return st.nextToken();} boolean hasMoreTokens(){ while(((st == null) || !st.hasMoreTokens())){ String s = null; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } if ( (s == null)) return false; st = new StringTokenizer(s); }return true;} long nextLong(){ return Long.parseLong(next());} } public static void main( String[] args){ new CFDiv1().runIO(); } }
5	public class A{ public static void main( String[] args)throws Exception { new A().solve(); } void solve()throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String[] sp ; sp = in.readLine().split(" "); int n = Integer.parseInt(sp[0]);  long k = Integer.parseInt(sp[1]);  Long[] a = new Long[n]; sp = in.readLine().split(" "); for ( int i = 0;(i < n);i++) {a[i] = (long)Integer.parseInt(sp[i]); }Arrays.sort(a); TreeSet<Long> set = new TreeSet<Long>(); for ( int i = 0;(i < n);i++) { long x = a[i]; if ( !set.contains(x)) {set.add((x * k)); } }System.out.println(set.size()); } }
4	public class E2{ InputStream is ; FastWriter out ; String INPUT = ""; public static int[][] enumFIF( int n, int mod){ int[] f = new int[(n + 1)];  int[] invf = new int[(n + 1)]; f[0] = 1; for ( int i = 1;(i <= n);i++) {f[i] = (int)(((long)f[(i - 1)] * i) % mod); } long a = f[n];  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)); }invf[n] = (int)((p < 0)?(p + mod):p); for ( int i = (n - 1);(i >= 0);i--) {invf[i] = (int)(((long)invf[(i + 1)] * (i + 1)) % mod); }return new int[][]{f,invf};} public static long[] enumPows( int a, int n, int mod){ a %= mod; long[] pows = new long[(n + 1)]; pows[0] = 1; for ( int i = 1;(i <= n);i++) pows[i] = ((pows[(i - 1)] * a) % mod); return pows;} void solve(){ int N = ni(); final int mod = ni();  long[] p2 = enumPows(2,1000,mod);  int[][] fif = enumFIF(1000,mod);  long[][] dp = new long[(N + 2)][(N + 1)]; dp[0][0] = 1; for ( int i = 0;(i <= (N + 1));i++) {for ( int j = 0;(j <= N);j++) {for ( int k = 1;((((i + k) + 1) <= (N + 1)) && ((j + k) <= N));k++) {dp[((i + k) + 1)][(j + k)] += (((dp[i][j] * fif[1][k]) % mod) * p2[(k - 1)]); dp[((i + k) + 1)][(j + k)] %= mod; }}} long ans = 0; for ( int i = 1;(i <= N);i++) {ans += (dp[(N + 1)][i] * fif[0][i]); ans %= mod; }out.println(ans); } void run()throws Exception { is = (oj?System.in:new ByteArrayInputStream(INPUT.getBytes())); out = new FastWriter(System.out); long s = System.currentTimeMillis(); solve(); out.flush(); tr(((System.currentTimeMillis() - s) + "ms")); } public static void main( String[] args)throws Exception { new E2().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 int[] na( int n){ int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = ni(); return a;} private int ni(){ return (int)nl();} 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(); }} public static class FastWriter{ static private final int BUF_SIZE = (1 << 13); private final byte[] buf = new byte[BUF_SIZE]; private final OutputStream out ; private int ptr = 0; private FastWriter(){ out = null; } public FastWriter( OutputStream os){ this.out = os; } public FastWriter( String path){ try{this.out = new FileOutputStream(path); }catch (FileNotFoundException e){ throw (new RuntimeException("FastWriter"));} } public FastWriter write( byte b){ buf[ptr++] = b; if ( (ptr == BUF_SIZE)) innerflush(); return this;} public FastWriter write( char c){ return write((byte)c);} public FastWriter write( char[] s){ for ( char c :s) {buf[ptr++] = (byte)c; if ( (ptr == BUF_SIZE)) innerflush(); }return this;} public FastWriter write( String s){ s.chars().forEach((c)->{buf[ptr++] = (byte)c; if ( (ptr == BUF_SIZE)) innerflush(); }); return this;} static private int countDigits( int l){ if ( (l >= 1000000000)) return 10; if ( (l >= 100000000)) return 9; if ( (l >= 10000000)) return 8; if ( (l >= 1000000)) return 7; if ( (l >= 100000)) return 6; if ( (l >= 10000)) return 5; if ( (l >= 1000)) return 4; if ( (l >= 100)) return 3; if ( (l >= 10)) return 2; return 1;} public FastWriter write( int x){ if ( (x == Integer.MIN_VALUE)) {return write((long)x);} if ( ((ptr + 12) >= BUF_SIZE)) innerflush(); if ( (x < 0)) {write((byte)'-'); x = -x; } int d = countDigits(x); for ( int i = ((ptr + d) - 1);(i >= ptr);i--) {buf[i] = (byte)('0' + (x % 10)); x /= 10; }ptr += d; return this;} static private int countDigits( long l){ if ( (l >= 1000000000000000000L)) return 19; if ( (l >= 100000000000000000L)) return 18; if ( (l >= 10000000000000000L)) return 17; if ( (l >= 1000000000000000L)) return 16; if ( (l >= 100000000000000L)) return 15; if ( (l >= 10000000000000L)) return 14; if ( (l >= 1000000000000L)) return 13; if ( (l >= 100000000000L)) return 12; if ( (l >= 10000000000L)) return 11; if ( (l >= 1000000000L)) return 10; if ( (l >= 100000000L)) return 9; if ( (l >= 10000000L)) return 8; if ( (l >= 1000000L)) return 7; if ( (l >= 100000L)) return 6; if ( (l >= 10000L)) return 5; if ( (l >= 1000L)) return 4; if ( (l >= 100L)) return 3; if ( (l >= 10L)) return 2; return 1;} public FastWriter write( long x){ if ( (x == Long.MIN_VALUE)) {return write(("" + x));} if ( ((ptr + 21) >= BUF_SIZE)) innerflush(); if ( (x < 0)) {write((byte)'-'); x = -x; } int d = countDigits(x); for ( int i = ((ptr + d) - 1);(i >= ptr);i--) {buf[i] = (byte)('0' + (x % 10)); x /= 10; }ptr += d; return this;} public FastWriter write( double x, int precision){ if ( (x < 0)) {write('-'); x = -x; } x += (Math.pow(10,-precision) / 2); write((long)x).write("."); x -= (long)x; for ( int i = 0;(i < precision);i++) {x *= 10; write((char)('0' + (int)x)); x -= (int)x; }return this;} public FastWriter writeln( char c){ return write(c).writeln();} public FastWriter writeln( int x){ return write(x).writeln();} public FastWriter writeln( long x){ return write(x).writeln();} public FastWriter writeln( double x, int precision){ return write(x,precision).writeln();} public FastWriter write( int... xs){ boolean first = true; for ( int x :xs) {if ( !first) write(' '); first = false; write(x); }return this;} public FastWriter write( long... xs){ boolean first = true; for ( long x :xs) {if ( !first) write(' '); first = false; write(x); }return this;} public FastWriter writeln(){ return write((byte)'\n');} public FastWriter writeln( int... xs){ return write(xs).writeln();} public FastWriter writeln( long... xs){ return write(xs).writeln();} public FastWriter writeln( char[] line){ return write(line).writeln();} public FastWriter writeln( char[]... map){ for ( char[] line :map) write(line).writeln(); return this;} public FastWriter writeln( String s){ return write(s).writeln();} private void innerflush(){ try{out.write(buf,0,ptr); ptr = 0; }catch (IOException e){ throw (new RuntimeException("innerflush"));} } public void flush(){ innerflush(); try{out.flush(); }catch (IOException e){ throw (new RuntimeException("flush"));} } public FastWriter print( byte b){ return write(b);} public FastWriter print( char c){ return write(c);} public FastWriter print( char[] s){ return write(s);} public FastWriter print( String s){ return write(s);} public FastWriter print( int x){ return write(x);} public FastWriter print( long x){ return write(x);} public FastWriter print( double x, int precision){ return write(x,precision);} public FastWriter println( char c){ return writeln(c);} public FastWriter println( int x){ return writeln(x);} public FastWriter println( long x){ return writeln(x);} public FastWriter println( double x, int precision){ return writeln(x,precision);} public FastWriter print( int... xs){ return write(xs);} public FastWriter print( long... xs){ return write(xs);} public FastWriter println( int... xs){ return writeln(xs);} public FastWriter println( long... xs){ return writeln(xs);} public FastWriter println( char[] line){ return writeln(line);} public FastWriter println( char[]... map){ return writeln(map);} public FastWriter println( String s){ return writeln(s);} public FastWriter println(){ return writeln();} } private boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
0	public class SolutionB{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  int a[] = new int[1501]; for ( int i = 0;(i < 3);i++) {a[sc.nextInt()]++; }if ( ((((a[1] > 0) || (a[2] > 1)) || (a[3] > 2)) || ((a[4] == 2) && (a[2] == 1)))) {System.out.println("YES"); } else {System.out.println("NO"); }} }
1	public class C{ public static int mod = (1000000000 + 7); public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String n = br.readLine();  int k = Integer.parseInt(br.readLine());  int l = n.length(); if ( (k == 0)) {System.out.println(1); } else { int max = 1000; if ( (l <= 10)) {max = Integer.min(1000,Integer.parseInt(n,2)); } int[] steps = new int[(max + 1)]; for ( int i = 2;(i <= max);i++) { int ones = numberOfOnes(i); steps[i] = (1 + steps[ones]); }if ( (l <= 10)) { int ans = 0; for ( int i = 1;(i <= max);i++) {if ( (steps[i] == k)) {ans++; } }System.out.println(ans); } else { int[][] C = binomial(max);  int ans = 0;  int count = 0; for ( int i = 0;(i < l);i++) {if ( (n.charAt(i) == '1')) {for ( int j = count;(j < max);j++) {if ( (steps[j] == (k - 1))) {ans = ((ans + C[((l - i) - 1)][(j - count)]) % mod); if ( ((i == 0) && (k == 1))) {ans = (((ans + mod) - 1) % mod); } } }count++; } } int ones = 0; for ( int i = 0;(i < l);i++) {if ( (n.charAt(i) == '1')) {ones++; } }if ( (steps[ones] == (k - 1))) {ans = ((ans + 1) % mod); } System.out.println(ans); }}} public static int numberOfOnes( int x){ char[] s = Integer.toBinaryString(x).toCharArray();  int count = 0; for ( char c :s) {if ( (c == '1')) {count++; } }return count;} public static int[][] binomial( int n){ int[][] C = new int[(n + 1)][(n + 1)]; for ( int i = 0;(i <= n);i++) {C[i][0] = 1; for ( int j = 1;(j <= i);j++) {C[i][j] = (((C[(i - 1)][(j - 1)] % mod) + (C[(i - 1)][j] % mod)) % mod); }}return C;} }
0	public class ProblemA{ public static void main( String[] args)throws NumberFormatException,IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  int num1 ,num2 ; if ( ((n % 2) == 0)) {num1 = (n / 2); if ( ((num1 % 2) == 0)) {num2 = num1; } else {num1--; num2 = (num1 + 2); }} else {num1 = 9; num2 = (n - num1); }System.out.println(((num1 + " ") + num2)); } }
2	public class answertillD{ static ArrayList<Integer>[] adjlist ; static int[][] adjmatrix ; static int[][] adjmatrix2 ; static boolean[] vis ; static boolean[] intialvis ; static boolean[] vis2 ; static int[] counter ; static int V ,E ; static Stack<Integer> st ; static ArrayList<Integer> arrylist ; static boolean flag ; static int[] dx = new int[]{1,-1,0,0}; static int[] dy = new int[]{0,0,1,-1}; static int[] Arr ; static PrintWriter pw ; public static long gcd( long u, long v){ if ( (u == 0)) return v; return gcd((v % u),u);} public static int dfs( int u){ vis[u] = true; int a = 0; for ( int v :adjlist[u]) if ( !vis[v]) a += dfs(v); return (1 + a);} public static void dfs( int u, int num){ vis2[u] = true; counter[u] = num; for ( int v :adjlist[u]) if ( !vis2[v]) dfs(v,num); } static long diff = Long.MAX_VALUE; static boolean check( long num, long k){ int n = ((num + "") - 1);  long m = 1;  long sum = 0;  int i = 1; while((n-- > 0)){sum += ((9 * m) * i); m *= 10; }sum += (((num - m) * i) + 1); if ( (sum <= k)) diff = Math.min(diff,(k - sum)); return (sum <= k);} static long bin( long k){ long left = 1;  long right = (k + 1);  long mid ;  long ans = 1; while((left <= right)){mid = ((left + right) / 2); if ( check(mid,k)) {ans = mid; left = (mid + 1); } else right = (mid - 1); }return ans;} static int m ; static int calculate( int[] Arrs, int[] Arre, int index, boolean left, boolean targetleft){ int ans = 0;  int n = (m + 2); if ( left) {ans = Arre[(index - 1)]; if ( (index != (E + 1))) ans += (targetleft?Arre[(index - 1)]:((n - Arre[(index - 1)]) - 1)); } else {ans = ((n - Arrs[(index - 1)]) - 1); if ( (index != (E + 1))) ans += (targetleft?Arrs[(index - 1)]:((n - Arrs[(index - 1)]) - 1)); }return ans;} static int min = Integer.MAX_VALUE; static void backtrack( int[] Arrs, int[] Arre, int soFarMin, int index, boolean left){ if ( (index == E)) {min = Math.min(min,(soFarMin - 1)); return ;} int newmin1 = calculate(Arrs,Arre,index,left,left);  int newmin2 = calculate(Arrs,Arre,index,left,!left); backtrack(Arrs,Arre,((soFarMin + newmin1) + 1),(index - 1),left); backtrack(Arrs,Arre,((soFarMin + newmin2) + 1),(index - 1),!left); } public static String add( String str1, String str2){ Stack<String> st = new Stack<String>();  int n = str1.length();  int m = str2.length();  int max = Math.max(n,m);  int sum = 0,carry = 0; for ( int i = 0;(i < max);i++) { int num1 = 0,num2 = 0; if ( (n >= i)) num1 = Integer.parseInt((str1.charAt((n - i)) + "")); if ( (m >= i)) num2 = Integer.parseInt((str2.charAt((m - i)) + ""));  int z = ((num1 + num2) + carry); if ( (z >= 10)) {sum = (z / 10); carry = (z % 10); } else {sum = z; carry = 0; }st.add((sum + "")); } StringBuilder sb = new StringBuilder(); while(!st.isEmpty()){sb.append(st.pop()); }return (sb + "");} public static void main( String[] args)throws IOException,InterruptedException { Scanner sc = new Scanner(System.in);  long k = sc.nextLong();  long bi = bin(k);  String str = (bi + ""); System.out.println(str.charAt((int)diff)); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public long nextLong()throws IOException { return Long.parseLong(next());} public boolean ready()throws IOException { return br.ready();} } }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  ScanReader in = new ScanReader(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, ScanReader in, PrintWriter out){ int n = in.scanInt();  int r = in.scanInt(),temp ;  double max1 ;  double high[] = new double[1002]; for ( int i = 0;(i < n);i++) {temp = in.scanInt(); max1 = (high[temp] + ((high[temp] == 0)?r:(2 * r))); for ( int j = (temp - 1);((j > (temp - (2 * r))) && (j > 0));j--) {if ( (high[j] == 0)) continue; max1 = Math.max(max1,(high[j] + Math.sqrt((((4 * r) * r) - ((temp - j) * (temp - j)))))); }for ( int j = (temp + 1);((j <= 1000) && (j < (temp + (2 * r))));j++) {if ( (high[j] == 0)) continue; max1 = Math.max(max1,(high[j] + Math.sqrt((((4d * r) * r) - ((j - temp) * (j - temp)))))); }if ( ((temp - (2 * r)) > 0)) max1 = Math.max(high[(temp - (2 * r))],max1); if ( ((temp + (2 * r)) <= 1000)) max1 = Math.max(high[(temp + (2 * r))],max1); high[temp] = max1; out.print((max1 + " ")); }} } static class ScanReader{ private byte[] buf = new byte[(4 * 1024)]; private int index ; private BufferedInputStream in ; private int total ; public ScanReader( InputStream inputStream){ in = new BufferedInputStream(inputStream); } private int scan(){ if ( (index >= total)) {index = 0; try{total = in.read(buf); }catch (Exception e){ e.printStackTrace(); } if ( (total <= 0)) return -1; } return buf[index++];} public int scanInt(){ int integer = 0;  int n = scan(); while(isWhiteSpace(n))n = scan(); int neg = 1; if ( (n == '-')) {neg = -1; n = scan(); } while(!isWhiteSpace(n)){if ( ((n >= '0') && (n <= '9'))) {integer *= 10; integer += (n - '0'); n = scan(); } }return (neg * integer);} private boolean isWhiteSpace( int n){ if ( (((((n == ' ') || (n == '\n')) || (n == '\r')) || (n == '\t')) || (n == -1))) return true; else return false;} } }
2	public class digitSequence{ static void MainSolution(){ long k = (nl() - 1); for ( int i = 1;;i++) { long temp = ((9L * i) * fastPow(10,(i - 1))); if ( (k < temp)) { long x = (k / i);  long y = (k % i);  long ans = ((x + fastPow(10,(i - 1))) / fastPow(10,((i - y) - 1))); pl((ans % 10)); break;} k -= temp; }} static long fastPow( long b, long e){ if ( (e == 0)) return 1; if ( ((e & 1) == 1)) return ((b * fastPow(b,(e >> 1))) * fastPow(b,(e >> 1))); return (fastPow(b,(e >> 1)) * fastPow(b,(e >> 1)));} static int mod9 = 1_000_000_007; static int n ,m ,l ,k ,t ; static AwesomeInput input = new AwesomeInput(System.in); static PrintWriter pw = new PrintWriter(System.out,true); static class AwesomeInput{ private InputStream letsDoIT ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private SpaceCharFilter filter ; private AwesomeInput( InputStream incoming){ this.letsDoIT = incoming; } public int read(){ if ( (numChars == -1)) throw (new InputMismatchException()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = letsDoIT.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} private long ForLong(){ 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);} private String ForString(){ 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 interface SpaceCharFilter{ boolean isSpaceChar( int ch); } } static long nl(){ return input.ForLong();} static void pl(){ pw.println(); } static void pl( Object o){ pw.println(o); } public static void main( String[] args){ new Thread(null,null,"Vengeance",(1 << 25)){}.start(); } }
4	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(); } } class TaskD{ ArrayList<Integer>[] g ; int n ,m ; boolean[][] have ; int[] x ; int[] y ; boolean[] used ; int stop ; public void solve( int testNumber, FastScanner in, PrintWriter out){ n = in.nextInt(); g = new ArrayList[n]; for ( int i = 0;(i < n);i++) g[i] = new ArrayList<>(); have = new boolean[n][n]; m = in.nextInt(); for ( int i = 0;(i < m);i++) { int a = in.nextInt();  int b = in.nextInt(); --a; --b; g[a].add(b); have[a][b] = true; } int res = Integer.MAX_VALUE; for ( int center = 0;(center < n);center++) res = Math.min(res,solve(center)); out.print(res); } int solve( int v){ stop = v; int withV = 0;  int add = 0; for ( int i = 0;(i < n);i++) if ( (i != v)) if ( have[v][i]) withV++; else add++; for ( int i = 0;(i < n);i++) if ( (i != v)) if ( have[i][v]) withV++; else add++; if ( have[v][v]) withV++; else add++; x = new int[n]; y = new int[n]; used = new boolean[n]; Arrays.fill(x,-1); Arrays.fill(y,-1); int matched = 0; for ( int i = 0;(i < n);i++) if ( ((i != v) && (x[i] == -1))) {Arrays.fill(used,false); if ( dfs(i)) matched++; } add += ((n - 1) - matched); add += ((m - withV) - matched); return add;} boolean dfs( int v){ if ( used[v]) return false; used[v] = true; for ( int to :g[v]) if ( ((to != stop) && (y[to] == -1))) {x[v] = to; y[to] = v; return true;} for ( int to :g[v]) if ( ((to != stop) && dfs(y[to]))) {x[v] = to; y[to] = v; return true;} return false;} } class FastScanner{ BufferedReader reader ; StringTokenizer tokenizer ; public FastScanner( InputStream inputStream){ reader = new BufferedReader(new InputStreamReader(inputStream)); } public String nextToken(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){ String line ; try{line = reader.readLine(); }catch (IOException e){ return null;} tokenizer = new StringTokenizer(line); }return tokenizer.nextToken();} public int nextInt(){ return Integer.parseInt(nextToken());} }
2	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);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ private int n ; private InputReader in ; private PrintWriter out ; public void solve( int testNumber, InputReader in, PrintWriter out){ n = in.nextInt(); this.in = in; this.out = out; query(new Point(1,1),new Point(n,n),new Rectangle()); } private boolean query( Point bottomLeft, Point topRight, Rectangle rectangle){ if ( ((bottomLeft.r > topRight.r) || (bottomLeft.c > topRight.c))) return false; int low = bottomLeft.c,high = topRight.c; while((low < high)){ int mid = (low + ((high - low) / 2));  int answer = ask(bottomLeft.r,bottomLeft.c,topRight.r,mid); if ( (answer > 0)) high = mid; else low = (mid + 1); } int rightCol = low; low = bottomLeft.c; high = topRight.c; while((low < high)){ int mid = (low + (((high - low) + 1) / 2));  int answer = ask(bottomLeft.r,mid,topRight.r,topRight.c); if ( (answer > 0)) low = mid; else high = (mid - 1); } int leftCol = low; low = bottomLeft.r; high = topRight.r; while((low < high)){ int mid = (low + ((high - low) / 2));  int answer = ask(bottomLeft.r,bottomLeft.c,mid,topRight.c); if ( (answer > 0)) high = mid; else low = (mid + 1); } int topRow = low; low = bottomLeft.r; high = topRight.r; while((low < high)){ int mid = (low + (((high - low) + 1) / 2));  int answer = ask(mid,bottomLeft.c,topRight.r,topRight.c); if ( (answer > 0)) low = mid; else high = (mid - 1); } int bottomRow = low; if ( (leftCol > rightCol)) { Rectangle first = new Rectangle(); query(new Point(1,leftCol),new Point(n,n),first); Rectangle second = new Rectangle(); query(new Point(1,1),new Point(n,rightCol),second); out.printf("! %d %d %d %d %d %d %d %d\n",first.bottomLeft.r,first.bottomLeft.c,first.topRight.r,first.topRight.c,second.bottomLeft.r,second.bottomLeft.c,second.topRight.r,second.topRight.c); return true;} if ( (bottomRow > topRow)) { Rectangle first = new Rectangle(); query(new Point(bottomRow,1),new Point(n,n),first); Rectangle second = new Rectangle(); query(new Point(1,1),new Point(topRow,n),second); out.printf("! %d %d %d %d %d %d %d %d\n",first.bottomLeft.r,first.bottomLeft.c,first.topRight.r,first.topRight.c,second.bottomLeft.r,second.bottomLeft.c,second.topRight.r,second.topRight.c); return true;} rectangle.bottomLeft.r = bottomRow; rectangle.bottomLeft.c = leftCol; rectangle.topRight.r = topRow; rectangle.topRight.c = rightCol; return true;} private int ask( int r1, int c1, int r2, int c2){ out.printf("? %d %d %d %d\n",r1,c1,r2,c2); out.flush(); return in.nextInt();} private class Point{ private int r ; private int c ; public Point( int r, int c){ this.r = r; this.c = c; } } private class Rectangle{ private Point bottomLeft ; private Point topRight ; public Rectangle(){ bottomLeft = new Point(-1,-1); topRight = new Point(-1,-1); } } } static class InputReader{ private BufferedReader reader ; private StringTokenizer tokenizer ; static private final int BUFFER_SIZE = 32768; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream),BUFFER_SIZE); 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());} } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ int n ; public void solve( int testNumber, InputReader in, OutputWriter out){ n = in.nextInt(); int base = calc(in,out,0); if ( (base == 0)) {out.printLine("! 1"); out.flush(); return ;} if ( ((Math.abs(base) % 2) != 0)) {out.printLine("! -1"); out.flush(); return ;} int down = 0,up = (n / 2);  int sdown = ((base < 0)?-1:1);  int sup = ((up < 0)?-1:1); while(((up - down) > 1)){ int t = ((up + down) / 2);  int cur = calc(in,out,t); if ( (cur == 0)) {out.printLine(("! " + (t + 1))); out.flush(); return ;} int scur = ((cur < 0)?-1:1); if ( (scur == sdown)) {down = t; } else {up = t; }}throw (new RuntimeException());} private int calc( InputReader in, OutputWriter out, int val){ out.printLine(("? " + (val + 1))); out.flush(); int res1 = in.nextInt(); out.printLine(("? " + (((val + (n / 2)) % n) + 1))); out.flush(); int res2 = in.nextInt(); return (res1 - res2);} } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } public void flush(){ writer.flush(); } } static class InputReader{ private InputStream stream ; private byte[] buffer = new byte[10000]; private int cur ; private int count ; public InputReader( InputStream stream){ this.stream = stream; } public static boolean isSpace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public int read(){ if ( (count == -1)) {throw (new InputMismatchException());} try{if ( (cur >= count)) {cur = 0; count = stream.read(buffer); if ( (count <= 0)) {return -1;} } }catch (IOException e){ throw (new InputMismatchException());} return buffer[cur++];} public int readSkipSpace(){ int c ; do {c = read(); }while(isSpace(c));return c;} public int nextInt(){ int sgn = 1;  int c = readSkipSpace(); if ( (c == '-')) {sgn = -1; c = read(); } int res = 0; do {if ( ((c < '0') || (c > '9'))) {throw (new InputMismatchException());} res = (((res * 10) + c) - '0'); c = read(); }while(!isSpace(c));res *= sgn; return res;} } }
0	public class Main{ public static long GCF( long a, long b){ if ( (b == 0)) return a; else return GCF(b,(a % b));} public static long LCM( long a, long b){ return ((a * b) / GCF(a,b));} public static void main( String[] args){ Scanner scan = new Scanner(System.in);  int n = scan.nextInt(); if ( (n < 3)) System.out.println(n); else { long t1 = LCM(n,(n - 1));  long t2 = LCM((n - 2),(n - 3));  long l1 = LCM(t1,(n - 2));  long l2 = LCM(t1,(n - 3));  long l3 = LCM(n,t2);  long l4 = LCM((n - 1),t2); System.out.println(Math.max(l1,Math.max(l2,Math.max(l3,l4)))); }} }
6	public class B implements Runnable{ String file = "input"; boolean TEST = false; double EPS = 1e-8; void solve()throws IOException { int n = nextInt(),k = nextInt(),A = nextInt();  int[] level = new int[n];  int[] loyal = new int[n]; for ( int i = 0;(i < n);i++) {level[i] = nextInt(); loyal[i] = nextInt(); } double res = 0; for ( int mask = 0;(mask < (1 << ((n + k) - 1)));mask++) {if ( (Integer.bitCount(mask) != k)) continue; int[] L = new int[n];  int x = mask; for ( int i = 0;(i < n);i++) {L[i] = loyal[i]; while(((x % 2) == 1)){L[i] += 10; x /= 2; }L[i] = min(L[i],100); x /= 2; } double tmp = 0; for ( int w = 0;(w < (1 << n));w++) { double p = 1.;  double B = 0; for ( int i = 0;(i < n);i++) if ( (((w >> i) & 1) != 0)) p *= (L[i] / 100.); else {p *= ((100 - L[i]) / 100.); B += level[i]; }if ( ((Integer.bitCount(w) * 2) > n)) tmp += p; else tmp += (p * (A / (A + B))); }res = max(res,tmp); }out.printf("%.8f\n",res); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(input.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} BufferedReader input ; PrintWriter out ; StringTokenizer st ; int test ; void init()throws IOException { if ( TEST) input = new BufferedReader(new FileReader((file + ".in"))); else input = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(new BufferedOutputStream(System.out)); } public static void main( String[] args)throws IOException { new Thread(null,new B(),"",(1 << 20)).start(); } }
6	public class x1242C2{ public static void main( String[] hi)throws Exception { BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(infile.readLine());  int N = Integer.parseInt(st.nextToken());  long[] sums = new long[N];  ArrayList<Integer>[] boxes = new ArrayList[N]; for ( int i = 0;(i < N);i++) {boxes[i] = new ArrayList<Integer>(); st = new StringTokenizer(infile.readLine()); int a = Integer.parseInt(st.nextToken()); while((a-- > 0))boxes[i].add(Integer.parseInt(st.nextToken())); for ( int x :boxes[i]) sums[i] += x; } long lmaosum = 0L; for ( long x :sums) lmaosum += x; if ( ((Math.abs(lmaosum) % N) != 0)) {System.out.println("No"); return ;} long target = (lmaosum / N);  HashMap<Long,Integer> map = new HashMap<Long,Integer>(); for ( int k = 0;(k < N);k++) for ( int x :boxes[k]) map.put((long)x,k); HashMap<Long,Long> edges = new HashMap<Long,Long>(); for ( int k = 0;(k < N);k++) for ( int x :boxes[k]) { long nextval = ((target - sums[k]) + x); if ( map.containsKey(nextval)) edges.put((long)x,nextval); } Node[] dp = new Node[(1 << N)]; dp[0] = new Node(-69,-69,0); Node[] subsets = new Node[(1 << N)]; for ( int b = 0;(b < N);b++) for ( int i = 0;(i < boxes[b].size());i++) {if ( !edges.containsKey((long)boxes[b].get(i))) continue; long curr = edges.get((long)boxes[b].get(i));  int submask = 0;  boolean cyclic = true; while((curr != boxes[b].get(i))){ int k = map.get(curr); if ( (((submask & (1 << k)) > 0) || !edges.containsKey((long)curr))) {cyclic = false; break;} submask |= (1 << k); curr = edges.get((long)curr); }submask |= (1 << b); if ( cyclic) subsets[submask] = new Node(-69,i,b); }for ( int mask = 1;(mask < (1 << N));mask++) for ( int submask = mask;(submask > 0);submask = ((submask - 1) & mask)) if ( ((dp[(mask ^ submask)] != null) && (subsets[submask] != null))) {dp[mask] = new Node((mask ^ submask),subsets[submask].dex,subsets[submask].start); break;} if ( (dp[((1 << N) - 1)] == null)) System.out.println("No"); else { StringBuilder sb = new StringBuilder("Yes\n");  long[][] res = new long[N][2]; for ( int i = 0;(i < N);i++) res[i][1] = -1L; int currmask = ((1 << N) - 1); while((currmask != 0)){ int submask = dp[currmask].mask;  int i = dp[currmask].dex;  int b = dp[currmask].start;  long nextval = ((target - sums[b]) + boxes[b].get(i));  int curr = map.get(nextval); res[map.get(nextval)][0] = nextval; res[map.get(nextval)][1] = b; while(true){ int lol = map.get(nextval); nextval = edges.get(nextval); res[map.get(nextval)][0] = nextval; if ( (res[map.get(nextval)][1] != -1)) break; res[map.get(nextval)][1] = lol; }currmask = dp[currmask].mask; }for ( int k = 0;(k < N);k++) sb.append((res[k][0] + " ")).append((res[k][1] + 1)).append("\n"); System.out.print(sb); }} } class Node{ public int mask ; public int dex ; public int start ; public Node( int a, int b, int c){ mask = a; dex = b; start = c; } }
0	public class Solution{ private BufferedReader cin ; private PrintWriter cout ; private StringTokenizer strtok ; public static void main( String[] args)throws IOException { Solution sol = new Solution(); final boolean CONTEST = true; if ( CONTEST) {sol.cin = new BufferedReader(new InputStreamReader(System.in)); sol.cout = new PrintWriter(System.out); } else {sol.cin = new BufferedReader(new FileReader("input.txt")); sol.cout = new PrintWriter("output.txt"); }sol.solve(); sol.cin.close(); sol.cout.close(); } private int nextInt()throws NumberFormatException,IOException { return Integer.parseInt(nextToken());} private String nextToken()throws IOException { while(((strtok == null) || !strtok.hasMoreTokens())){strtok = new StringTokenizer(cin.readLine()); }return strtok.nextToken();} private void solve()throws IOException { int n = nextInt(); if ( ((n % 2) == 0)) {cout.println((((n - 4) + " ") + 4)); } else {cout.println((((n - 9) + " ") + 9)); }} }
1	public class pillar{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int a[] = new int[200005]; for ( int i = 1;(i <= n);i++) a[i] = sc.nextInt(); for ( int i = 2;(i < n);i++) if ( ((a[(i - 1)] > a[i]) && (a[i] < a[(i + 1)]))) {System.out.println("NO"); return ;} System.out.println("YES"); } }
5	public class A{ public static void main( String[] ar)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String s1[] = br.readLine().split(" ");  int n = Integer.parseInt(s1[0]);  int m = Integer.parseInt(s1[1]);  int a[] = new int[n];  String s2[] = br.readLine().split(" ");  long S = 0; for ( int i = 0;(i < n);i++) {a[i] = Integer.parseInt(s2[i]); S += (long)a[i]; }Arrays.sort(a); m = a[(n - 1)]; int last = 1;  int t = 1; for ( int i = 1;(i < (n - 1));i++) {if ( (a[i] == last)) t++; else {t++; last = (last + 1); }}if ( (last < m)) {t += (m - last); } else t++; System.out.println((S - t)); } }
2	public class B{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));  Solver solver = new Solver(); solver.solve(in,out); out.close(); } static class Solver{ int n ; int n2 ; InputReader in ; PrintWriter out ; public void solve( InputReader in, PrintWriter out){ this.in = in; this.out = out; n = in.readInt(); n2 = (n / 2); int res = find(); out.print("! "); out.println(res); } public int find(){ if ( ((n % 4) != 0)) return -1; int c = compare(0); if ( (c == 0)) return 1; int s = 1;  int f = (n2 - 1); if ( (c > 0)) {s = (n2 + 1); f = (n - 1); } while((s <= f)){ int m = ((s + f) / 2);  int v = compare(m); if ( (v == 0)) return (m + 1); else if ( (v < 0)) s = (m + 1); else f = (m - 1); }return -1;} public int compare( int z){ out.print("? "); out.println((z + 1)); out.flush(); int r1 = in.readInt(); out.print("? "); out.println((((z + n2) % n) + 1)); out.flush(); int r2 = in.readInt(); return (r1 - r2);} } static class InputReader{ private BufferedReader reader ; private StringTokenizer tokenizer ; public InputReader( InputStream stream){ this.reader = new BufferedReader(new InputStreamReader(stream)); } public String read(){ try{if ( ((tokenizer == null) || !tokenizer.hasMoreTokens())) {tokenizer = new StringTokenizer(reader.readLine()); } }catch (IOException ex){ throw (new RuntimeException(ex));} return tokenizer.nextToken();} public int readInt(){ return Integer.parseInt(read());} } }
3	public class C908{ public static class mPoint implements Comparable<mPoint>{ public double a ,b ; public mPoint( int a, double b){ this.a = a; this.b = b; } } public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(),r = in.nextInt();  int[] ar = new int[n];  ArrayList<mPoint> disks = new ArrayList<>();  double[] ans = new double[n]; for ( int i = 0;(i < n);i++) {ar[i] = in.nextInt(); double max = -1; for ( int j = 0;(j < disks.size());j++) {if ( inRange(ar[i],disks.get(j).a,r)) { double h = (((4 * r) * r) - ((ar[i] - disks.get(j).a) * (ar[i] - disks.get(j).a))); max = Math.max(max,(Math.sqrt(h) + disks.get(j).b)); } } mPoint p = null; if ( (max == -1)) {p = new mPoint(ar[i],r); } else {p = new mPoint(ar[i],max); }disks.add(p); ans[i] = p.b; }for ( int i = 0;(i < (ans.length - 1));i++) {System.out.print((ans[i] + " ")); }System.out.println(ans[(ans.length - 1)]); } public static boolean inRange( int a, double b, int r){ if ( (Math.abs((b - a)) <= (2 * r))) return true; return false;} }
0	public class J472A{ static private Scanner scan = new Scanner(System.in); public static void main( String[] args){ int a = scan.nextInt(); if ( ((a % 2) == 0)) {System.out.println(((4 + " ") + (a - 4))); } else {System.out.println(((9 + " ") + (a - 9))); }} }
5	public class CF915E{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);  int n = Integer.parseInt(br.readLine());  int q = Integer.parseInt(br.readLine());  TreeMap<Integer,Integer> mp = new TreeMap<>();  int ans = 0; while((q-- > 0)){ StringTokenizer st = new StringTokenizer(br.readLine());  int l = (Integer.parseInt(st.nextToken()) - 1);  int r = Integer.parseInt(st.nextToken());  int t = Integer.parseInt(st.nextToken());  Map.Entry<Integer,Integer> e ;  int l_ ,r_ ; if ( (t == 1)) {if ( (((e = mp.floorEntry(l)) != null) && ((r_ = e.getValue()) >= l))) {l_ = e.getKey(); ans -= (r_ - l_); l = l_; r = Math.max(r,r_); } while((((e = mp.higherEntry(l)) != null) && ((l_ = e.getKey()) <= r))){r_ = e.getValue(); ans -= (r_ - l_); r = Math.max(r,r_); mp.remove(l_); }ans += (r - l); mp.put(l,r); } else {r_ = l; if ( (((e = mp.floorEntry(l)) != null) && ((r_ = e.getValue()) > l))) {l_ = e.getKey(); if ( (l_ < l)) mp.put(l_,l); else mp.remove(l_); ans -= (r_ - l); } while((((e = mp.higherEntry(l)) != null) && ((l_ = e.getKey()) < r))){r_ = e.getValue(); mp.remove(l_); ans -= (r_ - l_); }if ( (r_ > r)) {mp.put(r,r_); ans += (r_ - r); } }pw.println((n - ans)); }pw.close(); } }
3	public class LogicalExpression{ int N = 256; void solve(){ Expression[] E = new Expression[N]; for ( int i = 0;(i < N);i++) E[i] = new Expression(); E[Integer.parseInt("00001111",2)].update_f("x"); E[Integer.parseInt("00110011",2)].update_f("y"); E[Integer.parseInt("01010101",2)].update_f("z"); for ( int l = 2;(l < 40);l++) {for ( int i = 0;(i < N);i++) {for ( int j = 0;(j < N);j++) {if ( (((E[i].e != null) && (E[j].t != null)) && (((E[i].e.length() + E[j].t.length()) + 1) == l))) {E[(i | j)].update_e(((E[i].e + '|') + E[j].t)); } if ( (((E[i].t != null) && (E[j].f != null)) && (((E[i].t.length() + E[j].f.length()) + 1) == l))) {E[(i & j)].update_t(((E[i].t + '&') + E[j].f)); } }if ( (E[i].f != null)) E[(i ^ (N - 1))].update_f(('!' + E[i].f)); }} String[] res = new String[N]; for ( int i = 0;(i < N);i++) res[i] = E[i].calc_best(); int n = in.nextInt(); for ( int i = 0;(i < n);i++) { int x = Integer.parseInt(in.nextToken(),2); out.println(res[x]); }} static class Expression{ String e ,t ,f ; Expression(){ } public Expression( String e, String t, String f){ this.e = e; this.t = t; this.f = f; } String calc_best(){ String best = e; if ( (compare(best,t) > 0)) best = t; if ( (compare(best,f) > 0)) best = f; return best;} void update_e( String ne){ if ( ((e == null) || (compare(e,ne) > 0))) {e = ne; update_f((('(' + e) + ')')); } } void update_t( String nt){ if ( ((t == null) || (compare(t,nt) > 0))) {t = nt; update_e(t); } } void update_f( String nf){ if ( ((f == null) || (compare(f,nf) > 0))) {f = nf; update_t(f); } } int compare( String a, String b){ if ( (a.length() != b.length())) return Integer.compare(a.length(),b.length()); return a.compareTo(b);} } public static void main( String[] args){ in = new FastScanner(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); new LogicalExpression().solve(); out.close(); } static FastScanner in ; static PrintWriter out ; static class FastScanner{ BufferedReader in ; StringTokenizer st ; public FastScanner( BufferedReader in){ this.in = in; } public String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} public int nextInt(){ return Integer.parseInt(nextToken());} } }
3	public class Code3{ public static void main( String[] args){ InputReader in = new InputReader(System.in);  PrintWriter pw = new PrintWriter(System.out);  int n = in.nextInt();  double r = (double)in.nextInt();  double[] a = new double[n]; for ( int i = 0;(i < n);i++) a[i] = (double)in.nextInt(); double[] ans = new double[n]; ans[0] = r; for ( int i = 1;(i < n);i++) { double max = Double.MIN_VALUE; for ( int j = 0;(j < i);j++) {if ( (Math.abs((a[i] - a[j])) <= (2 * r))) { double cur = ((4 * r) * r); cur -= ((a[i] - a[j]) * (a[i] - a[j])); cur = Math.sqrt(cur); cur += ans[j]; max = Math.max(max,cur); } }if ( (max == Double.MIN_VALUE)) ans[i] = r; else ans[i] = max; }for ( int i = 0;(i < n);i++) pw.print((ans[i] + " ")); pw.flush(); pw.close(); } static class InputReader{ private final InputStream stream ; private final byte[] buf = new byte[8192]; private int curChar ,snumChars ; private SpaceCharFilter filter ; public InputReader( InputStream stream){ this.stream = stream; } public int snext(){ if ( (snumChars == -1)) throw (new InputMismatchException()); if ( (curChar >= snumChars)) {curChar = 0; try{snumChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (snumChars <= 0)) return -1; } return buf[curChar++];} public int nextInt(){ int c = snext(); while(isSpaceChar(c)){c = snext(); } int sgn = 1; if ( (c == '-')) {sgn = -1; c = snext(); } int res = 0; do {if ( ((c < '0') || (c > '9'))) throw (new InputMismatchException()); res *= 10; res += (c - '0'); c = snext(); }while(!isSpaceChar(c));return (res * sgn);} public boolean isSpaceChar( int c){ if ( (filter != null)) return filter.isSpaceChar(c); return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} private boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } public static long mod = 1000000007; public static int d ; public static int p ; public static int q ; public static int GCD( int a, int b){ if ( (b == 0)) return a; else return GCD(b,(a % b));} public static long GCD( long a, long b){ if ( (b == 0)) return a; else return GCD(b,(a % b));} public static void extendedEuclid( int A, int B){ if ( (B == 0)) {d = A; p = 1; q = 0; } else {extendedEuclid(B,(A % B)); int temp = p; p = q; q = (temp - ((A / B) * q)); }} public static int modularExponentiation( int x, int n, int M){ int result = 1; while((n > 0)){if ( ((n % 2) == 1)) result = ((result * x) % M); x = ((x * x) % M); n = (n / 2); }return result;} public static long modularExponentiation( long x, long n, long M){ long result = 1; while((n > 0)){if ( ((n % 2) == 1)) result = ((result * x) % M); x = ((x * x) % M); n = (n / 2); }return result;} }
6	public class D{ static int n ,KA ,A ; static int[] b ; static int[] l ; static double ans = 0; public static void main( String[] args)throws IOException { Scanner in = new Scanner(System.in); n = in.nextInt(); KA = in.nextInt(); A = in.nextInt(); b = new int[n]; l = new int[n]; for ( int i = 0;(i < l.length);i++) {b[i] = in.nextInt(); l[i] = in.nextInt(); }dp = new double[(n + 2)][(n + 2)][((n * 9999) + 2)]; go(0,KA); System.out.printf("%.6f\n",ans); } public static void go( int at, int k){ if ( (at == n)) {ans = Math.max(ans,solve(0,0,0)); return ;} for ( int i = 0;(i <= k);i++) {if ( ((l[at] + (i * 10)) <= 100)) {l[at] += (i * 10); go((at + 1),(k - i)); l[at] -= (i * 10); } }} static double dp[][][] ; public static double solve( int at, int ok, int B){ if ( (at == n)) {if ( (ok > (n / 2))) {return 1;} else {return ((A * 1.0) / ((A * 1.0) + B));}} double ret = (((l / 100.0) * solve((at + 1),(ok + 1),B)) + ((1.0 - (l / 100.0)) * solve((at + 1),ok,(B + b[at])))); return ret;} }
5	public class Main{ private FastScanner scanner = new FastScanner(); public static void main( String[] args){ new Main().solve(); } private List<Integer>[] gr = new ArrayList[(1000_000 + 5)]; private int dp[][] = new int[21][(1000_000 + 5)]; private boolean used[] = new boolean[(1000_000 + 5)]; void init( int v, int p){ Stack<Integer> st = new Stack<>(); st.push(v); st.push(p); while(!st.isEmpty()){p = st.pop(); v = st.pop(); used[v] = true; dp[0][v] = p; for ( int i = 1;(i <= 20);i++) {if ( (dp[(i - 1)][v] != -1)) {dp[i][v] = dp[(i - 1)][dp[(i - 1)][v]]; } }for ( int next :gr[v]) {if ( !used[next]) {st.push(next); st.push(v); } }}} private void solve(){ int n = scanner.nextInt(),k = scanner.nextInt();  boolean[] ans = new boolean[(1000_000 + 5)]; for ( int i = 0;(i < n);i++) {gr[i] = new ArrayList<>(); }for ( int i = 0;(i < (n - 1));i++) { int u = (scanner.nextInt() - 1),v = (scanner.nextInt() - 1); gr[u].add(v); gr[v].add(u); }k = ((n - k) - 1); ans[(n - 1)] = true; init((n - 1),(n - 1)); int t ,d ,next ; for ( int i = (n - 2);(i >= 0);i--) {t = i; d = 1; if ( ans[i]) {continue;} for ( int j = 20;(j >= 0);j--) {next = dp[j][t]; if ( ((next != -1) && !ans[next])) {t = next; d += (1 << j); } }if ( (d <= k)) {k -= d; t = i; while(!ans[t]){ans[t] = true; t = dp[0][t]; }} if ( (k == 0)) {break;} } StringBuilder sb = new StringBuilder(""); for ( int i = 0;(i < n);i++) {if ( !ans[i]) {sb.append((i + 1)).append(" "); } }System.out.println(sb.toString()); } class FastScanner{ public BufferedReader reader ; public StringTokenizer tokenizer ; public FastScanner(){ reader = new BufferedReader(new InputStreamReader(System.in),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());} } }
2	public class Main{ public static void main( String[] args)throws IOException { Scanner s = new Scanner(System.in);  long k = s.nextLong();  long dp[] = new long[13];  long x = 9;  int i = 1;  long ansx = 0;  int ansi = 0; for ( ;(i < 13);i++) {dp[i] = (dp[(i - 1)] + (x * i)); x *= 10; if ( (k <= dp[i])) {ansx = x; ansi = i; break;} if ( (dp[i] > 1000000000000l)) break; }if ( (ansi < 2)) {System.out.println(k); return ;} k -= dp[(ansi - 1)]; long st = (long)Math.pow(10,(ansi - 1));  long div = (k / ansi); if ( ((k % ansi) == 0)) div--; k -= (div * ansi); System.out.println(findKthDigit((st + div),k)); } static private Long findKthDigit( long xx, long k){ int z = (int)k;  ArrayList<Long> arr = new ArrayList(); while((xx > 0)){arr.add((xx % 10)); xx /= 10; }return arr.get((arr.size() - z));} }
0	public class ToyArmy{ int N ; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] tok ; String s ; private int getInt()throws IOException { return Integer.valueOf(br.readLine());} private int[] getInt( int N)throws IOException { int[] data = new int[N]; tok = br.readLine().split(" "); for ( int i = 0;(i < N);i++) data[i] = Integer.valueOf(tok[i]); return data;} public void solve()throws IOException { int i = 0,j = 0; N = getInt(); long kill = ((3 * N) / 2); System.out.printf("%d\n",kill); } public static void main( String[] args)throws IOException { new ToyArmy().solve(); } }
2	public class D{ static StringTokenizer st ; static BufferedReader in ; public static void main( String[] args)throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  long L = nextLong();  long R = nextLong(); if ( (L == R)) {System.out.println(0); return ;} String s1 = Long.toBinaryString(L),s2 = Long.toBinaryString(R); while((s1.length() != s2.length()))s1 = ("0" + s1); for ( int i = 0;(i < s1.length());i++) {if ( (s1.charAt(i) != s2.charAt(i))) { int pow = (s1.length() - i); System.out.println(((long)Math.pow(2,pow) - 1)); return ;} }pw.close(); } static private long nextLong()throws IOException { return Long.parseLong(next());} static private String next()throws IOException { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(in.readLine()); }return st.nextToken();} }
0	public class Main{ public static void main( String[] args){ Scanner input = new Scanner(System.in);  long x = input.nextLong(); if ( ((x == 1) || (x == 2))) {System.out.println(x); } else if ( ((((x % 2) == 0) && (x > 2)) && ((x % 3) != 0))) {System.out.println(((x * (x - 1)) * (x - 3))); } else if ( (((x % 2) == 0) && ((x % 3) == 0))) {System.out.println((((x - 1) * (x - 2)) * (x - 3))); } else {System.out.println(((x * (x - 1)) * (x - 2))); }} }
4	public class GeorgeInterestingGraph{ int N = 505; int INF = (int)1e9; List<Integer>[] G = new List[N]; int[] match = new int[N]; int[] used = new int[N]; int cur = 0; {for ( int i = 0;(i < N);i++) G[i] = new ArrayList<>(1); } void solve(){ int n = in.nextInt(),m = in.nextInt();  int[] fr = new int[m],to = new int[m]; for ( int i = 0;(i < m);i++) {fr[i] = (in.nextInt() - 1); to[i] = (in.nextInt() - 1); } int ans = INF; for ( int i = 0;(i < n);i++) { int cnt = 0; for ( int j = 0;(j < n);j++) {G[j].clear(); match[j] = -1; }for ( int j = 0;(j < m);j++) {if ( ((fr[j] == i) || (to[j] == i))) {cnt++; } else {G[fr[j]].add(to[j]); }} int other = (m - cnt);  int max = 0; for ( int j = 0;(j < n);j++) {cur++; if ( augment(j)) max++; }ans = Math.min(ans,(((((((2 * (n - 1)) + 1) - cnt) + other) - max) + (n - 1)) - max)); }out.println(ans); } boolean augment( int u){ if ( (used[u] == cur)) return false; used[u] = cur; for ( int v :G[u]) {if ( ((match[v] < 0) || augment(match[v]))) {match[v] = u; return true;} }return false;} public static void main( String[] args){ in = new FastScanner(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); new GeorgeInterestingGraph().solve(); out.close(); } static FastScanner in ; static PrintWriter out ; static class FastScanner{ BufferedReader in ; StringTokenizer st ; public FastScanner( BufferedReader in){ this.in = in; } public String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} public int nextInt(){ return Integer.parseInt(nextToken());} } }
2	public class D{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long a = in.nextLong();  long b = in.nextLong();  String sa = Long.toBinaryString(a);  String sb = Long.toBinaryString(b);  long ans = 0; if ( ((sb.length() - sa.length()) > 0)) {for ( int i = 0;(i < sb.length());i++) {ans += (1l << i); }System.out.println(ans); } else { int num = -1; for ( int i = 62;(i >= 0);i--) {if ( (((b & (1l << i)) != 0) && ((a & (1l << i)) != 0))) {num = i; break;} }ans = 0; if ( (num != -1)) for ( int i = 0;(i <= num);i++) {ans += (1l << i); } System.out.println(ans); }} }
6	public class Sol2{ public static final int MXN = (1 << 21); public static int good[][] ; public static void main( String[] args)throws IOException { FastIO sc = new FastIO(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt();  int m = sc.nextInt();  int num[][] = new int[m][m];  String str = sc.next(); for ( int i = 0;(i < (str.length() - 1));i++) { int a = (str.charAt(i) - 'a');  int b = (str.charAt((i + 1)) - 'a'); num[a][b]++; num[b][a]++; } int lowbit[] = new int[MXN];  int dp[] = new int[MXN]; for ( int i = 0;(i < MXN);i++) {dp[i] = Integer.MAX_VALUE; }dp[0] = 0; good = new int[MXN][m]; for ( int msk = 0;(msk < (1 << m));msk++) {for ( int i = 0;(i < m);i++) { int low = Integer.numberOfTrailingZeros(Integer.lowestOneBit(msk)); if ( (low == 32)) low = 0; good[msk][i] = (good[(msk ^ (1 << low))][i] + num[i][low]); }}for ( int msk = 0;(msk < (1 << m));msk++) { int bits = (Integer.bitCount(msk) + 1); for ( int i = 0;(i < m);i++) {if ( ((msk & (1 << i)) != 0)) continue; int nxt = (msk | (1 << i)); dp[nxt] = Math.min(dp[nxt],(dp[msk] + (bits * (good[msk][i] - good[(((1 << m) - 1) ^ nxt)][i])))); }}out.println(dp[((1 << m) - 1)]); out.close(); } static class FastIO{ InputStream dis ; byte[] buffer = new byte[(1 << 17)]; int pointer = 0; public FastIO( String fileName)throws IOException{ dis = new FileInputStream(fileName); } public FastIO( InputStream is)throws IOException{ dis = is; } int nextInt()throws IOException { int ret = 0;  byte b ; do {b = nextByte(); }while((b <= ' ')); boolean negative = false; if ( (b == '-')) {negative = true; b = nextByte(); } while(((b >= '0') && (b <= '9'))){ret = (((10 * ret) + b) - '0'); b = nextByte(); }return (negative?-ret:ret);} byte nextByte()throws IOException { if ( (pointer == buffer.length)) {dis.read(buffer,0,buffer.length); pointer = 0; } return buffer[pointer++];} String next()throws IOException { StringBuffer ret = new StringBuffer();  byte b ; do {b = nextByte(); }while((b <= ' '));while((b > ' ')){ret.appendCodePoint(b); b = nextByte(); }return ret.toString();} } }
4	public class CFTemplate{ static final long MOD = 1000000007L; static final int INF = 1100000000; static final int NINF = -100000; static FastScanner sc ; static PrintWriter pw ; static final int[][] dirs = {{-1,0},{1,0},{0,-1},{0,1}}; public static void main( String[] args){ sc = new FastScanner(); pw = new PrintWriter(System.out); ArrayList<Integer> primes = new ArrayList<Integer>(); for ( int i = 2;(i <= 3200);i++) { boolean p = true; for ( int j = 2;((j * j) <= i);j++) {if ( ((i % j) == 0)) {p = false; break;} }if ( p) primes.add(i); } int Q = sc.ni(); for ( int q = 0;(q < Q);q++) { int N = sc.ni();  int K = sc.ni();  int[] nums = new int[(N + 1)]; for ( int i = 1;(i <= N);i++) nums[i] = sc.ni(); for ( int i = 1;(i <= N);i++) {for ( int p :primes) { int c = 0; while(((nums[i] % p) == 0)){nums[i] /= p; c++; }if ( ((c % 2) == 1)) nums[i] *= p; }} TreeSet<Integer> ts = new TreeSet<Integer>();  HashMap<Integer,Integer> last = new HashMap<Integer,Integer>();  int[][] dp = new int[(N + 1)][(K + 1)]; for ( int i = 1;(i <= N);i++) {if ( last.containsKey(nums[i])) {ts.add(last.get(nums[i])); } last.put(nums[i],i); int[] inds = new int[(K + 1)];  int ind = 0; for ( int x :ts.descendingSet()) {inds[ind] = x; if ( (ind == K)) break; ind++; }for ( int j = 0;(j <= K);j++) {dp[i][j] = INF; if ( (j > 0)) dp[i][j] = dp[i][(j - 1)]; for ( int k = 0;(k <= j);k++) {dp[i][j] = Math.min(dp[i][j],(dp[inds[k]][(j - k)] + 1)); }}}pw.println(dp[N][K]); }pw.close(); } public static void sort( int[] arr){ Random rgen = new Random(); for ( int i = 0;(i < arr.length);i++) { int r = rgen.nextInt(arr.length);  int temp = arr[i]; arr[i] = arr[r]; arr[r] = temp; }Arrays.sort(arr); } public static void sort( long[] arr){ Random rgen = new Random(); for ( int i = 0;(i < arr.length);i++) { int r = rgen.nextInt(arr.length);  long temp = arr[i]; arr[i] = arr[r]; arr[r] = temp; }Arrays.sort(arr); } public static void sort( int[][] arr){ Random rgen = new Random(); for ( int i = 0;(i < arr.length);i++) { int r = rgen.nextInt(arr.length);  int[] temp = arr[i]; arr[i] = arr[r]; arr[r] = temp; }Arrays.sort(arr,new Comparator<int[]>(){}); } public static void sort( long[][] arr){ Random rgen = new Random(); for ( int i = 0;(i < arr.length);i++) { int r = rgen.nextInt(arr.length);  long[] temp = arr[i]; arr[i] = arr[r]; arr[r] = temp; }Arrays.sort(arr,new Comparator<long[]>(){}); } static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner(){ br = new BufferedReader(new InputStreamReader(System.in),32768); st = null; } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int ni(){ return Integer.parseInt(next());} long nl(){ return Long.parseLong(next());} } }
2	public class global{ public static void main( String[] s){ Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  String st = String.valueOf(n); if ( (st.length() == 1)) {System.out.println(n); } else { long val = 1;  long prev = 9;  long total = 9;  long late = 9; for ( int i = 2;(i <= 12);i++) {val *= 10; total += (i * (val * 9)); if ( (n <= total)) { long diff = (n - late);  long div = (diff / i);  long mod = (diff % i); if ( (mod == 0)) {prev += div; System.out.println((prev % 10)); break;} else {prev += (div + 1); String fg = String.valueOf(prev); System.out.println(fg.charAt(((int)mod - 1))); break;}} prev += (9 * val); late = total; }}} }
2	public class D{ public static void main( String[] args)throws IOException { new D().solve(); } void solve()throws IOException { Scanner sc = new Scanner(System.in);  BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String[] sp ;  long L = sc.nextLong();  long R = sc.nextLong(); if ( (L == R)) {System.out.println(0); } else {System.out.println(((Long.highestOneBit((R ^ L)) * 2) - 1)); }} }
4	public class Practice{ public static long mod = ((long)Math.pow(10,9) + 7); public static long[][] dp ; public static void main( String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);  String[] s2 = br.readLine().split(" ");  int n = (int)Long.parseLong(s2[0]);  long m = Long.parseLong(s2[1]); dp = new long[(n + 2)][(n + 2)]; long[] power = new long[(n + 1)]; mod = m; long[][] choose = new long[(n + 2)][(n + 2)]; getPow(power,(n + 1)); getChoose(choose,(n + 2),(n + 2)); dp[0][0] = 1; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= i);j++) {for ( int k = 1;((k + i) <= n);k++) {dp[((i + k) + 1)][(j + k)] = ((dp[((i + k) + 1)][(j + k)] + ((((dp[i][j] * power[(k - 1)]) % mod) * choose[(j + k)][k]) % mod)) % mod); }}} long ans = 0; for ( int i = 0;(i <= n);i++) {ans = ((ans + dp[(n + 1)][i]) % mod); }pw.println(ans); pw.close(); } static private void getChoose( long[][] choose, int up, int dow){ for ( int i = 1;(i < up);i++) {for ( int j = 1;(j <= i);j++) {if ( ((j == 1) && (i == 1))) {choose[i][j] = 1; } else if ( (j == 1)) {choose[i][j] = i; } else {choose[i][j] = ((choose[(i - 1)][j] + choose[(i - 1)][(j - 1)]) % mod); }}}} static private void getPow( long[] power, int l){ for ( int i = 0;(i < l);i++) {if ( (i == 0)) {power[i] = 1; } else {power[i] = ((power[(i - 1)] * 2) % mod); }}} }
6	public class flags1225 implements Runnable{ static int n ,k ,a ,b[] ,loy[] ; static boolean decision[] ; static double ans ,max ; static void check( int i){ if ( (i == n)) {checkAgain(); return ;} decision[i] = true; check((i + 1)); if ( (loy[i] < 100)) {decision[i] = false; check((i + 1)); } } static void checkAgain(){ double prob = 1;  int enemyEnergy = 0;  int count = 0; for ( int i = 0;(i < n);i++) {if ( decision[i]) {count++; prob *= loy[i]; } else {prob = (prob * (100 - loy[i])); enemyEnergy += b[i]; }} double killProb = ((double)a / (a + enemyEnergy)); if ( (count > (n / 2))) {ans += prob; return ;} prob *= killProb; ans += prob; } static void rec( int sum, int i){ if ( ((i == n) || (sum == 0))) {ans = 0; check(0); max = max(ans,max); return ;} for ( int j = 0;(j <= sum);j = (j + 10)) {if ( ((loy[i] + j) > 100)) continue; loy[i] += j; rec((sum - j),(i + 1)); loy[i] -= j; }} static private boolean fileIOMode = false; static private String problemName = "harmful"; static private BufferedReader in ; static private PrintWriter out ; static private StringTokenizer tokenizer ; public static void main( String[] args)throws Exception { Locale.setDefault(Locale.ENGLISH); if ( fileIOMode) {in = new BufferedReader(new FileReader((problemName + ".in"))); out = new PrintWriter((problemName + ".out")); } else {in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); }tokenizer = new StringTokenizer(""); new Thread(new flags1225()).start(); } static private String nextLine(){ try{return in.readLine(); }catch (IOException e){ return null;} } static private String nextToken(){ while(!tokenizer.hasMoreTokens()){tokenizer = new StringTokenizer(nextLine()); }return tokenizer.nextToken();} static private int nextInt(){ return Integer.parseInt(nextToken());} }
0	public class Main{ public static boolean isPrime( long num){ int divisor = 2;  boolean bandera = true; while((bandera && (divisor < num))){if ( ((num % divisor) == 0)) {bandera = false; break;} else {divisor++; }}return bandera;} public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  int uno = 4;  int dos = (n - 4); while((isPrime(dos) || isPrime(uno))){dos--; uno++; }System.out.println(((uno + " ") + dos)); } }
6	public class f{ static int n ; static double[][] g ; public static void main( String[] args)throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out); n = input.nextInt(); g = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) g[i][j] = input.nextDouble(); for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) g[j][i] = (1 - g[i][j]); for ( int i = 0;(i < n);i++) { double[] dp = new double[(1 << n)]; for ( int mask = 0;(mask < (1 << n));mask++) {if ( ((mask & (1 << i)) == 0)) {dp[mask] = 0; continue;} if ( (mask == (1 << i))) {dp[mask] = 1; continue;} int count = Integer.bitCount(mask);  double prob = (1.0 / ((count * (count - 1)) / 2)); for ( int a = 0;(a < n);a++) {if ( ((mask & (1 << a)) == 0)) continue; for ( int b = (a + 1);(b < n);b++) {if ( ((mask & (1 << b)) == 0)) continue; double p = ((g[a][b] * dp[(mask ^ (1 << b))]) + (g[b][a] * dp[(mask ^ (1 << a))])); dp[mask] += p; }}dp[mask] *= prob; }out.print((dp[((1 << n) - 1)] + " ")); }out.close(); } }
5	public class c{ public static void main( String[] args)throws IOException { FastScanner in = new FastScanner(System.in);  int n = in.nextInt(),m = in.nextInt();  long bounty = in.nextInt(),increase = in.nextInt();  int damage = in.nextInt();  int[] mh = new int[n];  int[] sh = new int[n];  int[] reg = new int[n];  long countKilled = 0;  ArrayList<Event> es = new ArrayList<>();  Event[] regen = new Event[n]; for ( int i = 0;(i < n);i++) {mh[i] = in.nextInt(); sh[i] = in.nextInt(); reg[i] = in.nextInt(); if ( (sh[i] <= damage)) countKilled++; if ( (reg[i] > 0)) { int time = (((((damage + 1) - sh[i]) + reg[i]) - 1) / reg[i]); if ( ((time > 0) && (mh[i] >= (damage + 1)))) { Event e2 = new Event(time,i,(damage + 1)); regen[i] = e2; es.add(e2); } } }for ( int i = 0;(i < m);i++) { Event e = new Event(in.nextInt(),(in.nextInt() - 1),in.nextInt()); es.add(e); if ( (reg[e.e] > 0)) { int time = (((((damage + 1) - e.h) + reg[e.e]) - 1) / reg[e.e]); if ( ((time > 0) && (mh[e.e] >= (damage + 1)))) { Event e2 = new Event((e.t + time),e.e,(damage + 1)); e.regen = e2; es.add(e2); } } }Collections.sort(es,(a,b)->(a.t - b.t)); long ans = (countKilled * bounty);  int lastTime = 0; for ( Event e :es) {if ( (e.t == -1)) continue; if ( ((regen[e.e] != e) && (regen[e.e] != null))) {regen[e.e].t = -1; regen[e.e] = null; } if ( (lastTime != e.t)) {ans = Math.max(ans,(countKilled * (bounty + ((e.t - 1) * increase)))); } if ( (sh[e.e] <= damage)) countKilled--; sh[e.e] = e.h; if ( (sh[e.e] <= damage)) countKilled++; if ( (e.regen != null)) {regen[e.e] = e.regen; } lastTime = e.t; }if ( (countKilled != 0)) {if ( (increase > 0)) ans = -1; else ans = Math.max(ans,(countKilled * bounty)); } System.out.println(ans); } static class Event{ int t ; int e ; int h ; Event regen ; public Event( int tt, int ee, int hh){ t = tt; e = ee; h = hh; } } static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream i){ br = new BufferedReader(new InputStreamReader(i)); st = new StringTokenizer(""); } public String next()throws IOException { if ( st.hasMoreTokens()) return st.nextToken(); else st = new StringTokenizer(br.readLine()); return next();} public int nextInt()throws IOException { return Integer.parseInt(next());} } }
2	public class ehab4{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int a = 0,b = 0; System.out.println("? 0 0 "); System.out.flush(); int c = in.nextInt(); for ( int i = 29;(i >= 0);i--) {System.out.println(((("? " + (a + (1 << i))) + " ") + b)); System.out.flush(); int q1 = in.nextInt(); System.out.println(((("? " + a) + " ") + (b + (1 << i)))); System.out.flush(); int q2 = in.nextInt(); if ( (q1 == q2)) {if ( (c == 1)) a += (1 << i); else if ( (c == -1)) b += (1 << i); c = q1; } else if ( (q1 == -1)) {a += (1 << i); b += (1 << i); } else if ( (q1 == -2)) return ; }System.out.println(((("! " + a) + " ") + b)); System.out.flush(); } }
2	public class digits{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  long k = Long.parseLong(br.readLine());  long temp = (9 * (int)Math.pow(10,0));  int count = 0;  long initial = 0; while((k > temp)){count++; initial = temp; temp += ((9 * (long)Math.pow(10,count)) * (count + 1)); } long index = (((k - initial) - 1) % (count + 1));  long num = ((long)Math.pow(10,count) + (((k - initial) - 1) / (count + 1))); System.out.println((num + "")); } }
0	public class code0{ public static void main( String[] args){ Scanner scr = new Scanner(System.in);  int c = 0,e = 0,d = 0;  int a = scr.nextInt(); d = (a / 2); if ( ((a >= 11) && ((a % 2) == 1))) {c = 9; e = (a - 9); } else {c = (a - 4); e = 4; }System.out.print(((c + " ") + e)); } }
6	public class E{ static private final int oo = 1000000000; public static void main( String[] args)throws Exception { Scanner in = new Scanner(System.in);  int n = in.nextInt();  int m = in.nextInt(); if ( (n > m)) { int t = n; n = m; m = t; } int[][] curr = new int[(1 << n)][(1 << n)]; fill(curr,oo); Arrays.fill(curr[0],0); for ( int j = 0;(j < m);j++) { int[][] next = new int[(1 << n)][(1 << n)]; fill(next,oo); for ( int c0 = 0;(c0 < (1 << n));c0++) for ( int c1 = 0;(c1 < (1 << n));c1++) if ( (curr[c0][c1] != oo)) for ( int c2 = 0;(c2 < ((j == (m - 1))?1:(1 << n)));c2++) { int done = 0; for ( int i = 0;(i < n);i++) if ( (((1 << i) & c1) == 0)) { int up = (i - 1);  int down = (i + 1); if ( ((up >= 0) && (((1 << up) & c1) != 0))) done |= (1 << i); if ( ((down < n) && (((1 << down) & c1) != 0))) done |= (1 << i); if ( (((1 << i) & c0) != 0)) done |= (1 << i); if ( (((1 << i) & c2) != 0)) done |= (1 << i); } next[c1][c2] = Math.min(next[c1][c2],((curr[c0][c1] + n) - Integer.bitCount(done))); } curr = next; } int res = oo; for ( int i = 0;(i < (1 << n));i++) for ( int j = 0;(j < (1 << n));j++) res = Math.min(res,curr[i][j]); System.out.println(((n * m) - res)); } static private void fill( int[][] array, int val){ for ( int[] fill :array) Arrays.fill(fill,val); } }
4	public class GeorgeAndInterestingGraph{ public static void main( String[] args){ MyScanner sc = new MyScanner();  int N = sc.nextInt();  int M = sc.nextInt();  int[] edgeFrom = new int[M];  int[] edgeTo = new int[M]; for ( int i = 0;(i < M);i++) {edgeFrom[i] = sc.nextInt(); edgeTo[i] = sc.nextInt(); } int best = Integer.MAX_VALUE; for ( int i = 0;(i < N);i++) { boolean[][] mat = makeAdjMat(N,edgeFrom,edgeTo); best = Math.min(best,count(mat,i,M)); }System.out.println(best); } public static int count( boolean[][] mat, int center, int M){ int N = mat.length;  int cntWithI = (mat?1:0); for ( int i = 0;(i < N);i++) {if ( (i != center)) {if ( mat[i][center]) {cntWithI++; } if ( mat[center][i]) {cntWithI++; } } mat[i][center] = false; mat[center][i] = false; } int other = (M - cntWithI);  int matches = bipartiteMatching(mat); return ((((((((2 * N) - 1) - cntWithI) + other) - matches) + N) - 1) - matches);} public static boolean[][] makeAdjMat( int N, int[] edgeFrom, int[] edgeTo){ boolean[][] mat = new boolean[N][N]; for ( int i = 0;(i < edgeFrom.length);i++) { int from = (edgeFrom[i] - 1);  int to = (edgeTo[i] - 1); mat[from][to] = true; }return mat;} public static boolean fordFulkersonHelper( int[][] resid, int s, int t, int[] parent){ int V = resid.length;  boolean[] visited = new boolean[V];  LinkedList<Integer> q = new LinkedList<Integer>(); q.push(s); visited[s] = true; parent[s] = -1; while(!q.isEmpty()){ int u = q.pop(); for ( int v = 0;(v < V);v++) {if ( (!visited[v] && (resid[u][v] > 0))) {q.push(v); parent[v] = u; visited[v] = true; } }}return visited[t];} public static boolean bipartiteMatchingHelper( boolean[][] bpGraph, int u, boolean[] seen, int[] matchR){ int N = bpGraph[0].length; for ( int v = 0;(v < N);v++) {if ( (bpGraph[u][v] && !seen[v])) {seen[v] = true; if ( ((matchR[v] < 0) || bipartiteMatchingHelper(bpGraph,matchR[v],seen,matchR))) {matchR[v] = u; return true;} } }return false;} public static int bipartiteMatching( boolean[][] bpGraph, int[] matchIJ, int[] matchJI){ int ans = bipartiteMatching(bpGraph,matchJI); for ( int i = 0;(i < matchJI.length);i++) {matchIJ[i] = -1; }for ( int j = 0;(j < matchJI.length);j++) { int i = matchJI[j]; if ( (i >= 0)) {matchIJ[i] = j; } }return ans;} public static int bipartiteMatching( boolean[][] bpGraph, int[] matchJI){ int M = bpGraph.length;  int N = bpGraph[0].length; for ( int i = 0;(i < N);i++) {matchJI[i] = -1; } int ans = 0; for ( int u = 0;(u < M);u++) { boolean[] seen = new boolean[N]; if ( bipartiteMatchingHelper(bpGraph,u,seen,matchJI)) {ans++; } }return ans;} public static int bipartiteMatching( boolean[][] bpGraph){ int N = bpGraph[0].length;  int[] matchJI = new int[N]; return bipartiteMatching(bpGraph,matchJI);} public static int bipartiteMatching( int[][] intGraph){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph);} public static int bipartiteMatching( int[][] intGraph, int[] matchJI){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph,matchJI);} public static int bipartiteMatching( int[][] intGraph, int[] matchIJ, int[] matchJI){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph,matchIJ,matchJI);} public static boolean[][] intToBooleanAdjMat( int[][] mat){ int M = mat.length;  int N = mat[0].length;  boolean[][] bMat = new boolean[M][N]; for ( int i = 0;(i < M);i++) {for ( int j = 0;(j < N);j++) {bMat[i][j] = (mat[i][j] != 0); }}return bMat;} public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } int nextInt(){ return Integer.parseInt(next());} String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} } }
0	public class Contests{ public static void main( String[] args){ Scanner clavier = new Scanner(System.in);  long a = clavier.nextLong(); clavier.close(); if ( (a == 1)) System.out.println(5); else System.out.println(25); } }
1	public class alex{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int sum = 1; for ( int i = 1;(i <= n);i++) {sum = (sum + (4 * (i - 1))); }System.out.println(sum); } }
0	public class codeforces{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int test = 1; for ( int ind = 0;(ind < test);ind++) { int[] a = new int[3]; a[0] = sc.nextInt(); a[1] = sc.nextInt(); a[2] = sc.nextInt(); Arrays.sort(a); int k1 = a[0];  int k2 = a[1];  int k3 = a[2]; if ( (((k1 == 1) || (k2 == 1)) || (k3 == 1))) {out.println("YES"); } else if ( (((k1 == 2) && (k2 == 2)) || ((k2 == 2) && (k3 == 2)))) {out.println("YES"); } else if ( (((k1 == 3) && (k2 == 3)) && (k3 == 3))) {out.println("YES"); } else if ( (((k1 == 2) && (k2 == 4)) && (k3 == 4))) {out.println("YES"); } else out.println("NO"); }out.flush(); } static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} } class Scanner{ public BufferedReader reader ; public StringTokenizer st ; public Scanner( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); st = null; } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{ String line = reader.readLine(); if ( (line == null)) return null; st = new StringTokenizer(line); }catch (Exception e){ throw (new RuntimeException());} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} }
0	public class Main{ boolean eof ; String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ eof = true; return "-1";} }return st.nextToken();} int nextInt(){ return Integer.parseInt(nextToken());} void solve(){ long n = nextInt(),ans = n; if ( ((n % 6) == 0)) {ans = Math.max((((n - 1) * (n - 2)) * (n - 3)),ans); } else if ( ((n % 2) == 0)) {ans = Math.max(ans,((n * (n - 1)) * (n - 3))); } else {ans = Math.max(((n * (n - 1)) * (n - 2)),ans); }out.print(ans); } BufferedReader br ; StringTokenizer st ; PrintWriter out ; void run(){ try{br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(new OutputStreamWriter(System.out)); solve(); br.close(); out.close(); }catch (Throwable e){ e.printStackTrace(); System.exit(1); } } public static void main( String[] args){ new Main().run(); } }
1	public class LightItUp{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int m = Integer.parseInt(st.nextToken());  int previous = 0;  int array[] = new int[(n + 1)];  int answer = 0;  StringTokenizer st1 = new StringTokenizer(br.readLine()); for ( int i = 0;(i < n);i++) {array[i] = Integer.parseInt(st1.nextToken()); if ( ((i % 2) == 0)) {answer += (array[i] - previous); } previous = array[i]; }if ( ((n % 2) == 0)) {answer += (m - previous); } previous = m; int max = Integer.MAX_VALUE; while((n-- != 0)){ int temp = array[n]; if ( ((n % 2) == 0)) {array[n] = (array[(n + 1)] - (previous - array[n])); } else {array[n] = (array[(n + 1)] + (previous - array[n])); }previous = temp; max = Math.min(max,array[n]); }if ( (max >= -1)) {System.out.println(answer); } else {System.out.println((answer - (max + 1))); }} }
0	public class Round_146_A{ public static void main( String[] args){ new Round_146_A().go(); } void go(){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  long result = solve(n);  PrintStream out = System.out; out.println(result); } static long solve( int n){ if ( (n == 1)) return 1; if ( (n == 2)) return 2; if ( ((n % 2) == 0)) {if ( ((n % 3) == 0)) return (((long)(n - 1) * (n - 2)) * (n - 3)); else return (((long)n * (n - 1)) * (n - 3));} else return (((long)n * (n - 1)) * (n - 2));} }
3	public class probC{ static int r ; static ArrayList<Circ> curr = new ArrayList<Circ>(); public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); r = sc.nextInt(); int[] xC = new int[n]; for ( int i = 0;(i < n);i++) xC[i] = sc.nextInt(); double ans[] = new double[n]; ans[0] = r; curr.add(new Circ(xC[0],r)); for ( int i = 1;(i < n);i++) { double max = r; for ( int k = 0;(k < curr.size());k++) { double cur = (curr.get(k).y + Math.sqrt((((4 * r) * r) - ((xC[i] - curr.get(k).x) * (xC[i] - curr.get(k).x))))); if ( ((((4 * r) * r) - ((xC[i] - curr.get(k).x) * (xC[i] - curr.get(k).x))) >= 0)) max = Math.max(cur,max); }ans[i] = max; curr.add(new Circ(xC[i],max)); }for ( int i = 0;(i < n);i++) System.out.print((ans[i] + " ")); sc.close(); } static class Circ{ double x ,y ; public Circ( double a, double b){ x = a; y = b; } } }
6	public class B{ static int n ; static double A ; static int[] L ; static int[] B ; static double max = 0; public static void rec( int index, int k){ if ( (k < 0)) return ; if ( (index == n)) { double prob = 0; for ( int i = 0;(i < (1 << n));i++) { double b = 0;  double temp = 1.0; for ( int j = 0;(j < n);j++) {if ( (L[j] > 100)) return ; if ( ((i & (1 << j)) == 0)) {b += B[j]; temp *= ((100 - L[j]) / 100.0); } else temp *= (L[j] / 100.0); }if ( ((Integer.bitCount(i) * 2) <= n)) temp *= (A / (A + b)); prob += temp; }max = Math.max(max,prob); return ;} L[index] += 10; rec(index,(k - 1)); L[index] -= 10; rec((index + 1),k); } public static void main( String[] args){ Scanner in = new Scanner(System.in); n = in.nextInt(); int k = in.nextInt(); A = in.nextDouble(); B = new int[n]; L = new int[n]; for ( int i = 0;(i < n);i++) {B[i] = in.nextInt(); L[i] = in.nextInt(); }rec(0,k); System.out.println(max); } }
6	public class A{ static double[][] a ; static int N ; static double[][] memo ; static double[] dp( int alive){ int count = Integer.bitCount(alive); if ( (count == 1)) { double[] ret = new double[N]; for ( int i = 0;(i < N);++i) if ( ((alive & (1 << i)) != 0)) {ret[i] = 1; break;} return memo[alive] = ret;} if ( (memo[alive] != null)) return memo[alive]; double[] ret = new double[N]; for ( int j = 0;(j < N);++j) if ( ((alive & (1 << j)) != 0)) { double[] nxt = dp((alive & (1 << j))); for ( int i = 0;(i < N);++i) ret[i] += (die[j][alive] * nxt[i]); } return memo[alive] = ret;} static double[][] die ; static void f(){ die = new double[N][(1 << N)]; for ( int i = 0;(i < N);++i) for ( int j = 0;(j < (1 << N));++j) { int count = Integer.bitCount(j); if ( (count <= 1)) continue; double prop = (1.0 / ((count * (count - 1)) >> 1)); for ( int k = 0;(k < N);++k) if ( ((j & (1 << k)) != 0)) die[i][j] += (prop * a[k][i]); }} public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out); N = sc.nextInt(); a = new double[N][N]; for ( int i = 0;(i < N);++i) for ( int j = 0;(j < N);++j) a[i][j] = sc.nextDouble(); memo = new double[(1 << N)][]; f(); double[] ret = dp(((1 << N) - 1)); for ( int i = 0;(i < (N - 1));++i) out.printf("%.8f ",ret[i]); out.printf("%.8f\n",ret[(N - 1)]); out.flush(); out.close(); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public double nextDouble()throws NumberFormatException,IOException { return Double.parseDouble(next());} public int nextInt()throws IOException { return Integer.parseInt(next());} public boolean ready()throws IOException { return br.ready();} } }
2	public class A{ long mod = (long)(1e+9 + 9); long pow( long a, long b){ long mul = a;  long res = 1; while((b > 0)){if ( ((b % 2) == 1)) {res = ((res * mul) % mod); } mul = ((mul * mul) % mod); b /= 2; }return res;} void solve()throws IOException { long n = nextLong();  long m = nextLong();  long k = nextLong();  long l = -1;  long r = (m / k); while((l < (r - 1))){ long mid = ((l + r) / 2);  long leftOk = (m - (mid * k));  long leftPos = (n - (mid * k));  long cgroups = ((leftOk + (k - 2)) / (k - 1));  long positions = ((leftOk + cgroups) - 1); if ( (positions <= leftPos)) {r = mid; } else {l = mid; }} long res = pow(2,(r + 1)); res = (((res - 2) + mod) % mod); res = ((res * k) % mod); res = (((res + m) - (r * k)) % mod); out.println(res); } void run()throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.close(); } public static void main( String[] args)throws IOException { new A().run(); } BufferedReader in ; PrintWriter out ; StringTokenizer st ; String next()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String temp = in.readLine(); if ( (temp == null)) {return null;} st = new StringTokenizer(temp); }return st.nextToken();} long nextLong()throws IOException { return Long.parseLong(next());} }
6	public class Main{ public void go(){ int n = sc.nextInt(),k = sc.nextInt(),A = sc.nextInt();  ArrayList<ArrayList<Integer>> waysGiveCandies = doit1(n,k,new ArrayList<Integer>());  int[] lvl = new int[n],loyal = new int[n]; for ( int i = 0;(i < n);++i) {lvl[i] = sc.nextInt(); loyal[i] = sc.nextInt(); } double ret = 0; for ( ArrayList<Integer> distribution :waysGiveCandies) { double[] Loyal = new double[n]; for ( int i = 0;(i < n);++i) Loyal[i] = (min((loyal[i] + (10 * distribution.get(i))),100) / 100.0); double pWin = 0; for ( int i = 0;(i < (1 << n));++i) { double pVoteOccurs = 1; for ( int j = 0;(j < n);++j) if ( ((i & (1 << j)) != 0)) pVoteOccurs *= Loyal[j]; else pVoteOccurs *= (1 - Loyal[j]); int B = 0; for ( int j = 0;(j < n);++j) if ( ((i & (1 << j)) == 0)) B += lvl[j];  double pWinFight = ((double)A / (A + B)); if ( ((bit_count(i) * 2) > n)) pWinFight = 1; pWin += (pVoteOccurs * pWinFight); }ret = max(ret,pWin); }System.out.printf("%.9f\n",ret); } ArrayList<ArrayList<Integer>> doit1( int n, int k, ArrayList<Integer> soFar){ ArrayList<ArrayList<Integer>> ret = new ArrayList<ArrayList<Integer>>(); if ( (n == 1)) {soFar.add(k); ret.add(soFar); return ret;} for ( int i = 0;(i < (k + 1));++i) { ArrayList<Integer> tmp = new ArrayList<Integer>(soFar); tmp.add(i); ret.addAll(doit1((n - 1),(k - i),tmp)); }return ret;} public static final int INF = (((1000 * 1000) * 1000) + 7); public static final double EPS = 1e-9; public static final double PI = (2 * acos(0.0)); public int bit_count( long x){ return ((x == 0)?0:(1 + bit_count((x & (x - 1)))));} static myScanner sc ; static PrintWriter pw ; static long startTime ; public static void main( String[] args)throws Exception { sc = new Main().new myScanner(new BufferedReader(new InputStreamReader(System.in))); pw = new PrintWriter(System.out); startTime = System.nanoTime(); new Main().go(); pw.flush(); System.exit(0); } }
6	public class InVoker{ static long mod = 1000000007; static long mod2 = 998244353; static FastReader inp = new FastReader(); static PrintWriter out = new PrintWriter(System.out); public static void main( String[] args){ InVoker g = new InVoker(); g.main(); out.close(); } int dp[] ; int freq[][] ; int m ; void main(){ int n = inp.nextInt(); m = inp.nextInt(); String s = inp.next(); dp = new int[(1 << m)]; Arrays.fill(dp,-1); freq = new int[m][m]; for ( int i = 0;(i < (n - 1));i++) { int x = (s.charAt(i) - 'a');  int y = (s.charAt((i + 1)) - 'a'); if ( (x == y)) continue; freq[x][y]++; freq[y][x]++; }out.println(go(0,0)); } int go( int pos, int mask){ if ( (pos == m)) return 0; if ( (dp[mask] != -1)) return dp[mask]; int gg = Integer.MAX_VALUE; for ( int i = 0;(i < m);i++) {if ( (((mask >> i) & 1) == 1)) continue; int cost = 0; for ( int j = 0;(j < m);j++) {if ( (((mask >> j) & 1) == 1)) cost += (freq[i][j] * pos); else cost -= (freq[i][j] * pos); }cost += go((pos + 1),(mask | (1 << i))); gg = Math.min(gg,cost); }return dp[mask] = gg;} void sort( int[] a){ ArrayList<Integer> list = new ArrayList<>(); for ( int x :a) list.add(x); Collections.sort(list); for ( int i = 0;(i < a.length);i++) a[i] = list.get(i); } void sort( long[] a){ ArrayList<Long> list = new ArrayList<>(); for ( long x :a) list.add(x); Collections.sort(list); for ( int i = 0;(i < a.length);i++) a[i] = list.get(i); } static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } long fact[] ; long invFact[] ; long mul( long a, long b){ return ((a * b) % mod);} long add( long a, long b){ return ((a + b) % mod);} long power( long x, long y){ long gg = 1; while((y > 0)){if ( ((y % 2) == 1)) gg = mul(gg,x); x = mul(x,x); y /= 2; }return gg;} static long gcd( long a, long b){ return ((b == 0)?a:gcd(b,(a % b)));} static int gcd( int a, int b){ return ((b == 0)?a:gcd(b,(a % b)));} void print( int[] a){ int n = a.length; for ( int i = 0;(i < n);i++) out.print((a[i] + " ")); } void print( long[] a){ int n = a.length; for ( int i = 0;(i < n);i++) out.print((a[i] + " ")); } }
6	public class E implements Runnable{ public static void main( String[] args){ new Thread(null,new E(),"_cf",(1 << 28)).start(); } int n ,m ; char[] str ; int[][] occs ,cost ; int[] dp ; int oo = (int)1e9; int min( int a, int b){ if ( (a < b)) return a; return b;} class FastScanner{ public int BS = (1 << 16); public char NC = (char)0; byte[] buf = new byte[BS]; int bId = 0,size = 0; char c = NC; double num = 1; BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } public char nextChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ num = 1; boolean neg = false; if ( (c == NC)) c = nextChar(); for ( ;((c < '0') || (c > '9'));c = nextChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = nextChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); num *= 10; }return (neg?-res:res);} public String next(){ StringBuilder res = new StringBuilder(); while((c <= 32))c = nextChar(); while((c > 32)){res.append(c); c = nextChar(); }return res.toString();} } }
4	public class Main{ static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ boolean env = (System.getProperty("ONLINE_JUDGE") != null); if ( !env) {try{br = new BufferedReader(new FileReader("src\\input.txt")); }catch (FileNotFoundException e){ e.printStackTrace(); } } else br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } static long MOD = ((long)1e9 + 7); static FastReader sc = new FastReader(); static PrintWriter out = new PrintWriter(System.out); static long memo[] ; static long C[][] ; static long exp( long a, long x){ if ( (x == 0)) return 1; if ( ((x % 2) == 0)) return (exp(((a * a) % MOD),(x / 2)) % MOD); return (((a % MOD) * (exp(((a * a) % MOD),(x / 2)) % MOD)) % MOD);} static void fill( int n){ C = new long[(n + 1)][(n + 1)]; for ( int i = 1;(i <= n);i++) C[i][0] = C[i][i] = 1; for ( int i = 2;(i <= n);i++) {for ( int j = 1;(j <= n);j++) {C[i][j] = ((C[(i - 1)][j] + C[(i - 1)][(j - 1)]) % MOD); }}} public static void main( String[] args)throws java.lang.Exception { int test = 1; while((test-- > 0)){ int n = sc.nextInt(); MOD = sc.nextLong(); memo = new long[(n + 1)]; fill(n); long dp[][] = new long[(n + 5)][(n + 5)]; for ( int i = 1;(i <= n);i++) dp[i][i] = exp(2,(i - 1)); for ( int i = 2;(i <= n);i++) {for ( int j = 1;(j < i);j++) {for ( int k = 1;(k <= j);k++) { long val = ((dp[((i - k) - 1)][(j - k)] * C[j][k]) % MOD); if ( (memo[(k - 1)] == 0)) memo[(k - 1)] = exp(2,(k - 1)); val = ((val * memo[(k - 1)]) % MOD); dp[i][j] = ((dp[i][j] + val) % MOD); }}} long ans = 0; for ( int i = 0;(i <= n);i++) ans = ((ans + dp[n][i]) % MOD); out.println(ans); }out.flush(); out.close(); } }
0	public class T{ public static void main( String[] args)throws IOException { T t = new T(); t.run(); t.close(); } private void close(){ sc.close(); pw.close(); } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); Scanner sc = new Scanner(reader); PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); void run()throws IOException { int n = sc.nextInt(); if ( ((n % 2) == 0)) {pw.print(((4 + " ") + (n - 4))); } else {pw.print(((9 + " ") + (n - 9))); }} }
5	public class Main{ static long initTime ; static final Random rnd = new Random(7777L); static boolean writeLog = false; public static void main( String[] args)throws IOException { initTime = System.currentTimeMillis(); try{writeLog = "true".equals(System.getProperty("LOCAL_RUN_7777")); }catch (SecurityException e){ } new Thread(null,new Runnable(){public void run(){ try{try{if ( new File("input.txt").exists()) System.setIn(new FileInputStream("input.txt"));  }catch (SecurityException e){ } long prevTime = System.currentTimeMillis(); new Main().run(); log((("Total time: " + (System.currentTimeMillis() - prevTime)) + " ms")); log(("Memory status: " + memoryStatus())); }catch (IOException e){ e.printStackTrace(); } } },"1",(1L << 24)).start(); } void run()throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.close(); in.close(); } void solve()throws IOException { int n = nextInt();  long k = nextLong();  int[] a = nextIntArray(n);  Set<Long> bad = new TreeSet<Long>(); sort(a); int ans = 0; for ( int x :a) {if ( !bad.contains((long)x)) {bad.add((x * k)); ans++; } }out.println(ans); } BufferedReader in ; PrintWriter out ; StringTokenizer st = new StringTokenizer(""); String nextToken()throws IOException { while(!st.hasMoreTokens())st = new StringTokenizer(in.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} long nextLong()throws IOException { return Long.parseLong(nextToken());} double nextDouble()throws IOException { return Double.parseDouble(nextToken());} int[] nextIntArray( int size)throws IOException { int[] ret = new int[size]; for ( int i = 0;(i < size);i++) ret[i] = nextInt(); return ret;} static String memoryStatus(){ return (((((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20) + "/") + (Runtime.getRuntime().totalMemory() >> 20)) + " MB");} static long prevTimeStamp = Long.MIN_VALUE; static long elapsedTime(){ return (System.currentTimeMillis() - prevTimeStamp);} static void log( String format, Object... args){ if ( writeLog) System.err.println(String.format(Locale.US,format,args)); } }
6	public final class CF_599_D1_C{ static boolean verb = true; static void log( Object X){ if ( verb) System.err.println(X); } static void log( Object[] X){ if ( verb) {for ( Object U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X){ if ( verb) {for ( int U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X, int L){ if ( verb) {for ( int i = 0;(i < L);i++) System.err.print((X[i] + " ")); System.err.println(""); } } static void log( long[] X){ if ( verb) {for ( long U :X) System.err.print((U + " ")); System.err.println(""); } } static void output( Object o){ outputWln((("" + o) + "\n")); } static void outputWln( Object o){ try{out.write(("" + o)); }catch (Exception e){ } } static long mod = 1000000007; static BufferedWriter out ; static InputReader reader ; static void explore( ArrayList<Integer>[] components, ArrayList<Integer> bob, int[][] move, ArrayList<int[]>[] howto, int[][] list){ for ( int x :bob) {if ( (components[x].size() == 1)) { int tm[] = howto[x].get(0);  int L = howto[x].size(); howto[x].add(tm); for ( int i = 0;(i < L);i++) { int[] cur = howto[x].get(i);  int[] nx = howto[x].get((i + 1));  int a = cur[0];  int a2 = nx[0];  int b2 = nx[1]; move[a2][0] = list[a2][b2]; move[a2][1] = a; }} else {explore(components,components[x],move,howto,list); }}} static void process()throws Exception { out = new BufferedWriter(new OutputStreamWriter(System.out)); reader = new InputReader(System.in); int k = reader.readInt();  int[][] list = new int[k][];  long[] sum = new long[k];  int[] L = new int[k];  HashMap<Integer,int[]> target = new HashMap<Integer,int[]>();  long tot = 0; for ( int i = 0;(i < k);i++) {L[i] = reader.readInt(); list[i] = new int[L[i]]; for ( int j = 0;(j < L[i]);j++) {list[i][j] = reader.readInt(); sum[i] += list[i][j]; target.put(list[i][j],new int[]{i,j}); }tot += sum[i]; } int MX = (1 << k);  int AX = 1000000001;  ArrayList<int[]>[] howto = new ArrayList[MX]; log("ok with the data"); if ( ((tot % k) != 0)) {output("No"); } else {tot /= k; for ( int i = 0;(i < k);i++) {if ( (sum[i] == tot)) { int mask = (1 << i);  ArrayList<int[]> cand = new ArrayList<int[]>(); cand.add(new int[]{i,0}); howto[mask] = cand; } else for ( int j = 0;(j < L[i]);j++) { int u = i;  int v = j;  boolean ok = true;  int src_u = u;  int src_v = v;  int mask = 0;  boolean goon = true;  ArrayList<int[]> cand = new ArrayList<int[]>(); while(goon){cand.add(new int[]{u,v}); ok = false; goon = false; long need = (tot - ((long)sum[u] - (long)list[u][v])); if ( (Math.abs(need) <= AX)) { int nd = (int)need;  int[] tm = target.get(nd); if ( (tm != null)) { int nxu = tm[0];  int nxv = tm[1]; if ( ((mask & (1 << nxu)) == 0)) {mask |= (1 << nxu); if ( (nxu == src_u)) {if ( (nxv == src_v)) ok = true; } else {u = nxu; v = nxv; ok = true; goon = true; }} } } }if ( ok) {if ( (howto[mask] == null)) {howto[mask] = cand; } } }}log("step 1 done"); ArrayList[] components = new ArrayList[MX];  int[] msk = new int[MX];  int w = 0; for ( int m = 0;(m < MX);m++) {if ( (howto[m] != null)) {components[m] = new ArrayList<Integer>(); components[m].add(m); msk[w++] = m; } } int base = w; for ( int e = 0;(e < base);e++) { int a = msk[e];  int ww = w; for ( int i = 0;(i < ww);i++) { int b = msk[i]; if ( ((b & a) == 0)) { int c = (b | a); if ( (components[c] == null)) {components[c] = new ArrayList<Integer>(); components[c].add(a); components[c].add(b); msk[w++] = c; } } }}if ( (components[(MX - 1)] != null)) {output("Yes"); int[][] move = new int[k][2]; explore(components,components[(MX - 1)],move,howto,list); for ( int i = 0;(i < k);i++) {output(((move[i][0] + " ") + (move[i][1] + 1))); }} else {output("No"); }}try{out.close(); }catch (Exception e){ } } public static void main( String[] args)throws Exception { process(); } static final class InputReader{ private final InputStream stream ; private final byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read()throws IOException { if ( (curChar >= numChars)) {curChar = 0; numChars = stream.read(buf); if ( (numChars <= 0)) {return -1;} } return buf[curChar++];} public final int readInt()throws IOException { int c = read();  boolean neg = false; while(isSpaceChar(c)){c = read(); } char d = (char)c; if ( (d == '-')) {neg = true; c = read(); } int res = 0; do {res *= 10; res += (c - '0'); c = read(); }while(!isSpaceChar(c));if ( neg) return -res; return res;} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
2	public class Main{ public static void main( String[] args)throws Exception { InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  Task task = new Task(); task.solve(in,out); out.close(); } static class Rectangle{ int x1 ,y1 ; int x2 ,y2 ; } static class Task{ public void solve( InputReader in, PrintWriter out){ int n = in.nextInt();  int l = 1;  int r = n;  int ans = 0; while((r >= l)){ int mid = ((r + l) / 2); if ( (ask(in,out,1,1,mid,n) == 0)) {l = (mid + 1); } else {ans = mid; r = (mid - 1); }}if ( ((ans < n) && (ask(in,out,(ans + 1),1,n,n) == 1))) { Rectangle r1 = find(in,out,1,1,ans,n,n);  Rectangle r2 = find(in,out,(ans + 1),1,n,n,n); System.out.printf("! %d %d %d %d %d %d %d %d\n",r1.x1,r1.y1,r1.x2,r1.y2,r2.x1,r2.y1,r2.x2,r2.y2); } else {l = 1; r = n; ans = 0; while((r >= l)){ int mid = ((r + l) / 2); if ( (ask(in,out,1,1,n,mid) == 0)) {l = (mid + 1); } else {ans = mid; r = (mid - 1); }} Rectangle r1 = find(in,out,1,1,n,ans,n);  Rectangle r2 = find(in,out,1,(ans + 1),n,n,n); System.out.printf("! %d %d %d %d %d %d %d %d\n",r1.x1,r1.y1,r1.x2,r1.y2,r2.x1,r2.y1,r2.x2,r2.y2); }} public Rectangle find( InputReader in, PrintWriter out, int x1, int y1, int x2, int y2, int n){ Rectangle rec = new Rectangle();  int ansx1 = x1;  int ansx2 = x2;  int ansy1 = y1;  int ansy2 = y2;  int l = x1;  int r = x2; while((r >= l)){ int mid = ((r + l) / 2); if ( (ask(in,out,x1,y1,mid,y2) == 1)) {ansx2 = mid; r = (mid - 1); } else {l = (mid + 1); }}r = x2; l = x1; while((r >= l)){ int mid = ((r + l) / 2); if ( (ask(in,out,mid,y1,x2,y2) == 1)) {ansx1 = mid; l = (mid + 1); } else {r = (mid - 1); }}l = y1; r = y2; while((r >= l)){ int mid = ((r + l) / 2); if ( (ask(in,out,x1,y1,x2,mid) == 1)) {ansy2 = mid; r = (mid - 1); } else {l = (mid + 1); }}r = y2; l = y1; while((r >= l)){ int mid = ((r + l) / 2); if ( (ask(in,out,x1,mid,x2,y2) == 1)) {ansy1 = mid; l = (mid + 1); } else {r = (mid - 1); }}rec.x1 = ansx1; rec.x2 = ansx2; rec.y1 = ansy1; rec.y2 = ansy2; return rec;} public int ask( InputReader in, PrintWriter out, int x1, int y1, int x2, int y2){ System.out.printf("? %d %d %d %d\n",x1,y1,x2,y2); System.out.flush(); return in.nextInt();} } 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());} } }
0	public class lcm{ static int n ; public static void main( String[] args)throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); n = Integer.parseInt(in.readLine()); System.out.println(lcm(n)); in.close(); } static long lcm( int n){ if ( (n == 1)) return 1; if ( (n == 2)) return 2; if ( ((n % 6) == 0)) { long ans = (n - 1); ans *= (n - 2); ans *= (n - 3); return ans;} if ( ((n % 2) == 0)) { long ans = n; ans *= (n - 1); ans *= (n - 3); return ans;} long ans = n; ans *= (n - 1); ans *= (n - 2); return ans;} }
6	public class TaskC{ final int INF = 123456; int[][][] memo ; int N ,M ; int solve( int row, int prevFreeMask, int curStayMask){ if ( (row == N)) return ((curStayMask == 0)?0:-INF); if ( (memo[row][prevFreeMask][curStayMask] != -1)) return memo[row][prevFreeMask][curStayMask]; int res = 0; for ( int mask = 0;(mask < (1 << M));mask++) {if ( ((mask & curStayMask) == curStayMask)) { int freeCellsMask = (((1 << M) - 1) - mask);  int toMoveMask = freeCellsMask; for ( int i = 0;(i < M);i++) {if ( ((toMoveMask & (1 << i)) > 0)) {if ( (i > 0)) {if ( ((mask & (1 << (i - 1))) > 0)) {toMoveMask -= (1 << i); continue;} } if ( (i < (M - 1))) {if ( ((mask & (1 << (i + 1))) > 0)) {toMoveMask -= (1 << i); continue;} } } }if ( (row > 0)) {for ( int prevFillMask = toMoveMask;(prevFillMask > 0);prevFillMask = ((prevFillMask - 1) & toMoveMask)) { int bc1 = Integer.bitCount(freeCellsMask);  int bc2 = Integer.bitCount((prevFreeMask & prevFillMask)); res = Math.max(res,((bc1 - bc2) + solve((row + 1),freeCellsMask,(toMoveMask ^ prevFillMask)))); }} res = Math.max(res,(Integer.bitCount(freeCellsMask) + solve((row + 1),freeCellsMask,toMoveMask))); } }return memo[row][prevFreeMask][curStayMask] = res;} void run(){ N = nextInt(); M = nextInt(); if ( (M > N)) { int temp = M; M = N; N = temp; } this.memo = new int[(N + 1)][(1 << M)][(1 << M)]; for ( int[][] g :memo) for ( int[] f :g) Arrays.fill(f,-1); System.out.println(solve(0,0,0)); } int nextInt(){ try{ int c = System.in.read(); if ( (c == -1)) return c; while(((c != '-') && ((c < '0') || ('9' < c)))){c = System.in.read(); if ( (c == -1)) return c; }if ( (c == '-')) return -nextInt(); int res = 0; do {res *= 10; res += (c - '0'); c = System.in.read(); }while((('0' <= c) && (c <= '9')));return res; }catch (Exception e){ return -1;} } long nextLong(){ try{ int c = System.in.read(); if ( (c == -1)) return -1; while(((c != '-') && ((c < '0') || ('9' < c)))){c = System.in.read(); if ( (c == -1)) return -1; }if ( (c == '-')) return -nextLong(); long res = 0; do {res *= 10; res += (c - '0'); c = System.in.read(); }while((('0' <= c) && (c <= '9')));return res; }catch (Exception e){ return -1;} } String next(){ try{ StringBuilder res = new StringBuilder("");  int c = System.in.read(); while(Character.isWhitespace(c))c = System.in.read(); do {res.append((char)c); }while(!Character.isWhitespace(c = System.in.read()));return res.toString(); }catch (Exception e){ return null;} } public static void main( String[] args){ new TaskC().run(); } }
0	public class Lcm{ public static void main( String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  long n = Long.parseLong(br.readLine()); if ( (n <= 2)) System.out.println(n); else {if ( ((n % 6) == 0)) {System.out.println((((n - 1) * (n - 2)) * (n - 3))); } else if ( ((n % 2) == 0)) {System.out.println(((n * (n - 1)) * (n - 3))); } else {System.out.println(((n * (n - 1)) * (n - 2))); }}} }
0	public class RENAMETHISBITCH{ public static void main( String[] args){ try(Scanner sc=new Scanner(System.in)){ int n = sc.nextInt();  BigInteger m = sc.nextBigInteger(); System.out.println(m.mod(BigInteger.valueOf(2).pow(n))); }catch (Exception e){ e.printStackTrace(); } } }
2	public class E extends Thread{ public E( String inputFileName, String outputFileName){ try{if ( (inputFileName != null)) {this.input = new BufferedReader(new FileReader(inputFileName)); } else {this.input = new BufferedReader(new InputStreamReader(System.in)); }if ( (outputFileName != null)) {this.output = new PrintWriter(outputFileName); } else {this.output = new PrintWriter(System.out); }this.setPriority(Thread.MAX_PRIORITY); }catch (Throwable e){ System.err.println(e.getMessage()); e.printStackTrace(); System.exit(666); } } private void solve()throws Throwable { long l = nextLong(),r = nextLong();  int[] bitL = new int[63];  int[] bitR = new int[63];  int szL = doit(l,bitL);  int szR = doit(r,bitR);  int ret = szR; while(((ret >= 0) && (bitL[ret] == bitR[ret])))--ret; if ( (ret < 0)) {output.println(0); } else {output.println(((1L << (ret + 1)) - 1)); }} static final int doit( long q, int[] a){ int sz = 0; while((q != 0L)){a[sz++] = (int)(q & 1L); q >>= 1; }return sz;} public static void main( String... args){ new E(null,null).start(); } private long nextLong()throws IOException { return Long.parseLong(next());} private String next()throws IOException { while(((tokens == null) || !tokens.hasMoreTokens())){tokens = new StringTokenizer(input.readLine()); }return tokens.nextToken();} private StringTokenizer tokens ; private BufferedReader input ; private PrintWriter output ; }
3	public class A{ void solve(){ int n = ni();  long r = ni();  int x[] = new int[(n + 1)]; for ( int i = 1;(i <= n);i++) x[i] = ni(); double ans[] = new double[(n + 1)]; ans[1] = r; for ( int i = 2;(i <= n);i++) { double mx = 0; for ( int j = 1;(j < i);j++) { double xx = Math.abs((x[i] - x[j])); if ( (xx > (2 * r))) {mx = Math.max(mx,r); } else {xx *= xx; mx = Math.max(mx,(ans[j] + Math.sqrt((((4 * r) * r) - xx)))); }}ans[i] = mx; }for ( int i = 1;(i <= n);i++) pw.print((ans[i] + " ")); } long M = ((long)1e9 + 7); InputStream is ; PrintWriter pw ; String INPUT = ""; void run()throws Exception { is = (INPUT.isEmpty()?System.in:new ByteArrayInputStream(INPUT.getBytes())); pw = new PrintWriter(System.out); long s = System.currentTimeMillis(); solve(); pw.flush(); if ( !INPUT.isEmpty()) tr(((System.currentTimeMillis() - s) + "ms")); } public static void main( String[] args)throws Exception { new A().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 void tr( Object... o){ if ( (INPUT.length() > 0)) System.out.println(Arrays.deepToString(o)); } }
0	public class composite{ public static void main( String[] args){ Scanner s = new Scanner(System.in);  int a = s.nextInt(); if ( ((a % 2) == 0)) {a = (a - 4); System.out.println(((4 + " ") + a)); } else {a = (a - 9); System.out.println(((9 + " ") + a)); }} }
2	public class cf_contest_1177_problem_B{ public static void main( String[] args){ Scanner s = new Scanner(System.in);  long k = s.nextLong(); if ( (k <= 9)) System.out.println(k); else { int c = 1; while((k > (c * (Math.pow(10,c) - Math.pow(10,(c - 1)))))){k -= (c * (Math.pow(10,c) - Math.pow(10,(c - 1)))); c++; } long mo = (k % c); k = (k / c); if ( (mo == 0)) {mo = c; k--; } mo--; long j = (long)(Math.pow(10,(c - 1)) + k);  String j1 = ("" + j); System.out.println(j1.charAt((int)mo)); }} }
1	public class MinimumDiameterTree{ public static void main( String[] args){ InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt();  int s = in.nextInt();  int deg[] = new int[n]; for ( int i = 1;(i < n);++i) {deg[(in.nextInt() - 1)]++; deg[(in.nextInt() - 1)]++; } int l = 0; for ( int i = 0;(i < n);++i) if ( (deg[i] == 1)) l++; out.println((((double)2 * s) / l)); out.close(); } public 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());} } }
6	public class C implements Runnable{ String file = "input"; boolean TEST = false; void solve()throws IOException { rows = nextInt(); cols = nextInt(); if ( (cols > rows)) { int t = rows; rows = cols; cols = t; } dp = new int[rows][cols][(1 << cols)][(1 << cols)][(1 << cols)]; for ( int i = 0;(i < rows);i++) for ( int j = 0;(j < cols);j++) for ( int k = 0;(k < (1 << cols));k++) for ( int u = 0;(u < (1 << cols));u++) for ( int v = 0;(v < (1 << cols));v++) dp[i][j][k][u][v] = -1; out.println(go(0,0,0,0,0)); } int rows ,cols ; int[][][][][] dp ; int INF = (1 << 20); int go( int i, int j, int a, int b, int c){ if ( (i == rows)) {return ((((a == 0) && (b == 0)) && (c == 0))?0:-INF);} if ( ((((i + 1) == rows) && (b != 0)) && (c != 0))) return -INF; if ( (((i + 2) == rows) && (c != 0))) return -INF; if ( (j == cols)) {return go((i + 1),0,b,c,0);} if ( (dp[i][j][a][b][c] != -1)) return dp[i][j][a][b][c]; if ( !test(a,j,-1,-1)) return go(i,(j + 1),a,b,c); int res = -INF; if ( test(a,j,-1,-1)) res = max(res,go(i,(j + 1),set(a,j,-1,-1),b,c)); if ( (test(a,j,-1,-1) && test(b,j,-1,-1))) res = max(res,(go(i,(j + 1),set(a,j,-1,-1),set(b,j,-1,-1),c) + 1)); if ( (((j + 2) <= cols) && test(a,j,(j + 1),-1))) res = max(res,(go(i,(j + 2),set(a,j,(j + 1),-1),b,c) + 1)); if ( (((j + 3) <= cols) && test(a,j,(j + 1),(j + 2)))) res = max(res,(go(i,(j + 2),set(a,j,(j + 1),(j + 2)),b,c) + 2)); if ( ((test(a,j,-1,-1) && test(b,j,-1,-1)) && test(c,j,-1,-1))) res = max(res,(go(i,(j + 1),set(a,j,-1,-1),set(b,j,-1,-1),set(c,j,-1,-1)) + 2)); if ( (((((j - 1) >= 0) && test(a,j,-1,-1)) && test(b,(j - 1),j,-1)) && test(c,j,-1,-1))) res = max(res,(go(i,(j + 1),set(a,j,-1,-1),set(b,(j - 1),j,-1),set(c,j,-1,-1)) + 3)); if ( (((((j + 2) <= cols) && test(a,j,-1,-1)) && test(b,j,(j + 1),-1)) && test(c,j,-1,-1))) res = max(res,(go(i,(j + 1),set(a,j,-1,-1),set(b,j,(j + 1),-1),set(c,j,-1,-1)) + 3)); if ( ((((j + 3) <= cols) && test(a,j,(j + 1),(j + 2))) && test(b,(j + 1),-1,-1))) res = max(res,(go(i,(j + 3),set(a,j,(j + 1),(j + 2)),set(b,(j + 1),-1,-1),c) + 3)); if ( ((((j + 2) <= cols) && ((j - 1) >= 0)) && test(b,(j - 1),j,(j + 1)))) res = max(res,(go(i,(j + 1),set(a,j,-1,-1),set(b,(j - 1),j,(j + 1)),c) + 3)); if ( (((((j + 2) <= cols) && ((j - 1) >= 0)) && test(b,(j - 1),j,(j + 1))) && test(c,j,-1,-1))) res = max(res,(go(i,(j + 1),set(a,j,-1,-1),set(b,(j - 1),j,(j + 1)),set(c,j,-1,-1)) + 4)); if ( (((j + 2) <= cols) && test(b,j,(j + 1),-1))) res = max(res,(go(i,(j + 1),set(a,j,-1,-1),set(b,j,(j + 1),-1),c) + 2)); if ( (((j - 1) >= 0) && test(b,(j - 1),j,-1))) res = max(res,(go(i,(j + 1),set(a,j,-1,-1),set(b,(j - 1),j,-1),c) + 2)); if ( ((((j + 2) <= cols) && test(a,j,(j + 1),-1)) && test(b,j,-1,-1))) res = max(res,(go(i,(j + 2),set(a,j,(j + 1),-1),set(b,j,-1,-1),c) + 2)); if ( ((((j + 2) <= cols) && test(a,j,(j + 1),-1)) && test(b,(j + 1),-1,-1))) res = max(res,(go(i,(j + 2),set(a,j,(j + 1),-1),set(b,(j + 1),-1,-1),c) + 2)); return dp[i][j][a][b][c] = res;} int set( int a, int i, int j, int k){ if ( (i != -1)) a |= (1 << i); if ( (j != -1)) a |= (1 << j); if ( (k != -1)) a |= (1 << k); return a;} boolean test( int a, int i, int j, int k){ if ( ((i != -1) && (((a >> i) & 1) != 0))) return false; if ( ((j != -1) && (((a >> j) & 1) != 0))) return false; if ( ((k != -1) && (((a >> k) & 1) != 0))) return false; return true;} String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(input.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} BufferedReader input ; PrintWriter out ; StringTokenizer st ; int test ; void init()throws IOException { if ( TEST) input = new BufferedReader(new FileReader((file + ".in"))); else input = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(new BufferedOutputStream(System.out)); } public static void main( String[] args)throws IOException { new Thread(null,new C(),"",(1 << 20)).start(); } }
6	public class CF1238E{ static long[][] Q ; static int N ; static int M ; static long[] mem ; static long[] sums ; public static void main( String[] args)throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); for ( String ln ;((ln = in.readLine()) != null);) { StringTokenizer st = new StringTokenizer(ln); N = parseInt(st.nextToken()); M = parseInt(st.nextToken()); char[] S = in.readLine().toCharArray(); Q = new long[M][M]; mem = new long[(1 << M)]; Arrays.fill(mem,-1); for ( int i = 1;(i < N);i++) Q[(S[(i - 1)] - 'a')][(S[i] - 'a')] = Q[(S[i] - 'a')][(S[(i - 1)] - 'a')] = (Q[(S[(i - 1)] - 'a')][(S[i] - 'a')] + 1); calculateSums(); for ( int i = ((1 << M) - 1);(i >= 0);i--) f(i); System.out.println(f(0)); }} static void calculateSums(){ sums = new long[(1 << M)]; Arrays.fill(sums,-1); for ( int u = 0;(u < (1 << M));u++) {if ( (sums[u] == -1)) {sums[u] = 0; for ( int j = 0;(j < M);j++) for ( int k = (j + 1);(k < M);k++) if ( ((((u & (1 << j)) == 0) && ((u & (1 << k)) != 0)) || (((u & (1 << j)) != 0) && ((u & (1 << k)) == 0)))) sums[u] += Q[j][k];  int neg = (u & ((1 << M) - 1)); sums[neg] = sums[u]; } }} static long f( int u){ if ( (bitCount(u) == M)) return 0; if ( (mem[u] >= 0)) return mem[u]; long min = 10000000000L; for ( int i = 0;(i < M);i++) if ( ((u & (1 << i)) == 0)) {u = (u | (1 << i)); min = Math.min((f(u) + sums[u]),min); u = (u ^ (1 << i)); } return mem[u] = min;} }
6	public class Main{ public static void main( String[] args){ new Main().run(); } FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ int t = in.nextInt(); for ( int i = 0;(i < t);i++) {out.println(work()); }out.flush(); } long mod = 1000000007; long gcd( long a, long b){ return ((b == 0)?a:gcd(b,(a % b)));} int work(){ int n = in.nextInt();  int m = in.nextInt();  int[][] A = new int[n][m];  int[][] B = new int[n][m];  int[][] R = new int[m][2]; for ( int i = 0;(i < m);i++) R[i][1] = i; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {A[i][j] = in.nextInt(); R[j][0] = Math.max(R[j][0],A[i][j]); }}Arrays.sort(R,new Comparator<int[]>(){}); for ( int j = 0;(j < m);j++) { int index = R[j][1]; for ( int i = 0;(i < n);i++) {B[i][j] = A[i][index]; }}m = Math.min(n,m); int[][] dp = new int[m][(1 << n)];  int[][] rec = new int[m][(1 << n)]; for ( int j = 0;(j < m);j++) {for ( int s = 0;(s < n);s++) {for ( int i = 1;(i < (1 << n));i++) { int sum = 0; for ( int b = 0;(b < n);b++) {if ( (((1 << b) & i) > 0)) {sum += B[((b + s) % n)][j]; } }rec[j][i] = Math.max(sum,rec[j][i]); }}}for ( int j = 0;(j < m);j++) {for ( int i = 0;(i < (1 << n));i++) {if ( (j == 0)) {dp[j][i] = rec[j][i]; } else {for ( int p = (i + 1);;p++) {if ( (p >= (1 << n))) break; p = (p | i); dp[j][p] = Math.max(dp[j][p],(rec[j][i] + dp[(j - 1)][(p ^ i)])); }}}}return dp[(m - 1)][((1 << n) - 1)];} } class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ if ( ((st == null) || !st.hasMoreElements())) {try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } } return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} }
5	public class P274A{ public static int i( String s){ return Integer.parseInt(s);} public static void main( String[] args)throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String[] arr = in.readLine().split(" ");  int n = i(arr[0]);  long k = i(arr[1]);  long[] A = new long[n]; arr = in.readLine().split(" "); for ( int i = 0;(i < n);i++) A[i] = i(arr[i]); shuffle(A); Arrays.sort(A); Set<Long> BAN = new HashSet<Long>();  int ans = 0; for ( int i = 0;(i < n);i++) {if ( !BAN.contains(A[i])) {ans++; BAN.add((A[i] * k)); } }System.out.println(ans); } public static void shuffle( long[] array){ for ( int i = array.length;(i > 1);i--) { long temp = array[(i - 1)];  int randIx = (int)(Math.random() * i); array[(i - 1)] = array[randIx]; array[randIx] = temp; }} }
6	public class E5{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ for ( int T = ni();(T > 0);T--) { int n = ni(),m = ni();  int[][] a = new int[m][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {a[j][i] = ni(); }} int[][] mx = new int[m][]; for ( int i = 0;(i < m);i++) { int u = 0; for ( int j = 0;(j < n);j++) {u = Math.max(u,a[i][j]); }mx[i] = new int[]{u,i}; }Arrays.sort(mx,new Comparator<int[]>(){}); int[] dp = new int[(1 << n)]; for ( int i = 0;((i < n) && (i < m));i++) { int c = mx[i][1];  int[] ls = new int[(1 << n)]; for ( int j = 1;(j < (1 << n));j++) {ls[j] = (ls[(j & (j - 1))] + a[c][Integer.numberOfTrailingZeros(j)]); }for ( int j = 1;(j < (1 << n));j++) { int r = rot(j,n); ls[r] = Math.max(ls[r],ls[j]); } int[] ndp = new int[(1 << n)]; for ( int j = 0;(j < (1 << n));j++) {if ( (rot(j,n) == j)) { int cur = j; for ( int sh = 0;(sh < n);sh++) {cur = ((cur >> 1) | ((cur & 1) << (n - 1))); int mask = (((1 << n) - 1) ^ cur); for ( int k = mask;(k >= 0);k--) {k &= mask; ndp[(k | cur)] = Math.max(ndp[(k | cur)],(dp[k] + ls[j])); }}} }dp = ndp; }out.println(dp[((1 << n) - 1)]); }} int rot( int x, int n){ int ret = x; for ( int i = 0;(i < n);i++) {x = ((x >>> 1) | ((x & 1) << (n - 1))); ret = Math.min(ret,x); }return 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 E5().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
5	public class loser{ static class InputReader{ public BufferedReader br ; public StringTokenizer token ; public InputReader( InputStream stream){ br = new BufferedReader(new InputStreamReader(stream),32768); token = null; } public String next(){ while(((token == null) || !token.hasMoreTokens())){try{token = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return token.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } static class card{ int l ; int r ; public card( int ch, int i){ this.l = ch; this.r = i; } } static class sort implements Comparator<card>{ } static void shuffle( long[] a){ List<Long> l = new ArrayList<>(); for ( int i = 0;(i < a.length);i++) l.add(a[i]); Collections.shuffle(l); for ( int i = 0;(i < a.length);i++) a[i] = l.get(i); } public static void main( String[] args){ InputReader sc = new InputReader(System.in);  int n = sc.nextInt();  int s = sc.nextInt();  card c[] = new card[n]; for ( int i = 0;(i < n);i++) { int x = sc.nextInt();  int y = sc.nextInt(); c[i] = new card(x,y); }Arrays.sort(c,new sort()); int time = 0; for ( int i = (n - 1);(i >= 0);i--) {time += (s - c[i].l); if ( ((c[i].r - time) > 0)) time += (c[i].r - time); s = c[i].l; }if ( (c[0].l != 0)) time += c[0].l; System.out.println(time); } }
4	public class Main{ static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } static final int N = 405; static final int mod = 1000000007; static final int INF = 1000000009; static final int numBit = 17; static FastReader r = new FastReader(); static PrintWriter pw = new PrintWriter(System.out); static int[][] dp = new int[N][N]; static int[] p2 = new int[N]; static int[] fac = new int[N]; static int[] ifac = new int[N]; static int M ; public static int mul( int a, int b){ return (int)(((1l * a) * b) % M);} public static int poww( int a, int b){ int r = 1; while((b > 0)){if ( ((b % 2) == 1)) r = mul(r,a); a = mul(a,a); b >>= 1; }return r;} public static int inv( int x){ return poww(x,(M - 2));} public static int add( int a, int b){ a += b; if ( (a >= M)) a -= M; return a;} public static int bino( int n, int k){ return mul(fac[n],mul(ifac[(n - k)],ifac[k]));} public static void main( String[] args)throws IOException { int n = r.nextInt(); M = r.nextInt(); fac[0] = 1; ifac[0] = 1; p2[0] = 1; for ( int i = 1;(i <= n);++i) {fac[i] = mul(fac[(i - 1)],i); ifac[i] = inv(fac[i]); p2[i] = mul(p2[(i - 1)],2); } int ans = 0; dp[0][0] = 1; for ( int i = 0;(i <= n);++i) {for ( int k = 0;(k <= i);++k) {for ( int j = 1;(j <= ((n - i) + 1));++j) {dp[((i + j) + 1)][(k + j)] = add(dp[((i + j) + 1)][(k + j)],mul(dp[i][k],mul(p2[(j - 1)],bino((j + k),j)))); }}}for ( int i = 0;(i <= (n + 1));++i) {ans = add(ans,dp[(n + 1)][i]); }pw.print(ans); pw.close(); } }
5	public class CFJava{ static private void println( Integer n){ System.out.println(n); } static private void println( String s){ System.out.println(s); } static private void print( Integer n){ System.out.print(n); } static private void print( String s){ System.out.print(s); } public static void main( String[] args)throws IOException { MyScanner scanner = new MyScanner();  int n = scanner.nextInt();  int k = scanner.nextInt();  Integer[] a = scanner.getIntArray(n); Arrays.sort(a); TreeSet<Integer> res = new TreeSet<Integer>(); for ( Integer i :a) {if ( (!res.contains((i / k)) || ((i % k) != 0))) res.add(i); }println(res.size()); } } class MyScanner{ private BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); private String[] buffer ; private int pos = 0; public Integer nextInt()throws IOException { if ( (buffer == null)) {buffer = in.readLine().split(" "); pos = 0; } if ( (buffer.length <= pos)) {buffer = in.readLine().split(" "); pos = 0; } pos++; return Integer.parseInt(buffer[(pos - 1)]);} public Integer[] getIntArray( Integer n)throws IOException { Integer[] result = new Integer[n]; for ( int i = 0;(i < n);i++) result[i] = nextInt(); return result;} }
6	public class E implements Runnable{ public static void main( String[] args){ new Thread(null,new E(),"_cf",(1 << 28)).start(); } HashMap<Integer,Integer> valToNode ,nodeToVal ,whichBox ; int N ,ptsTo[] ,cycleMask[] ,dfsStack[] ,tempList[] ; ArrayDeque<Integer> stack = new ArrayDeque<>(); void dfs( int node){ dfsStack[node] = 1; stack.addLast(node); int goTo = ptsTo[node]; if ( (goTo == -1)) {while(!stack.isEmpty()){cycleMask[stack.pollLast()] = -1; }} else {if ( (dfsStack[goTo] == 1)) { int ptr = 0,mask = 0,conflict = 0; while(!stack.isEmpty()){ int now = stack.pollLast(),val = nodeToVal.get(now),box = whichBox.get(val); tempList[ptr++] = now; if ( ((mask & (1 << box)) > 0)) conflict = 1; mask |= (1 << box); if ( (now == goTo)) break; }while(!stack.isEmpty()){cycleMask[stack.pollLast()] = -1; }for ( int i = 0;(i < ptr);i++) { int now = tempList[i]; if ( (conflict > 0)) cycleMask[now] = -1; else cycleMask[now] = mask; }} else if ( (dfsStack[goTo] == 2)) {while(!stack.isEmpty()){cycleMask[stack.pollLast()] = -1; }} else {dfs(goTo); }}dfsStack[node] = 2; } class FastScanner{ public int BS = (1 << 16); public char NC = (char)0; byte[] buf = new byte[BS]; int bId = 0,size = 0; char c = NC; double num = 1; BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } public char nextChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ num = 1; boolean neg = false; if ( (c == NC)) c = nextChar(); for ( ;((c < '0') || (c > '9'));c = nextChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = nextChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); num *= 10; }return (neg?-res:res);} } }
0	public class Main{ Scanner in ; PrintWriter out ; void solve(){ out.print("25"); } void run(){ in = new Scanner(System.in); out = new PrintWriter(System.out); solve(); out.close(); } public static void main( String[] args){ new Main().run(); } }
4	public class B{ static int n ,t[] ,g[] ,MOD = ((int)1e9 + 7); static int[][][] memo1 ,memo2[] ,memo3[] ; static int dp1( int idx, int remCnt, int remSum){ if ( (idx == n)) return (((remSum == 0) && (remCnt == 0))?1:0); if ( ((remCnt < 0) || (remSum < 0))) return 0; if ( (memo1[idx][remCnt][remSum] != -1)) return memo1[idx][remCnt][remSum]; int ans = dp1((idx + 1),remCnt,remSum); if ( (g[idx] == 0)) {ans += dp1((idx + 1),(remCnt - 1),(remSum - t[idx])); if ( (ans >= MOD)) ans -= MOD; } return memo1[idx][remCnt][remSum] = ans;} static int dp2( int idx, int remCnt1, int remCnt2, int remSum){ int all = (remCnt1 + remCnt2); if ( (all == 0)) return ((remSum == 0)?1:0); if ( ((idx == n) || (remSum == 0))) return 0; if ( (memo2[idx][remCnt1][remCnt2][remSum] != -1)) return memo2[idx][remCnt1][remCnt2][remSum]; int ans = dp2((idx + 1),remCnt1,remCnt2,remSum); if ( (t[idx] <= remSum)) {if ( ((g[idx] == 1) && (remCnt1 > 0))) ans += dp2((idx + 1),(remCnt1 - 1),remCnt2,(remSum - t[idx])); else if ( ((g[idx] == 2) && (remCnt2 > 0))) ans += dp2((idx + 1),remCnt1,(remCnt2 - 1),(remSum - t[idx])); } return memo2[idx][remCnt1][remCnt2][remSum] = ans;} static private int dp3( int cnt0, int cnt1, int cnt2, int last){ if ( (((cnt0 + cnt1) + cnt2) == 0)) return 1; if ( (memo3[last][cnt0][cnt1][cnt2] != -1)) return memo3[last][cnt0][cnt1][cnt2]; long ans = 0; if ( ((cnt0 > 0) && (last != 0))) ans += dp3((cnt0 - 1),cnt1,cnt2,0); if ( ((cnt1 > 0) && (last != 1))) ans += dp3(cnt0,(cnt1 - 1),cnt2,1); if ( ((cnt2 > 0) && (last != 2))) ans += dp3(cnt0,cnt1,(cnt2 - 1),2); return memo3[last][cnt0][cnt1][cnt2] = (int)(ans % MOD);} public static void main( String[] args)throws IOException { Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out); n = sc.nextInt(); int[] fac = new int[(n + 1)]; t = new int[n]; g = new int[n]; int[] cnt = new int[3]; fac[0] = 1; for ( int i = 1;(i <= n);i++) fac[i] = (int)(((i * 1L) * fac[(i - 1)]) % MOD); int T = sc.nextInt(); for ( int i = 0;(i < n);i++) {t[i] = sc.nextInt(); g[i] = (sc.nextInt() - 1); cnt[g[i]]++; }memo1 = new int[n][(cnt[0] + 1)][(T + 1)]; memo2 = new int[n][(cnt[1] + 1)][(cnt[2] + 1)][(T + 1)]; memo3 = new int[4][(cnt[0] + 1)][(cnt[1] + 1)][(cnt[2] + 1)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= cnt[0]);j++) Arrays.fill(memo1[i][j],-1); for ( int j = 0;(j <= cnt[1]);j++) for ( int k = 0;(k <= cnt[2]);k++) Arrays.fill(memo2[i][j][k],-1); }for ( int i = 0;(i < 4);i++) for ( int j = 0;(j <= cnt[0]);j++) for ( int k = 0;(k <= cnt[1]);k++) Arrays.fill(memo3[i][j][k],-1); int ans = 0; for ( int cnt0 = 0;(cnt0 <= cnt[0]);cnt0++) for ( int sum0 = 0;(sum0 <= T);sum0++) for ( int cnt1 = 0;(cnt1 <= cnt[1]);cnt1++) for ( int cnt2 = 0;(cnt2 <= cnt[2]);cnt2++) { long ways = (((dp1(0,cnt0,sum0) * 1L) * dp2(0,cnt1,cnt2,(T - sum0))) % MOD); ways = ((ways * dp3(cnt0,cnt1,cnt2,3)) % MOD); ways *= fac[cnt0]; ways %= MOD; ways *= fac[cnt1]; ways %= MOD; ways *= fac[cnt2]; ways %= MOD; ans += ways; if ( (ans >= MOD)) ans -= MOD; }out.println(ans); out.close(); } static class Scanner{ BufferedReader br ; StringTokenizer st ; Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } Scanner( String fileName)throws FileNotFoundException{ br = new BufferedReader(new FileReader(fileName)); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} boolean ready()throws IOException { return br.ready();} } }
6	public class C{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); double EPS = 1e-9; int n ,m ; void run(){ n = sc.nextInt(); m = sc.nextInt(); solve(); } void solve(){ if ( (n < m)) { int t = n; n = m; m = t; } int full = ((1 << m) - 1);  int[][] dp = new int[(1 << m)][(1 << m)];  int[][] tmp = new int[(1 << m)][(1 << m)]; for ( int i = 0;(i < (1 << m));i++) {fill(dp[i],INF); }for ( int i = 0;(i < (1 << m));i++) { int b1 = (((i | (i >> 1)) | (i << 1)) & full);  int b2 = i; dp[b1][b2] = Integer.bitCount(i); debug(Integer.toBinaryString(b1),dp[b1]); }debug(); for ( int j = 0;(j < (n - 1));j++) {for ( int i = 0;(i < (1 << m));i++) {System.arraycopy(dp[i],0,tmp[i],0,(1 << m)); fill(dp[i],INF); }for ( int b1 = 0;(b1 < (1 << m));b1++) {for ( int b2 = 0;(b2 < (1 << m));b2++) {for ( int i = 0;(i < (1 << m));i++) {if ( ((b1 | i) != full)) {continue;} if ( false) debug(Integer.toBinaryString(b1),Integer.toBinaryString(b2),Integer.toBinaryString(i));  int b = (((i | (i >> 1)) | (i << 1)) & full); dp[(b2 | b)][i] = min(dp[(b2 | b)][i],(tmp[b1][b2] + Integer.bitCount(i))); }}}debug(j); for ( int i = 0;(i < (1 << m));i++) {debug(Integer.toBinaryString(i),dp[i]); }} int min = INF; for ( int i = 0;(i < (1 << m));i++) {min = min(min,dp[full][i]); }debug(min); int ans = ((m * n) - min); debug("ans",ans); println((ans + "")); } void println( String s){ System.out.println(s); } void print( String s){ System.out.print(s); } void debug( Object... os){ } public static void main( String[] args){ new C().run(); } }
2	public class P1177A{ public static void main( String[] args)throws FileNotFoundException { Scanner in = new Scanner(System.in); System.out.println(solve(in.nextLong())); } static private String solve( long k){ long digitCnt = 1;  long nine = 9; while((k > (nine * digitCnt))){k -= (nine * digitCnt); nine *= 10; digitCnt++; } long num = ((((nine / 9) - 1) + ((k - 1) / digitCnt)) + 1); return String.valueOf(String.valueOf(num).charAt((int)((k - 1) % digitCnt)));} }
6	public class C{ BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; final int INF = (Integer.MAX_VALUE / 2); void solve()throws IOException { int n = nextInt();  int m = nextInt(); if ( (n > m)) { int tmp = n; n = m; m = tmp; } if ( (n == 1)) {out.print((m - ((m + 2) / 3))); return ;} int[][] dp = new int[((n * m) + 1)][(1 << (2 * n))]; for ( int i = 0;(i < dp.length);i++) Arrays.fill(dp[i],INF); dp[0][0] = 0; for ( int i = 0;(i < (dp.length - 1));i++) { int maxNewMask = ((1 << Math.min((2 * n),((n * m) - i))) - 1); for ( int mask = 0;(mask < dp[i].length);mask++) if ( (dp[i][mask] != INF)) {if ( ((mask & 1) == 1)) dp[(i + 1)][(mask >> 1)] = Math.min(dp[(i + 1)][(mask >> 1)],dp[i][mask]);  int newMask = (mask >> 1); if ( ((i % n) != (n - 1))) newMask |= 1; newMask |= (1 << (n - 1)); newMask &= maxNewMask; dp[(i + 1)][newMask] = Math.min(dp[(i + 1)][newMask],(dp[i][mask] + 1)); if ( ((i % n) != (n - 1))) {newMask = (mask >> 1); newMask |= 1; if ( ((i % n) != (n - 2))) newMask |= 2; newMask |= (1 << n); newMask &= maxNewMask; dp[(i + 1)][newMask] = Math.min(dp[(i + 1)][newMask],(dp[i][mask] + 1)); } if ( ((i + n) < (n * m))) {newMask = (mask >> 1); newMask |= (1 << (n - 1)); if ( ((i % n) != 0)) newMask |= (1 << (n - 2)); if ( ((i % n) != (n - 1))) newMask |= (1 << n); newMask |= (1 << ((2 * n) - 1)); newMask &= maxNewMask; dp[(i + 1)][newMask] = Math.min(dp[(i + 1)][newMask],(dp[i][mask] + 1)); } } }out.print(((n * m) - dp[(n * m)][0])); } void inp()throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.close(); } public static void main( String[] args)throws IOException { new C().inp(); } String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ eof = true; return "0";} }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
6	public class B{ int n ,k ; double A ; int[] b ,l ; double ans ; double curAns ; void check( boolean[] used){ int cnt = 0; for ( boolean t :used) if ( t) cnt++;  double prob = 1; for ( int i = 0;(i < n);i++) {if ( used[i]) prob *= ((double)l[i] / (double)100); else prob *= (1 - ((double)l[i] / (double)100)); }if ( ((2 * cnt) > n)) {curAns += prob; } else { int level = 0; for ( int i = 0;(i < n);i++) if ( !used[i]) level += b[i]; curAns += (prob * (A / ((double)A + level))); }} void go( int i, boolean[] used){ if ( (n == i)) {check(used); return ;} used[i] = true; go((i + 1),used); used[i] = false; go((i + 1),used); } void candies( int k, int i){ if ( (i == n)) {curAns = 0; go(0,new boolean[n]); if ( (curAns > ans)) ans = curAns; return ;} candies(k,(i + 1)); for ( int j = 1;((j <= k) && ((l[i] + (10 * j)) <= 100));j++) {l[i] += (10 * j); candies((k - j),(i + 1)); l[i] -= (10 * j); }} void solve()throws Exception { n = nextInt(); k = nextInt(); A = nextInt(); b = new int[n]; l = new int[n]; for ( int i = 0;(i < n);i++) {b[i] = nextInt(); l[i] = nextInt(); }ans = 0; candies(k,0); out.printf("%.12f",ans); } void run(){ try{in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); Locale.setDefault(Locale.US); solve(); out.close(); }catch (Exception e){ e.printStackTrace(); System.exit(1); } } BufferedReader in ; StringTokenizer st ; PrintWriter out ; final String filename = new String("B").toLowerCase(); String nextToken()throws Exception { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(in.readLine()); return st.nextToken();} int nextInt()throws Exception { return Integer.parseInt(nextToken());} public static void main( String[] args){ new B().run(); } }
3	public class test{ public static void main( String[] args)throws IOException { Scanner s = new Scanner(System.in);  StringTokenizer st = new StringTokenizer(s.nextLine());  int n = Integer.parseInt(st.nextToken());  int r = Integer.parseInt(st.nextToken()); st = new StringTokenizer(s.nextLine()); int[] array = new int[n]; for ( int i = 0;(i < n);i++) {array[i] = Integer.parseInt(st.nextToken()); } ArrayList<State> list = new ArrayList<State>(); for ( int i = 0;(i < n);i++) { double currY = r; for ( int j = 0;(j < list.size());j++) { double xDiff = Math.abs((list.get(j).getX() - array[i])); if ( (xDiff <= (2 * r))) {if ( (currY < (list.get(j).getY() + Math.sqrt((((4 * r) * r) - (xDiff * xDiff)))))) {currY = (list.get(j).getY() + Math.sqrt((((4 * r) * r) - (xDiff * xDiff)))); } } }list.add(new State(array[i],currY)); System.out.print((currY + " ")); }s.close(); } static class State{ double x ; double y ; public State( double a, double b){ x = a; y = b; } public double getX(){ return x;} public double getY(){ return y;} } }
0	public class Cf270a{ public static void main( String[] args)throws IOException { InputStreamReader fin = new InputStreamReader(System.in);  Scanner scr = new Scanner(fin);  int n = scr.nextInt();  int x = 0;  int y = 0; if ( ((n % 2) == 0)) {x = 4; y = (n - x); } else {x = 9; y = (n - x); } PrintWriter fout = new PrintWriter(System.out); fout.print(((x + " ") + y)); fout.flush(); fout.close(); } }
0	public class A{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  String inp = in.nextLine(); System.out.println(25); } }
5	public class kMultRedo{ static int n ; static int k ; public static void main( String[] args){ Set<Integer> set = new TreeSet<Integer>();  FastScanner s = new FastScanner(); n = s.nextInt(); k = s.nextInt(); int[] a = new int[n]; for ( int i = 0;(i < n);i++) {a[i] = s.nextInt(); }Arrays.sort(a); for ( int i = 0;(i < n);i++) {if ( ((a[i] % k) != 0)) {set.add(a[i]); } else {if ( !set.contains((a[i] / k))) {set.add(a[i]); } }}System.out.println(set.size()); } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( String s){ try{br = new BufferedReader(new FileReader(s)); }catch (FileNotFoundException e){ 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){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(nextToken());} } }
6	public class KeyboardPurchase{ static final int INF = 1000000000; public static void main( String[] args){ InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out,false);  int N = in.nextInt(),M = in.nextInt();  String str = in.next();  int[][] count = new int[M][M]; for ( int i = 1;(i < N);i++) { char c1 = str.charAt((i - 1)),c2 = str.charAt(i); count[(c1 - 'a')][(c2 - 'a')]++; count[(c2 - 'a')][(c1 - 'a')]++; } int[] dp = new int[(1 << M)]; Arrays.fill(dp,INF); dp[0] = 0; for ( int mask = 1;(mask < (1 << M));mask++) { int slow = 0; for ( int i = 0;(i < M);i++) {if ( ((mask & (1 << i)) != 0)) {for ( int j = 0;(j < M);j++) {if ( ((mask & (1 << j)) == 0)) {slow += count[i][j]; } }} }for ( int i = 0;(i < M);i++) {if ( ((mask & (1 << i)) != 0)) {dp[mask] = Math.min(dp[mask],(slow + dp[(mask ^ (1 << i))])); } }}out.println(dp[((1 << M) - 1)]); out.close(); System.exit(0); } 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());} } }
4	public class Main{ void run(){ Locale.setDefault(Locale.US); boolean oj = (System.getProperty("ONLINE_JUDGE") != null); try{if ( oj) {sc = new FastScanner(new InputStreamReader(System.in)); out = new PrintWriter(new OutputStreamWriter(System.out)); } else {sc = new FastScanner(new FileReader("in.txt")); out = new PrintWriter(new FileWriter("out.txt")); } }catch (Exception e){ System.exit(-1); } long tB = System.currentTimeMillis(); solve(); if ( !oj) System.err.println(("Time: " + ((System.currentTimeMillis() - tB) / 1e3))); out.flush(); } class FastScanner{ BufferedReader br ; StringTokenizer st = new StringTokenizer(""); FastScanner( InputStreamReader a){ br = new BufferedReader(a); } FastScanner( FileReader a){ br = new BufferedReader(a); } String next(){ while(!st.hasMoreTokens())try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ return null;} return st.nextToken();} String readLine(){ try{return br.readLine(); }catch (Exception e){ return null;} } int nextInt(){ return Integer.parseInt(next());} } FastScanner sc ; PrintWriter out ; public static void main( String[] args){ new Main().run(); } void exit( int val){ out.flush(); System.exit(val); } int n ,m ; boolean[][] grid ; ArrayList<Integer>[] gr ; int c ; int[] mt ; boolean[] u ; boolean try_kuhn( int v){ if ( u[v]) return false; u[v] = true; for ( int to :gr[v]) {if ( ((to == c) || !grid[v][to])) continue; if ( ((mt[to] == -1) || try_kuhn(mt[to]))) {mt[to] = v; return true;} }return false;} void solve(){ n = sc.nextInt(); m = sc.nextInt(); grid = new boolean[(n + 1)][(n + 1)]; gr = new ArrayList[(n + 1)]; for ( int v = 1;(v <= n);++v) gr[v] = new ArrayList<Integer>(); for ( int it = 0;(it < m);++it) { int a = sc.nextInt();  int b = sc.nextInt(); grid[a][b] = true; gr[a].add(b); } int ans = Integer.MAX_VALUE; for ( c = 1;(c <= n);++c) { int curAns = 0; for ( int v = 1;(v <= n);++v) if ( (v != c)) {if ( !grid[c][v]) ++curAns; if ( !grid[v][c]) ++curAns; } if ( !grid[c][c]) ++curAns; mt = new int[(n + 1)]; fill(mt,-1); for ( int i = 1;(i <= n);++i) if ( (i != c)) {u = new boolean[(n + 1)]; try_kuhn(i); } int szMt = 0; for ( int i = 1;(i <= n);++i) if ( (mt[i] != -1)) ++szMt; curAns += ((n - 1) - szMt); for ( int a = 1;(a <= n);++a) {for ( int b = 1;(b <= n);++b) {if ( (((a == c) || (b == c)) || !grid[a][b])) continue; if ( (a == mt[b])) ++curAns; }}ans = min(ans,curAns); }out.println(ans); } }
3	public class Main{ public static class InputReader{ public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader(){ reader = new BufferedReader(new InputStreamReader(System.in),32768); tokenizer = null; } public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(System.in),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());} } public static void main( String[] args){ InputReader scn = new InputReader();  int n = scn.nextInt(),r = scn.nextInt();  double[] y = new double[n];  int[] x = new int[n];  boolean[] mark = new boolean[n]; for ( int i = 0;(i < n);i++) {x[i] = scn.nextInt(); }for ( int i = 0;(i < n);i++) { double yc = r; for ( int j = 0;(j < n);j++) {if ( ((i == j) || !mark[j])) {continue;} if ( (((x[i] + r) < (x[j] - r)) || ((x[i] - r) > (x[j] + r)))) {continue;} yc = Math.max(yc,(y[j] + Math.sqrt(Math.abs((Math.pow((x[i] - x[j]),2) - ((4 * r) * r)))))); }y[i] = yc; mark[i] = true; }for ( int i = 0;(i < n);i++) {System.out.print((y[i] + " ")); }System.out.println(); } }
0	public class A235{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long a = in.nextLong(); if ( ((a % 2) == 0)) { long result = cal(a); result = Math.max(result,cal((a + 1))); result = Math.max(result,cal2(a)); System.out.println(Math.max(result,a)); } else { long result = (((a - 1) * (a - 2)) * (a - 0)); System.out.println(Math.max(result,a)); }} static long cal( long a){ long result = ((a - 1) * (a - 2)); result /= gcd((a - 1),(a - 2)); long gcd = gcd(result,(a - 3)); result *= (a - 3); result /= gcd; return result;} static long cal2( long a){ long result = (a * (a - 1)); result /= gcd((a - 1),a); long gcd = gcd(result,(a - 3)); result *= (a - 3); result /= gcd; return result;} static private long gcd( long l, long i){ if ( ((l == 0) || (i == 0))) {return 1;} if ( ((l % i) == 0)) {return i;} return gcd(i,(l % i));} }
0	public class LCM{ public static long gcd( long a, long b){ while(true){a = (a % b); if ( (a == 0)) return b; b = (b % a); if ( (b == 0)) return a; }} public static void main( String[] args)throws java.lang.Exception { Scanner in = new Scanner(System.in);  long n = in.nextInt(); if ( (n > 2)) {if ( (gcd(n,(n - 2)) > 1)) {if ( (gcd(n,(n - 3)) > 1)) {System.out.println((((n - 1) * (n - 2)) * (n - 3))); } else System.out.println(((n * (n - 1)) * (n - 3))); } else System.out.println(((n * (n - 1)) * (n - 2))); } else System.out.println(n); } }
4	public class Global14{ static PrintWriter out ; static Scanner sc ; static ArrayList<int[]> q ,w ,x ; static ArrayList<Integer> adj[] ; static HashSet<Integer> primesH ; static boolean prime[] ; static HashSet<Long> tmp ; static int[][][] dist ; static boolean[] v ; static int[] a ,b ,c ,d ; static Boolean[][] dp ; static char[][] mp ; static int A ,B ,n ,m ,h ,ans ,sum ; static long oo = ((long)1e9 + 7); public static void main( String[] args)throws IOException { sc = new Scanner(System.in); out = new PrintWriter(System.out); E(); out.close(); } static private Boolean dp( int i, int j){ if ( (j > (sum / 2))) return false; if ( (i == x.size())) {return ((sum / 2) == j);} if ( (dp[i][j] != null)) return dp[i][j]; return dp[i][j] = (dp((i + 1),(j + x.get(i)[0])) || dp((i + 1),j));} static private boolean valid( int nx, int ny){ return ((((nx >= 0) && (nx < dist.length)) && (ny >= 0)) && (ny < dist[0].length));} static int gcd( int a, int b){ return ((b == 0)?a:gcd(b,(a % b)));} static void E()throws IOException { int t = 1; while((t-- > 0)){ int n = ni();  long oo = nl();  long fc[] = new long[(n + 1)]; fc[0] = fc[1] = 1l; long[] pow2 = new long[(n + 1)]; pow2[0] = 1l; for ( int i = 1;(i < pow2.length);i++) {pow2[i] = ((pow2[(i - 1)] * 2l) % oo); }for ( int i = 2;(i < fc.length);i++) {fc[i] = (((fc[(i - 1)] * 1l) * i) % oo); } long ncr[][] = new long[(n + 1)][(n + 1)]; for ( int i = 0;(i <= n);i++) {for ( int j = 0;(j <= i);j++) {ncr[i][j] = (((i == 0) || (j == 0))?1l:((ncr[(i - 1)][(j - 1)] + ncr[(i - 1)][j]) % oo)); }} long ans = 0;  long dp[][] = new long[(n + 2)][(n + 2)]; dp[0][0] = 1l; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= i);j++) {for ( int k = 1;((i + k) <= n);k++) {dp[((i + k) + 1)][(j + k)] += ((((dp[i][j] * pow2[(k - 1)]) % oo) * ncr[(j + k)][k]) % oo); dp[((i + k) + 1)][(j + k)] %= oo; }}}for ( int i = 0;(i <= n);i++) {ans = ((ans + dp[(n + 1)][i]) % oo); }ol(("" + ans)); }} static int ni()throws IOException { return sc.nextInt();} static long nl()throws IOException { return sc.nextLong();} static int[] nai( int n)throws IOException { int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = sc.nextInt(); return a;} static void ol( String x){ out.println(x); } static void ol( int x){ out.println(x); } static void disp2( int[] a){ for ( int i = (a.length - 1);(i >= 0);i--) {out.print((a[i] + " ")); }out.println(); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public double nextDouble()throws IOException { return Double.parseDouble(next());} public long nextLong()throws IOException { return Long.parseLong(next());} public boolean ready()throws IOException { return br.ready();} } }
6	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  ScanReader in = new ScanReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  EKeyboardPurchase solver = new EKeyboardPurchase(); solver.solve(1,in,out); out.close(); } static class EKeyboardPurchase{ public void solve( int testNumber, ScanReader in, PrintWriter out){ int n = in.scanInt();  int m = in.scanInt();  int step[][] = new int[m][m];  char arr[] = in.scanString().toCharArray(); for ( int i = 0;(i < (n - 1));i++) {step[(arr[i] - 'a')][(arr[(i + 1)] - 'a')]++; step[(arr[(i + 1)] - 'a')][(arr[i] - 'a')]++; } int dp[] = new int[(1 << m)]; Arrays.fill(dp,(Integer.MAX_VALUE / 2)); for ( int i = 0;(i < m);i++) dp[(1 << i)] = 0; for ( int i = 0;(i < (1 << m));i++) { int cost = 0; for ( int j = 0;(j < m);j++) {if ( ((i & (1 << j)) != 0)) {for ( int k = 0;(k < m);k++) {if ( ((i & (1 << k)) == 0)) {cost += step[j][k]; } }} }for ( int j = 0;(j < m);j++) if ( ((i & (1 << j)) == 0)) dp[(i | (1 << j))] = Math.min(dp[(i | (1 << j))],(dp[i] + cost)); }out.println(dp[((1 << m) - 1)]); } } static class ScanReader{ private byte[] buf = new byte[(4 * 1024)]; private int INDEX ; private BufferedInputStream in ; private int TOTAL ; public ScanReader( InputStream inputStream){ in = new BufferedInputStream(inputStream); } private int scan(){ if ( (INDEX >= TOTAL)) {INDEX = 0; try{TOTAL = in.read(buf); }catch (Exception e){ e.printStackTrace(); } if ( (TOTAL <= 0)) return -1; } return buf[INDEX++];} public int scanInt(){ int I = 0;  int n = scan(); while(isWhiteSpace(n))n = scan(); int neg = 1; if ( (n == '-')) {neg = -1; n = scan(); } while(!isWhiteSpace(n)){if ( ((n >= '0') && (n <= '9'))) {I *= 10; I += (n - '0'); n = scan(); } }return (neg * I);} public String scanString(){ int c = scan(); while(isWhiteSpace(c))c = scan(); StringBuilder RESULT = new StringBuilder(); do {RESULT.appendCodePoint(c); c = scan(); }while(!isWhiteSpace(c));return RESULT.toString();} private boolean isWhiteSpace( int n){ if ( (((((n == ' ') || (n == '\n')) || (n == '\r')) || (n == '\t')) || (n == -1))) return true; else return false;} } }
6	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);  TaskE2 solver = new TaskE2(); solver.solve(1,in,out); out.close(); } static class TaskE2{ int[][] grid ; int[][] val ; int[][] dp ; int rows ; int two( int bit){ return (1 << bit);} boolean contain( int mask, int bit){ return ((mask & two(bit)) > 0);} int rec( int col, int mask){ if ( (col == grid[0].length)) return 0; if ( (dp[col][mask] != -1)) return dp[col][mask]; int res = rec((col + 1),mask); for ( int newMask = mask;(newMask > 0);newMask = (mask & (newMask - 1))) {res = Math.max(res,(rec((col + 1),(mask ^ newMask)) + val[col][newMask])); }dp[col][mask] = res; return res;} public void solve( int testNumber, InputReader in, PrintWriter out){ int T = in.nextInt(); for ( int t = 0;(t < T);t++) { int n = in.nextInt();  int m = in.nextInt(); rows = n; int[][] input = new int[n][m]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {input[i][j] = in.nextInt(); }} ArrayList<Col> cols = new ArrayList<>(); for ( int col = 0;(col < m);col++) { int maxVal = 0; for ( int row = 0;(row < n);row++) {maxVal = Math.max(maxVal,input[row][col]); }cols.add(new Col(maxVal,col)); }Collections.sort(cols); m = Math.min(n,m); grid = new int[n][m]; for ( int i = 0;(i < m);i++) { int c = cols.get(i).colID; for ( int row = 0;(row < n);row++) {grid[row][i] = input[row][c]; }}val = new int[m][two(n)]; for ( int c = 0;(c < m);c++) {for ( int mask = 0;(mask < two(n));mask++) {val[c][mask] = 0; for ( int offset = 0;(offset < n);offset++) { int sum = 0; for ( int bit = 0;(bit < n);bit++) {if ( (contain(mask,bit) == true)) sum += grid[((bit + offset) % n)][c]; }val[c][mask] = Math.max(val[c][mask],sum); }}}dp = new int[m][two(n)]; for ( int[] aux :dp) Arrays.fill(aux,-1); int ans = rec(0,(two(n) - 1)); out.println(ans); }} class Col implements Comparable<Col>{ int maxVal ; int colID ; Col( int _maxVal, int _colID){ this.maxVal = _maxVal; this.colID = _colID; } } } static class InputReader{ private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputStream stream ; public InputReader( InputStream stream){ this.stream = stream; } private boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} private int read(){ if ( (numChars == -1)) throw (new InputMismatchException()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} public int nextInt(){ int c = read(); while(isWhitespace(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(!isWhitespace(c));return (res * sgn);} } }
3	public class C{ public static void main( String[] args)throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  String[] line = in.readLine().split(" ");  int n = Integer.parseInt(line[0]);  int r = Integer.parseInt(line[1]); line = in.readLine().split(" "); double[] x = new double[n];  double[] y = new double[n]; for ( int i = 0;(i < n);i++) {y[i] = r; x[i] = Integer.parseInt(line[i]); }for ( int i = 1;(i < n);i++) {for ( int j = 0;(j < i);j++) {if ( (Math.abs((x[i] - x[j])) > (r * 2))) {continue;} double low = y[j];  double high = (y[j] + ((double)r * 2.0)); for ( int k = 0;((k < 85) && (low < high));k++) { double mid = ((low + high) / 2.0); if ( (Point2D.distance(x[j],y[j],x[i],mid) < ((double)r * 2.0))) {low = mid; } else {high = mid; }}y[i] = Math.max(y[i],low); }}System.out.printf("%.15f",y[0]); for ( int i = 1;(i < n);i++) {System.out.printf(" %.15f",y[i]); }System.out.print("\n"); } }
0	public class Main{ public static long gcd( long a, long b){ return ((b == 0)?a:gcd(b,(a % b)));} public static long lcm( long a, long b, long c){ long d = ((a / gcd(a,b)) * b); return ((c / gcd(c,d)) * d);} public static long max( long a, long b){ return ((a > b)?a:b);} public static void main( String[] args){ InputReader in = new InputReader();  PrintWriter out = new PrintWriter(System.out);  long n = in.nextLong(); if ( (n <= 2)) out.println(n); else out.println(max(lcm(n,(n - 1),(n - 2)),max(lcm(n,(n - 1),(n - 3)),lcm((n - 1),(n - 2),(n - 3))))); out.close(); } } class InputReader{ BufferedReader buf ; StringTokenizer tok ; InputReader(){ buf = new BufferedReader(new InputStreamReader(System.in)); } boolean hasNext(){ while(((tok == null) || !tok.hasMoreElements())){try{tok = new StringTokenizer(buf.readLine()); }catch (Exception e){ return false;} }return true;} String next(){ if ( hasNext()) return tok.nextToken(); return null;} long nextLong(){ return Long.parseLong(next());} }
6	public final class CF_599_D1_C{ static boolean verb = true; static void log( Object X){ if ( verb) System.err.println(X); } static void log( Object[] X){ if ( verb) {for ( Object U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X){ if ( verb) {for ( int U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X, int L){ if ( verb) {for ( int i = 0;(i < L);i++) System.err.print((X[i] + " ")); System.err.println(""); } } static void log( long[] X){ if ( verb) {for ( long U :X) System.err.print((U + " ")); System.err.println(""); } } static void output( Object o){ outputWln((("" + o) + "\n")); } static void outputWln( Object o){ try{out.write(("" + o)); }catch (Exception e){ } } static long mod = 1000000007; static BufferedWriter out ; static InputReader reader ; static void explore( ArrayList<Integer>[] components, ArrayList<Integer> bob, int[][] move, ArrayList<int[]>[] howto, int[][] list){ for ( int x :bob) {if ( (components[x].size() == 1)) { int tm[] = howto[x].get(0);  int L = howto[x].size(); howto[x].add(tm); for ( int i = 0;(i < L);i++) { int[] cur = howto[x].get(i);  int[] nx = howto[x].get((i + 1));  int a = cur[0];  int a2 = nx[0];  int b2 = nx[1]; move[a2][0] = list[a2][b2]; move[a2][1] = a; }} else {explore(components,components[x],move,howto,list); }}} static void process()throws Exception { out = new BufferedWriter(new OutputStreamWriter(System.out)); reader = new InputReader(System.in); int k = reader.readInt();  int[][] list = new int[k][];  long[] sum = new long[k];  int[] L = new int[k];  HashMap<Integer,int[]> target = new HashMap<Integer,int[]>();  long tot = 0; for ( int i = 0;(i < k);i++) {L[i] = reader.readInt(); list[i] = new int[L[i]]; for ( int j = 0;(j < L[i]);j++) {list[i][j] = reader.readInt(); sum[i] += list[i][j]; target.put(list[i][j],new int[]{i,j}); }tot += sum[i]; } int MX = (1 << k);  int AX = 1000000001;  ArrayList<int[]>[] howto = new ArrayList[MX]; log("ok with the data"); if ( ((tot % k) != 0)) {output("No"); } else {tot /= k; for ( int i = 0;(i < k);i++) {if ( (sum[i] == tot)) { int mask = (1 << i);  ArrayList<int[]> cand = new ArrayList<int[]>(); cand.add(new int[]{i,0}); howto[mask] = cand; } else for ( int j = 0;(j < L[i]);j++) { int u = i;  int v = j;  boolean ok = true;  int src_u = u;  int src_v = v;  int mask = 0;  boolean goon = true;  ArrayList<int[]> cand = new ArrayList<int[]>(); while(goon){cand.add(new int[]{u,v}); ok = false; goon = false; long need = (tot - ((long)sum[u] - (long)list[u][v])); if ( (Math.abs(need) <= AX)) { int nd = (int)need;  int[] tm = target.get(nd); if ( (tm != null)) { int nxu = tm[0];  int nxv = tm[1]; if ( ((mask & (1 << nxu)) == 0)) {mask |= (1 << nxu); if ( (nxu == src_u)) {if ( (nxv == src_v)) ok = true; } else {u = nxu; v = nxv; ok = true; goon = true; }} } } }if ( ok) {if ( (howto[mask] == null)) {howto[mask] = cand; } } }}log("step 1 done"); ArrayList<Integer> msk = new ArrayList<Integer>();  ArrayList[] components = new ArrayList[MX]; for ( int m = 0;(m < MX);m++) {if ( (howto[m] != null)) {components[m] = new ArrayList<Integer>(); components[m].add(m); } } int[] visited = new int[MX]; for ( int a = 0;(a < MX);a++) {if ( (howto[a] != null)) { ArrayList<Integer> add = new ArrayList<Integer>(); for ( int b :msk) {if ( ((b & a) == 0)) { int c = (b | a); log((("creating c:" + c) + " ")); if ( (components[c] == null)) {components[c] = new ArrayList<Integer>(); components[c].add(a); components[c].add(b); add.add(c); } } }msk.add(a); for ( int c :add) {msk.add(c); }} }if ( (components[(MX - 1)] != null)) {output("Yes"); int[][] move = new int[k][2]; explore(components,components[(MX - 1)],move,howto,list); for ( int i = 0;(i < k);i++) {output(((move[i][0] + " ") + (move[i][1] + 1))); }} else {output("No"); }}try{out.close(); }catch (Exception e){ } } public static void main( String[] args)throws Exception { process(); } static final class InputReader{ private final InputStream stream ; private final byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read()throws IOException { if ( (curChar >= numChars)) {curChar = 0; numChars = stream.read(buf); if ( (numChars <= 0)) {return -1;} } return buf[curChar++];} public final int readInt()throws IOException { int c = read();  boolean neg = false; while(isSpaceChar(c)){c = read(); } char d = (char)c; if ( (d == '-')) {neg = true; c = read(); } int res = 0; do {res *= 10; res += (c - '0'); c = read(); }while(!isSpaceChar(c));if ( neg) return -res; return res;} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
6	public class PetyaSpiders implements Runnable{ public static void main( String[] args)throws Exception { new Thread(null,new PetyaSpiders(),": )",(1 << 28)).start(); } static int N ,M ; static int oo = 999; static int[] dr = {1,0,-1,0},dc = {0,1,0,-1}; static boolean isValid( int prev, int curr, int next){ boolean[][] grid = new boolean[N][3];  int[] subsets = {prev,curr,next}; for ( int r = 0;(r < N);r++) {for ( int c = 0;(c < 3);c++) {if ( ((subsets[c] & 1) > 0)) {grid[r][c] = true; for ( int k = 0;(k < 4);k++) { int r2 = (r + dr[k]);  int c2 = (c + dc[k]); if ( ((((0 <= r2) && (r2 <= (N - 1))) && (0 <= c2)) && (c2 <= 2))) {grid[r2][c2] = true; } }} subsets[c] >>= 1; }}for ( int r = 0;(r < N);r++) {if ( !grid[r][1]) {return false;} }return true;} static class FastScanner{ private int BS = (1 << 16); private char NC = (char)0; private byte[] buf = new byte[BS]; private int bId = 0,size = 0; private char c = NC; private double cnt = 1; private BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } private char getChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ cnt = 1; boolean neg = false; if ( (c == NC)) c = getChar(); for ( ;((c < '0') || (c > '9'));c = getChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = getChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); cnt *= 10; }return (neg?-res:res);} public double nextDouble(){ double cur = nextLong(); return ((c != '.')?cur:(cur + (nextLong() / cnt)));} } }
3	public class Codeforces913F{ public static void main( String[] args)throws IOException { Scanner input = new Scanner(System.in);  int n = input.nextInt();  int a = input.nextInt();  int b = input.nextInt(); input.close(); final int mod = 998244353;  int frac = multiply(a,inverse(b,mod),mod);  int reverse = (((mod + 1) - frac) % mod);  int[] fracpower = new int[(n + 1)];  int[] reversepower = new int[(n + 1)]; fracpower[0] = 1; reversepower[0] = 1; for ( int i = 1;(i <= n);i++) {fracpower[i] = multiply(fracpower[(i - 1)],frac,mod); reversepower[i] = multiply(reversepower[(i - 1)],reverse,mod); } int[][] dp1 = new int[(n + 1)][(n + 1)]; dp1[2][1] = 1; for ( int i = 3;(i <= n);i++) {for ( int j = 1;(j < i);j++) {if ( (j == 1)) {dp1[i][j] = fracpower[(i - 1)]; } else {dp1[i][j] = multiply(dp1[(i - 1)][(j - 1)],fracpower[(i - j)],mod); }if ( (j == (i - 1))) {dp1[i][j] += reversepower[(i - 1)]; dp1[i][j] %= mod; } else {dp1[i][j] += multiply(dp1[(i - 1)][j],reversepower[j],mod); dp1[i][j] %= mod; }}} int[][] dp2 = new int[(n + 1)][(n + 1)]; dp2[1][1] = 1; dp2[2][1] = 1; dp2[2][2] = 0; for ( int i = 3;(i <= n);i++) { int val = 0; for ( int j = 1;(j < i);j++) {dp2[i][j] = multiply(dp2[j][j],dp1[i][j],mod); val += dp2[i][j]; val %= mod; }dp2[i][i] = (((mod + 1) - val) % mod); } int[] EV = new int[(n + 1)]; EV[1] = 0; EV[2] = 1; for ( int i = 3;(i <= n);i++) { int val = 0; for ( int j = 1;(j < i);j++) { int r = ((((j * (i - j)) + ((j * (j - 1)) / 2)) + EV[(i - j)]) + EV[j]); r %= mod; val += multiply(dp2[i][j],r,mod); val %= mod; }val += multiply(((i * (i - 1)) / 2),dp2[i][i],mod); val %= mod; int s = (((mod + 1) - dp2[i][i]) % mod); EV[i] = multiply(val,inverse(s,mod),mod); }System.out.println(EV[n]); } public static int multiply( int a, int b, int mod){ long x = ((long)a * (long)b); return (int)(x % mod);} public static int inverse( int a, int n){ int m = n;  int r1 = 1;  int r2 = 0;  int r3 = 0;  int r4 = 1; while(((a > 0) && (n > 0))){if ( (n >= a)) {r3 -= (r1 * (n / a)); r4 -= (r2 * (n / a)); n = (n % a); } else { int tmp = a; a = n; n = tmp; tmp = r1; r1 = r3; r3 = tmp; tmp = r2; r2 = r4; r4 = tmp; }}if ( (a == 0)) {if ( (r3 >= 0)) return (r3 % m); else return (m + (r3 % m));} else {if ( (r1 >= 0)) return (r1 % m); else return (m + (r1 % m));}} }
0	public class A235{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  long n = scan.nextInt();  BigInteger res = null; if ( (n >= 3)) {if ( ((n % 2) != 0)) {res = BigInteger.valueOf(((n * (n - 1)) * (n - 2))); } else if ( ((n % 3) == 0)) {res = BigInteger.valueOf((((n - 1) * (n - 2)) * (n - 3))); } else {res = BigInteger.valueOf(((n * (n - 1)) * (n - 3))); }} else {res = BigInteger.valueOf(n); }System.out.println(res); } }
5	public class A{ final int MOD = ((int)1e9 + 7); final double eps = 1e-12; final int INF = (int)1e9; public A(){ int N = sc.nextInt();  int K = sc.nextInt();  Long[] A = sc.nextLongs(); sort(A); Set<Long> S = new HashSet<Long>(); for ( long a :A) {if ( (((a % K) == 0) && S.contains(H((a / K))))) continue; S.add(H(a)); } int res = S.size(); exit(res); } long P = probablePrime(60,new Random()).longValue(); long Q = probablePrime(60,new Random()).longValue(); long H( long x){ return ((P * x) % Q);} static MyScanner sc = new MyScanner(); static class MyScanner{ public String next(){ newLine(); return line[index++];} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} public double nextDouble(){ return Double.parseDouble(next());} public String[] nextStrings(){ line = null; return readLine().split(" ");} public Integer[] nextInts(){ String[] L = nextStrings();  Integer[] res = new Integer[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Integer.parseInt(L[i]); return res;} public Long[] nextLongs(){ String[] L = nextStrings();  Long[] res = new Long[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Long.parseLong(L[i]); return res;} public Double[] nextDoubles(){ String[] L = nextStrings();  Double[] res = new Double[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Double.parseDouble(L[i]); return res;} public String[] next( int N){ String[] res = new String[N]; for ( int i = 0;(i < N);++i) res[i] = sc.next(); return res;} public Integer[] nextInt( int N){ Integer[] res = new Integer[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInt(); return res;} public Long[] nextLong( int N){ Long[] res = new Long[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLong(); return res;} public Double[] nextDouble( int N){ Double[] res = new Double[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDouble(); return res;} public String[][] nextStrings( int N){ String[][] res = new String[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextStrings(); return res;} public Integer[][] nextInts( int N){ Integer[][] res = new Integer[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInts(); return res;} public Long[][] nextLongs( int N){ Long[][] res = new Long[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLongs(); return res;} public Double[][] nextDoubles( int N){ Double[][] res = new Double[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDoubles(); return res;} private boolean eol(){ return (index == line.length);} private String readLine(){ try{return r.readLine(); }catch (Exception e){ throw (new Error(e));} } private final BufferedReader r ; MyScanner(){ this(new BufferedReader(new InputStreamReader(System.in))); } MyScanner( BufferedReader r){ try{this.r = r; while(!r.ready())Thread.sleep(1); start(); }catch (Exception e){ throw (new Error(e));} } private String[] line ; private int index ; private void newLine(){ if ( ((line == null) || eol())) {line = readLine().split(" "); index = 0; } } } static void print( Object o, Object... a){ printDelim(" ",o,a); } static void printDelim( String delim, Object o, Object... a){ pw.println(build(delim,o,a)); } static void exit( Object o, Object... a){ print(o,a); exit(); } static void exit(){ pw.close(); System.out.flush(); System.err.println("------------------"); System.err.println(("Time: " + ((millis() - t) / 1000.0))); System.exit(0); } static String build( String delim, Object o, Object... a){ StringBuilder b = new StringBuilder(); append(b,o,delim); for ( Object p :a) append(b,p,delim); return b.toString().trim();} static void append( StringBuilder b, Object o, String delim){ if ( o.getClass().isArray()) { int L = Array.getLength(o); for ( int i = 0;(i < L);++i) append(b,Array.get(o,i),delim); } else if ( (o instanceof Iterable<?>)) {for ( Object p :(Iterable<?>)o) append(b,p,delim); } else b.append(delim).append(o); } public static void main( String[] args){ new A(); exit(); } static void start(){ t = millis(); } static PrintWriter pw = new PrintWriter(System.out); static long t ; static long millis(){ return System.currentTimeMillis();} }
3	public class Main{ InputStream is ; PrintWriter out ; String INPUT = ""; long MOD = 1_000_000_007; int inf = Integer.MAX_VALUE; void solve(){ int n = ni();  int r = ni();  int[] x = new int[n]; for ( int i = 0;(i < n);i++) {x[i] = ni(); } double[] y = new double[n]; Arrays.fill(y,-1); for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < i);j++) { double res = (((4 * r) * r) - ((x[i] - x[j]) * (x[i] - x[j]))); if ( (res < 0)) continue; else { double tmp = (Math.sqrt(res) + y[j]); if ( (tmp > y[i])) {y[i] = tmp; } }}if ( (y[i] == -1)) y[i] = r; }for ( int i = 0;(i < n);i++) {out.print((y[i] + " ")); }} void run()throws Exception { is = (INPUT.isEmpty()?System.in:new ByteArrayInputStream(INPUT.getBytes())); out = new PrintWriter(System.out); long s = System.currentTimeMillis(); solve(); out.flush(); if ( !INPUT.isEmpty()) tr(((System.currentTimeMillis() - s) + "ms")); } public static void main( String[] args)throws Exception { new Main().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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while((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 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(); }} static private void tr( Object... o){ System.out.println(Arrays.deepToString(o)); } }
5	public class C{ public static final long MAX = 1000000000L; public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tok1 = new StringTokenizer(br.readLine()); final int n = Integer.parseInt(tok1.nextToken()); final long k = Integer.parseInt(tok1.nextToken());  StringTokenizer tok2 = new StringTokenizer(br.readLine());  int[] array = new int[n]; for ( int i = 0;(i < n);i++) {array[i] = Integer.parseInt(tok2.nextToken()); } int size = n; Arrays.sort(array); boolean[] skip = new boolean[n]; for ( int i = 0;(i < n);i++) {if ( skip[i]) {size--; continue;} long input = array[i]; input *= k; if ( (input > MAX)) {continue;} final int pos = Arrays.binarySearch(array,(int)input); if ( ((pos >= 0) && !skip[pos])) {skip[pos] = true; } }System.out.println(size); } }
6	public class x1238E{ public static void main( String[] omkar)throws Exception { BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(infile.readLine());  int N = Integer.parseInt(st.nextToken());  int M = Integer.parseInt(st.nextToken());  String input = infile.readLine();  int[][] cnt = new int[M][M]; for ( int i = 0;(i < (N - 1));i++) if ( (input.charAt(i) != input.charAt((i + 1)))) {cnt[(input.charAt(i) - 'a')][(input.charAt((i + 1)) - 'a')]++; cnt[(input.charAt((i + 1)) - 'a')][(input.charAt(i) - 'a')]++; } int[] dp = new int[(1 << M)]; Arrays.fill(dp,Integer.MAX_VALUE); dp[0] = 0; for ( int mask = 0;(mask < dp.length);mask++) for ( int b = 0;(b < M);b++) if ( ((mask & (1 << b)) == 0)) { int submask = (mask | (1 << b));  int cost = 0; for ( int c = 0;(c < M);c++) {if ( ((mask & (1 << c)) > 0)) cost += cnt[b][c]; else cost -= cnt[b][c]; }dp[submask] = Math.min(dp[submask],(dp[mask] + (cost * Integer.bitCount(mask)))); } System.out.println(dp[((1 << M) - 1)]); } }
2	public class C{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long s = 0,mod = 1000000009;  int n = sc.nextInt(),m = sc.nextInt(),k = sc.nextInt(),c = (n / k); if ( (m <= ((c * (k - 1)) + (n % k)))) System.out.println(m); else { int a = ((m - (c * (k - 1))) - (n % k));  long l = 0,pase = 0;  long pot = BigInteger.valueOf(2).modPow(BigInteger.valueOf(a),BigInteger.valueOf(mod)).longValue(); pot = ((2 * (pot - 1)) % mod); System.out.println(((((pot * k) % mod) + (m - (a * k))) % mod)); }} }
2	public class ProblemA{ InputReader in ; PrintWriter out ; long power( long a, long b, long mod){ long ret = 1;  long mul = a; while((b > 0)){if ( ((b % 2) == 1)) {ret = ((ret * mul) % mod); } mul = ((mul * mul) % mod); b = (b / 2); }return ret;} void solve(){ long n = in.nextLong();  long m = in.nextLong();  long k = in.nextLong();  long mod = 1000000009;  long x = (m - (n - (n / k))); if ( (x <= 0)) {out.println(m); } else { long score = 1; score = power(2,(x + 1),mod); score = (((score + mod) - 2) % mod); long ans = (((((score * k) + m) - (x * k)) + mod) % mod); out.println(ans); }} ProblemA(){ boolean oj = (System.getProperty("ONLINE_JUDGE") != null); try{if ( oj) {in = new InputReader(System.in); out = new PrintWriter(System.out); } else { Writer w = new FileWriter("output.txt"); in = new InputReader(new FileReader("input.txt")); out = new PrintWriter(w); } }catch (Exception e){ throw (new RuntimeException(e));} solve(); out.close(); } public static void main( String[] args){ new ProblemA(); } } class InputReader{ private BufferedReader reader ; private StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public InputReader( FileReader fr){ reader = new BufferedReader(fr); 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 long nextLong(){ return Long.parseLong(next());} }
4	public class E2_SquareFreeDivision2{ static FastScanner sc = new FastScanner(); static PrintWriter out = new PrintWriter(System.out); public static void main( String[] args){ int MAX = (int)1e7;  int[] spf = new int[(MAX + 1)]; for ( int i = 2;(i <= MAX);i++) {if ( (spf[i] == 0)) {spf[i] = i; for ( int j = (i + i);(j <= MAX);j += i) {if ( (spf[j] == 0)) {spf[j] = i; } }} } int[] freq = new int[(MAX + 1)];  int T = sc.nextInt(); while((T-- > 0)){ int N = sc.nextInt();  int K = sc.nextInt();  int[] a = new int[(N + 1)]; for ( int i = 1;(i <= N);i++) {a[i] = sc.nextInt(); int canonical = 1; while((a[i] > 1)){ int factor = spf[a[i]];  int parity = 0; while(((a[i] % factor) == 0)){a[i] /= factor; parity ^= 1; }if ( (parity == 1)) {canonical *= factor; } }a[i] = canonical; } int[][] transition = new int[(K + 1)][(N + 1)]; for ( int k = 0;(k <= K);k++) { int l = (N + 1);  int duplicates = 0; for ( int r = N;(r >= 1);r--) {while(((l - 1) >= 1)){ int nextDuplicates = duplicates; if ( (freq[a[(l - 1)]] >= 1)) {nextDuplicates++; } if ( (nextDuplicates <= k)) {duplicates = nextDuplicates; freq[a[(l - 1)]]++; l--; } else {break;}}transition[k][r] = l; if ( (--freq[a[r]] >= 1)) {duplicates--; } }} int[][] dp = new int[(K + 1)][(N + 1)];  int oo = (int)1e9; for ( int[] row :dp) {Arrays.fill(row,oo); }for ( int k = 0;(k <= K);k++) {dp[k][0] = 0; }for ( int r = 1;(r <= N);r++) {for ( int k = 0;(k <= K);k++) {for ( int delta = 0;(delta <= k);delta++) {dp[k][r] = min(dp[k][r],(dp[(k - delta)][(transition[delta][r] - 1)] + 1)); }}}out.println(dp[K][N]); }out.close(); } static class FastScanner{ private int BS = (1 << 16); private char NC = (char)0; private byte[] buf = new byte[BS]; private int bId = 0,size = 0; private char c = NC; private double cnt = 1; private BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } char getChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} int nextInt(){ return (int)nextLong();} long nextLong(){ cnt = 1; boolean neg = false; if ( (c == NC)) c = getChar(); for ( ;((c < '0') || (c > '9'));c = getChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = getChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); cnt *= 10; }return (neg?-res:res);} } }
5	public class Main{ public static void main( String[] args)throws IOException { PrintWriter out = new PrintWriter(System.out);  Reader in = new Reader();  Main solver = new Main(); solver.solve(out,in); out.flush(); out.close(); } void solve( PrintWriter out, Reader in)throws IOException { int n = in.nextInt();  int m = in.nextInt();  int[] vert = new int[(n + 1)]; for ( int i = 0;(i < n);i++) vert[i] = in.nextInt(); vert[n] = (int)1e9; int cnt = 0,x ,y ;  ArrayList<Integer> arr = new ArrayList<>(); for ( int i = 0;(i < m);i++) {x = in.nextInt(); y = in.nextInt(); in.nextInt(); if ( (x == 1)) arr.add(y); }horz = new int[arr.size()]; for ( int i = 0;(i < arr.size());i++) horz[i] = arr.get(i); Arrays.sort(horz); Arrays.sort(vert); int ans = ((2 * (int)1e5) + 10); for ( int i = 0;(i <= n);i++) { int lesshorz = bs(vert[i],horz.length); ans = Math.min(ans,(((i + horz.length) - lesshorz) - 1)); }out.println(ans); } static int[] horz ; static int bs( int num, int m){ int mid ,lo = 0,hi = (m - 1),r = -1; while((lo <= hi)){mid = ((lo + hi) / 2); if ( (horz[mid] < num)) {lo = (mid + 1); r = mid; } else {hi = (mid - 1); }}return r;} static class Reader{ private InputStream mIs ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public Reader(){ this(System.in); } public Reader( InputStream is){ mIs = is; } public int read(){ if ( (numChars == -1)) {throw (new InputMismatchException());} if ( (curChar >= numChars)) {curChar = 0; try{numChars = mIs.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) {return -1;} } return buf[curChar++];} 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 boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} } }
0	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);  A solver = new A(); solver.solve(1,in,out); out.close(); } } class A{ public void solve( int testNumber, InputReader in, PrintWriter out){ int number = in.nextInt(); if ( ((number & 1) == 0)) {out.println(((4 + " ") + (number - 4))); } else {out.println(((9 + " ") + (number - 9))); }} } class InputReader{ private final BufferedReader bufferedReader ; private StringTokenizer stringTokenizer ; public InputReader( InputStream in){ bufferedReader = new BufferedReader(new InputStreamReader(in)); stringTokenizer = null; } public String nextLine(){ try{return bufferedReader.readLine(); }catch (IOException e){ throw (new RuntimeException(e));} } public String nextBlock(){ while(((stringTokenizer == null) || !stringTokenizer.hasMoreTokens())){stringTokenizer = new StringTokenizer(nextLine()); }return stringTokenizer.nextToken();} public int nextInt(){ return Integer.parseInt(nextBlock());} }
2	public class B implements Runnable{ static private final Random rnd = new Random(); int n ; private void solve(){ this.query = 0; this.n = readInt(); int left1 = 0;  int l = 1,r = n; while((l <= r)){ int m = ((l + r) / 2);  int answer = getAnswer(m,1,n,n); if ( (answer < 2)) {r = (m - 1); } else {left1 = m; l = (m + 1); }} int left2 = left1; l = (left1 + 1); r = n; while((l <= r)){ int m = ((l + r) / 2);  int answer = getAnswer(m,1,n,n); if ( (answer < 1)) {r = (m - 1); } else {left2 = m; l = (m + 1); }} int right2 = (n + 1); l = 1; r = n; while((l <= r)){ int m = ((l + r) / 2);  int answer = getAnswer(1,1,m,n); if ( (answer < 2)) {l = (m + 1); } else {right2 = m; r = (m - 1); }} int right1 = right2; l = 1; r = (right2 - 1); while((l <= r)){ int m = ((l + r) / 2);  int answer = getAnswer(1,1,m,n); if ( (answer < 1)) {l = (m + 1); } else {right1 = m; r = (m - 1); }} int bottom1 = 0; l = 1; r = n; while((l <= r)){ int m = ((l + r) / 2);  int answer = getAnswer(1,m,n,n); if ( (answer < 2)) {r = (m - 1); } else {bottom1 = m; l = (m + 1); }} int bottom2 = bottom1; l = (bottom1 + 1); r = n; while((l <= r)){ int m = ((l + r) / 2);  int answer = getAnswer(1,m,n,n); if ( (answer < 1)) {r = (m - 1); } else {bottom2 = m; l = (m + 1); }} int top2 = (n + 1); l = 1; r = n; while((l <= r)){ int m = ((l + r) / 2);  int answer = getAnswer(1,1,n,m); if ( (answer < 2)) {l = (m + 1); } else {top2 = m; r = (m - 1); }} int top1 = top2; l = 1; r = (top2 - 1); while((l <= r)){ int m = ((l + r) / 2);  int answer = getAnswer(1,1,n,m); if ( (answer < 1)) {l = (m + 1); } else {top1 = m; r = (m - 1); }} int ansLeftRightMask = -1,ansBottomTopMask = -1;  long answerS = ((2L * n) * n); for ( int leftRightMask = 0;(leftRightMask < 4);++leftRightMask) { int left = (checkBit(leftRightMask,0)?left1:left2);  int right = (checkBit(leftRightMask,1)?right1:right2); for ( int bottomTopMask = 0;(bottomTopMask < 4);++bottomTopMask) { int bottom = (checkBit(bottomTopMask,0)?bottom1:bottom2);  int top = (checkBit(bottomTopMask,1)?top1:top2);  int curTry = getAnswer(left,bottom,right,top); if ( (curTry == 1)) { long s = (((right - left) + 1L) * ((top - bottom) + 1L)); if ( (s < answerS)) {answerS = s; ansLeftRightMask = leftRightMask; ansBottomTopMask = bottomTopMask; } } }} int left = (checkBit(ansLeftRightMask,0)?left1:left2);  int right = (checkBit(ansLeftRightMask,1)?right1:right2);  int bottom = (checkBit(ansBottomTopMask,0)?bottom1:bottom2);  int top = (checkBit(ansBottomTopMask,1)?top1:top2); printAnswer(left,bottom,right,top,((left1 + left2) - left),((bottom1 + bottom2) - bottom),((right1 + right2) - right),((top1 + top2) - top)); } private void printAnswer( int... values){ printQuery("!",values); } private void printQuery( String sign, int... values){ out.print(sign); for ( int value :values) {out.print((" " + value)); }out.println(); out.flush(); } int query = 0; final int MAX_QUERY = 200; private int getAnswer( int left, int bottom, int right, int top){ if ( ((left < 1) || (right > n))) {while(true);} if ( ((bottom < 1) || (top > n))) {throw (new RuntimeException());} if ( ((left > right) || (bottom > top))) {return 0;} if ( (query == MAX_QUERY)) {throw (new RuntimeException());} ++query; printQuery("?",left,bottom,right,top); int answer = readInt(); return answer;} static private final boolean FIRST_INPUT_STRING = false; static private final boolean MULTIPLE_TESTS = true; static private final boolean INTERACTIVE = true; private final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null); static private final int MAX_STACK_SIZE = 128; static private final boolean OPTIMIZE_READ_NUMBERS = false; private BufferedReader in ; private OutputWriter out ; private StringTokenizer tok = new StringTokenizer(""); public static void main( String[] args){ new Thread(null,new B(),"",(MAX_STACK_SIZE * (1L << 20))).start(); } private void init()throws FileNotFoundException { Locale.setDefault(Locale.US); if ( (INTERACTIVE || ONLINE_JUDGE)) {in = new BufferedReader(new InputStreamReader(System.in)); out = new OutputWriter(System.out); } else {in = new BufferedReader(new FileReader("input.txt")); out = new OutputWriter("output.txt"); }} private long timeBegin ; private void timeInit(){ this.timeBegin = System.currentTimeMillis(); } private void time(){ long timeEnd = System.currentTimeMillis(); System.err.println(("Time = " + (timeEnd - timeBegin))); } private String delim = " "; private String readLine(){ try{return in.readLine(); }catch (IOException e){ throw (new RuntimeIOException(e));} } private String readString(){ try{while(!tok.hasMoreTokens()){tok = new StringTokenizer(readLine()); }return tok.nextToken(delim); }catch (NullPointerException e){ return null;} } private final char NOT_A_SYMBOL = '\0'; private char[] readCharArray(){ return readLine().toCharArray();} private long optimizedReadLong(){ long result = 0;  boolean started = false; while(true){try{ int j = in.read(); if ( (-1 == j)) {if ( started) return result; throw (new NumberFormatException());} if ( (('0' <= j) && (j <= '9'))) {result = (((result * 10) + j) - '0'); started = true; } else if ( started) {return result;} }catch (IOException e){ throw (new RuntimeIOException(e));} }} private int readInt(){ if ( !OPTIMIZE_READ_NUMBERS) {return Integer.parseInt(readString());} else {return (int)optimizedReadLong();}} private int[] readIntArray( int size){ int[] array = new int[size]; for ( int index = 0;(index < size);++index) {array[index] = readInt(); }return array;} private int[] readIntArrayWithDecrease( int size){ int[] array = readIntArray(size); for ( int i = 0;(i < size);++i) {array[i]--; }return array;} private long readLong(){ if ( !OPTIMIZE_READ_NUMBERS) {return Long.parseLong(readString());} else {return optimizedReadLong();}} private double readDouble(){ return Double.parseDouble(readString());} private Point readPoint(){ int x = readInt();  int y = readInt(); return new Point(x,y);} static private class IntIndexPair{ static Comparator<IntIndexPair> increaseComparator = new Comparator<B.IntIndexPair>(){}; static Comparator<IntIndexPair> decreaseComparator = new Comparator<B.IntIndexPair>(){}; int value ,index ; IntIndexPair( int value, int index){ super(); this.value = value; this.index = index; } } static private class OutputWriter extends PrintWriter{ final int DEFAULT_PRECISION = 12; private int precision ; private String format ,formatWithSpace ; {precision = DEFAULT_PRECISION; format = createFormat(precision); formatWithSpace = (format + " "); }OutputWriter( OutputStream out){ super(out); } OutputWriter( String fileName)throws FileNotFoundException{ super(fileName); } String createFormat( int precision){ return (("%." + precision) + "f");} @Override public void print( double d){ printf(format,d); } void printWithSpace( double d){ printf(formatWithSpace,d); } void printAll( double... d){ for ( int i = 0;(i < (d.length - 1));++i) {printWithSpace(d[i]); }print(d[(d.length - 1)]); } @Override public void println( double d){ printlnAll(d); } void printlnAll( double... d){ printAll(d); println(); } } static private class RuntimeIOException extends RuntimeException{ static private final long serialVersionUID = -6463830523020118289L; RuntimeIOException( Throwable cause){ super(cause); } } static private final int[][] steps = {{-1,0},{1,0},{0,-1},{0,1}}; static private final int[][] steps8 = {{-1,0},{1,0},{0,-1},{0,1},{-1,-1},{1,1},{1,-1},{-1,1}}; static private boolean checkIndex( int index, int lim){ return ((0 <= index) && (index < lim));} static private boolean checkBit( int mask, int bit){ return ((mask & (1 << bit)) != 0);} static private boolean checkBit( long mask, int bit){ return ((mask & (1L << bit)) != 0);} static private long gcd( long a, long b){ return ((a == 0)?b:gcd((b % a),a));} }
5	public class ChainReaction implements Closeable{ private InputReader in = new InputReader(System.in); private PrintWriter out = new PrintWriter(System.out); private class Beacon implements Comparable<Beacon>{ private int position ,range ,score ; private Beacon( int position, int range){ this.position = position; this.range = range; } public void setScore( int score){ this.score = score; } } public void solve(){ int n = in.ni(); if ( (n == 1)) {out.println(0); return ;} beacons = new ArrayList<>(); for ( int i = 0;(i < n);i++) {beacons.add(new Beacon(in.ni(),in.ni())); }beacons.sort(Comparator.naturalOrder()); for ( int i = 1;(i < n);i++) { int left = 0,right = (i - 1),position = beacons.get(i).position,range = beacons.get(i).range;  int leftmost = i; while((left <= right)){ int mid = (left + ((right - left) / 2)); if ( ((position - range) <= beacons.get(mid).position)) {leftmost = Math.min(leftmost,mid); right = (mid - 1); } else {left = (mid + 1); }}beacons.get(i).setScore((i - leftmost)); }dp = new Integer[n]; int ans = Integer.MAX_VALUE; for ( int i = (n - 1);(i >= 0);i--) {ans = Math.min((((n - 1) - i) + recurse(i)),ans); }out.println(ans); } private List<Beacon> beacons ; private Integer[] dp ; private int recurse( int idx){ if ( (idx <= 0)) return 0; if ( (dp[idx] != null)) return dp[idx]; int destroyed = beacons.get(idx).score;  int ans = (destroyed + recurse(((idx - destroyed) - 1))); return dp[idx] = ans;} @Override public void close()throws IOException { in.close(); out.close(); } 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 ni(){ return Integer.parseInt(next());} public void close()throws IOException { reader.close(); } } public static void main( String[] args)throws IOException { try(ChainReaction instance=new ChainReaction()){instance.solve(); }} }
4	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);  OnTheBench solver = new OnTheBench(); solver.solve(1,in,out); out.close(); } static class OnTheBench{ long MOD = ((long)1e9 + 7); long[][] C = new long[333][333]; public void solve( int testNumber, InputReader in, PrintWriter out){ int N = in.nextInt();  DisjointSet dsu = new DisjointSet(N);  long[] arr = new long[N]; setC(); for ( int i = 0;(i < N);i++) {arr[i] = in.nextInt(); }for ( int i = 0;(i < N);i++) {for ( int j = (i + 1);(j < N);j++) { long sqrt = (long)Math.sqrt((arr[i] * arr[j]));  long sqrt2 = (long)Math.ceil(Math.sqrt((arr[i] * arr[j]))); if ( (((sqrt * sqrt) == (arr[i] * arr[j])) || ((sqrt2 * sqrt2) == (arr[i] * arr[j])))) {dsu.merge(i,j); } }} ArrayList<Integer> sz = new ArrayList<>(); sz.add(0); HashMap<Integer,Integer> seen = new HashMap<>();  long mult = 1; for ( int i = 0;(i < N);i++) {if ( !seen.containsKey(dsu.find(i))) {seen.put(dsu.find(i),sz.size()); sz.add(0); } sz.set(seen.get(dsu.find(i)),(sz.get(seen.get(dsu.find(i))) + 1)); }for ( int i :sz) {mult *= fact(i); mult %= MOD; } long[][] dp = new long[sz.size()][333];  int sum = 0; dp[0][0] = 1; for ( int n = 1;(n < dp.length);n++) {for ( int ij = 1;(ij <= sz.get(n));ij++) {for ( int y = 0;(y <= sum);y++) {for ( int j = 0;(j <= Math.min(y,ij));j++) { int i = (ij - j); dp[n][(((y - j) + sz.get(n)) - ij)] += ((((((dp[(n - 1)][y] * C[((sum + 1) - y)][i]) % MOD) * C[y][j]) % MOD) * C[(sz.get(n) - 1)][(ij - 1)]) % MOD); dp[n][(((y - j) + sz.get(n)) - ij)] %= MOD; }}}sum += sz.get(n); }out.println(((dp[(sz.size() - 1)][0] * mult) % MOD)); } void setC(){ for ( int i = 0;(i <= 332);i++) {C[i][0] = 1; for ( int j = 1;(j <= i);j++) {C[i][j] = (C[(i - 1)][j] + C[(i - 1)][(j - 1)]); C[i][j] %= MOD; }}} long fact( int i){ long res = 1; while((i > 0)){res *= i; res %= MOD; i--; }return res;} } 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());} } static class DisjointSet{ int[] rank ; int[] par ; public DisjointSet( int N){ rank = new int[N]; par = new int[N]; for ( int i = 0;(i < N);i++) {rank[i] = 1; par[i] = i; }} public int find( int x){ if ( (x == par[x])) {return x;} return par[x] = find(par[x]);} public void merge( int x, int y){ int parX = find(x);  int parY = find(y); if ( (parX != parY)) {if ( (rank[parX] > rank[parY])) {par[parY] = parX; rank[parX] += rank[parY]; } else {par[parX] = parY; rank[parY] += rank[parX]; }} } } }
6	public class Main{ public class BasicInputOutput{ private StringTokenizer strtoken ; private BufferedReader bufferReader ; private BufferedWriter bufferWriter ; private String delim = " \t\n\r\f"; BasicInputOutput(){ delim = " \t\n\r\f"; initialize(); } BasicInputOutput( String s){ delim = s; initialize(); } private void initialize(){ bufferReader = new BufferedReader(new InputStreamReader(System.in)); bufferWriter = new BufferedWriter(new PrintWriter(System.out)); strtoken = null; } private void checkStringTokenizer()throws IOException { if ( ((strtoken == null) || (strtoken.hasMoreTokens() == false))) strtoken = new StringTokenizer(bufferReader.readLine(),delim); } public int getNextInt()throws IOException { checkStringTokenizer(); return Integer.parseInt(strtoken.nextToken());} public double getNextDouble()throws IOException { checkStringTokenizer(); return Double.parseDouble(strtoken.nextToken());} public void write( String var)throws IOException { bufferWriter.write(var); } public <T> void write( char sep, T... var)throws IOException { if ( (var.length == 0)) return ; bufferWriter.write(var[0].toString()); for ( int i = 1;(i < var.length);i++) bufferWriter.write((sep + var[i].toString())); } public void flush()throws IOException { bufferWriter.flush(); } } public static void main( String[] args){ try{new Main().run(); }catch (Exception ex){ ex.printStackTrace(); } } private BasicInputOutput iohandler ; private int n ; private double[][] mat ; private double[][] sum ; private double[] dp ; private int tolive ; private void run()throws Exception { initialize(); solve(); } private void initialize()throws Exception { iohandler = new BasicInputOutput(); n = iohandler.getNextInt(); mat = new double[n][n]; sum = new double[((1 << n) + 10)][n]; dp = new double[(1 << n)]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) {mat[i][j] = iohandler.getNextDouble(); }} private int bitCount( int mask){ int ret = 0; while((mask > 0)){ret++; mask &= (mask - 1); }return ret;} private void solve()throws Exception { double[] ans = new double[n];  int ub = (1 << n); for ( int i = 1;(i < ub);i++) {for ( int j = 0;(j < n);j++) {sum[i][j] = 0; for ( int k = 0;(k < n);k++) if ( ((i & (1 << k)) != 0)) sum[i][j] += mat[k][j];  int cntbit = bitCount(i); if ( (cntbit > 1)) sum[i][j] /= (((double)cntbit * (cntbit - 1.)) / 2.); }}for ( int i = 0;(i < n);i++) {for ( int mask = 1;(mask < ub);mask++) {dp[mask] = 0; if ( ((mask & (1 << i)) == 0)) continue; if ( (bitCount(mask) == 1)) {dp[mask] = 1.; } else for ( int k = 0;(k < n);k++) {if ( ((mask & (1 << k)) == 0)) continue; if ( (i == k)) continue; dp[mask] += (sum[mask][k] * dp[(mask - (1 << k))]); }}ans[i] = dp[(ub - 1)]; }iohandler.write((ans[0] + "")); for ( int i = 1;(i < n);i++) iohandler.write((" " + ans[i])); iohandler.write("\n"); iohandler.flush(); } }
4	public class CF_2020_GlobalRound_E{ static boolean verb = true; static void log( Object X){ if ( verb) System.err.println(X); } static void log( Object[] X){ if ( verb) {for ( Object U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X){ if ( verb) {for ( int U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X, int L){ if ( verb) {for ( int i = 0;(i < L);i++) System.err.print((X[i] + " ")); System.err.println(""); } } static void log( long[] X){ if ( verb) {for ( long U :X) System.err.print((U + " ")); System.err.println(""); } } static InputReader reader ; static long[][] binom ; static void buildBinom( int N){ int MAX = (N + 1); binom = new long[(MAX + 1)][]; for ( int i = 0;(i < (MAX + 1));i++) binom[i] = new long[(i + 1)]; binom[0][0] = 1; for ( int i = 1;(i < MAX);i++) {binom[i][0] = 1; binom[i][i] = 1; for ( int j = 0;(j < i);j++) {binom[(i + 1)][(j + 1)] = ((binom[i][j] + binom[i][(j + 1)]) % mod); }}log("binom done"); } static long mod ; static long solve( int n){ long[] pow2 = new long[(n + 1)]; pow2[0] = 1; for ( int i = 1;(i <= n);i++) {pow2[i] = (pow2[(i - 1)] << 1); while((pow2[i] >= mod))pow2[i] -= mod; }buildBinom(n); long[][] dp = new long[(n + 1)][(n + 1)]; dp[1][1] = 1; for ( int i = 1;(i <= n);i++) {dp[i][i] = pow2[(i - 1)]; for ( int j = 1;(j < (i - 1));j++) { int me = ((i - j) - 1); for ( int cn = 1;(cn <= j);cn++) { long a = (dp[j][cn] * binom[(cn + me)][cn]); if ( (a >= mod)) a %= mod; a *= pow2[(me - 1)]; if ( (a >= mod)) a %= mod; dp[i][(cn + me)] += a; if ( (dp[i][(cn + me)] >= mod)) dp[i][(cn + me)] -= mod; }}} long ans = 0; for ( int i = (n / 2);(i <= n);i++) {ans += dp[n][i]; ans %= mod; }return ans;} public static void main( String[] args)throws Exception { log(((400 * 400) * 400)); reader = new InputReader(System.in); int n = reader.readInt(); mod = reader.readInt(); System.out.println(solve(n)); } static final class InputReader{ private final InputStream stream ; private final byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read()throws IOException { if ( (curChar >= numChars)) {curChar = 0; numChars = stream.read(buf); if ( (numChars <= 0)) {return -1;} } return buf[curChar++];} public final int readInt()throws IOException { int c = read();  boolean neg = false; while(isSpaceChar(c)){c = read(); } char d = (char)c; if ( (d == '-')) {neg = true; c = read(); } int res = 0; do {res *= 10; res += (c - '0'); c = read(); }while(!isSpaceChar(c));if ( neg) return -res; return res;} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
1	public class Equator{ public static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static StringTokenizer st ; public static void main( String[] args)throws IOException { int n = nextInt();  int[] a = intArray(n);  long s = 0; for ( int x :a) s += x; long m = 0; for ( int i = 0;(i < n);i++) {m += a[i]; if ( ((m * 2) >= s)) {System.out.println((i + 1)); return ;} }} public static String nextString()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(in.readLine()); return st.nextToken();} public static int nextInt()throws IOException { return Integer.parseInt(nextString());} public static long nextLong()throws IOException { return Long.parseLong(nextString());} public static int[] intArray( int n)throws IOException { int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = nextInt(); return a;} public static int[][] intArray( int n, int m)throws IOException { int[][] a = new int[n][m]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < m);j++) a[i][j] = nextInt(); return a;} }
3	public class Codechef{ static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static ArrayList<ArrayList<Integer>> list ; static HashSet<Integer> hs ; static ArrayList<Integer> tmp ; public static double cal( int a, double b, int x, int r){ r *= 2; double dis = ((r * r) - Math.pow(Math.abs((a - x)),2)); dis = Math.sqrt(dis); dis += b; return dis;} public static void main( String[] args)throws java.lang.Exception { int n ,r ;  StringTokenizer st = new StringTokenizer(br.readLine()); n = Integer.parseInt(st.nextToken()); r = Integer.parseInt(st.nextToken()); int arr[] = new int[(n + 1)];  double cen[] = new double[(n + 1)];  int i ,j ; for ( i = 1;(i <= n);i++) cen[i] = -1.0; st = new StringTokenizer(br.readLine()); for ( i = 1;(i <= n);i++) arr[i] = Integer.parseInt(st.nextToken()); for ( i = 1;(i <= n);i++) { int f = 0;  double max = -1.0; for ( j = 1;(j <= n);j++) {if ( (((i != j) && (cen[j] != -1.0)) && (Math.abs((arr[i] - arr[j])) <= (2 * r)))) {max = Math.max(max,cal(arr[j],cen[j],arr[i],r)); f = 1; } }if ( (f == 1)) cen[i] = max; else cen[i] = (r * 1.0); }for ( i = 1;(i <= n);i++) System.out.print((cen[i] + " ")); } }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  TaskC.InputReader in = new TaskC.InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskC solver = new TaskC(); solver.Solve(in,out); out.close(); } static class TaskC{ void Solve( InputReader in, PrintWriter out){ int n = in.NextInt();  double r = in.NextInt();  double[] x = new double[n]; for ( int i = 0;(i < n);i++) x[i] = in.NextInt(); double[] y = new double[n]; for ( int i = 0;(i < n);i++) { double maxY = r; for ( int j = 0;(j < i);j++) {if ( (Math.abs((x[i] - x[j])) <= (2 * r))) { double currentY = (Math.sqrt((((2 * r) * (2 * r)) - ((x[i] - x[j]) * (x[i] - x[j])))) + y[j]); maxY = Math.max(maxY,currentY); } }y[i] = maxY; }out.print(y[0]); for ( int i = 1;(i < n);i++) {out.print((" " + y[i])); }out.println(); } static int GetMax( int[] ar){ int max = Integer.MIN_VALUE; for ( int a :ar) {max = Math.max(max,a); }return max;} static int[] GetCount( int[] ar){ return GetCount(ar,GetMax(ar));} static int[] GetCount( int[] ar, int maxValue){ int[] dp = new int[(maxValue + 1)]; for ( int a :ar) {dp[a]++; }return dp;} } }
6	public class Main{ static double[] dp ; static double[][] P ; public static void main( String[] args){ Scanner r = new Scanner(System.in);  int n = r.nextInt();  double[][] g = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) g[i][j] = r.nextDouble(); dp = new double[(1 << n)]; P = new double[(1 << n)][n]; for ( int mask = 0;(mask < (1 << n));mask++) {for ( int d = 0;(d < n);d++) if ( ((mask & (1 << d)) == 0)) for ( int i = 0;(i < n);i++) if ( ((mask & (1 << i)) == 0)) {if ( (i == d)) continue; P[mask][d] += g[i][d]; } }for ( int i = 0;(i < n);i++) {Arrays.fill(dp,-1); double res = go(i,0,g,n,n); System.out.println(res); }} static private double go( int a, int v, double[][] g, int cnt, int n){ if ( (dp[v] != -1)) return dp[v]; if ( (cnt == 1)) {return 1;} else { double ret = 0; for ( int d = 0;(d < n);d++) if ( (((v & (1 << d)) == 0) && (d != a))) { double current = (P[v][d] * go(a,(v | (1 << d)),g,(cnt - 1),n)); ret += current; } return dp[v] = (ret / ((cnt * (cnt - 1)) / 2));}} }
2	public class B{ BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; int ask( int x1, int y1, int x2, int y2)throws IOException { out.println(((((((("? " + x1) + " ") + y1) + " ") + x2) + " ") + y2)); out.flush(); return nextInt();} int inside( int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4){ return (inside(x1,x2,x3,x4) & inside(y1,y2,y3,y4));} int inside( int x1, int x2, int y1, int y2){ return (((x1 <= y1) && (y2 <= x2))?1:0);} int askFlipped( int x1, int y1, int x2, int y2)throws IOException { return ask(y1,x1,y2,x2);} boolean check( int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)throws IOException { if ( ((((x1 > x2) || (y1 > y2)) || (x3 > x4)) || (y3 > y4))) {return false;} if ( ((Math.max(x1,x3) <= Math.min(x2,x4)) && (Math.max(y1,y3) <= Math.min(y2,y4)))) {return false;} return (check(x1,y1,x2,y2) && check(x3,y3,x4,y4));} boolean check( int x1, int y1, int x2, int y2)throws IOException { if ( (ask(x1,y1,x2,y2) != 1)) {return false;} if ( (x1 != x2)) {if ( ((ask((x1 + 1),y1,x2,y2) != 0) || (ask(x1,y1,(x2 - 1),y2) != 0))) {return false;} } if ( (y1 != y2)) {if ( ((ask(x1,(y1 + 1),x2,y2) != 0) || (ask(x1,y1,x2,(y2 - 1)) != 0))) {return false;} } return true;} void solve()throws IOException { int n = nextInt();  int low = 0;  int high = n; while(((high - low) > 1)){ int mid = ((low + high) >> 1);  int ret = ask(1,1,mid,n); if ( (ret == 0)) {low = mid; } else {high = mid; }} int minX2 = high; low = 0; high = n; while(((high - low) > 1)){ int mid = ((low + high) >> 1);  int ret = ask(1,1,mid,n); if ( (ret == 2)) {high = mid; } else {low = mid; }} int maxX2 = high; low = 1; high = (n + 1); while(((high - low) > 1)){ int mid = ((low + high) >> 1);  int ret = ask(mid,1,n,n); if ( (ret == 0)) {high = mid; } else {low = mid; }} int maxX1 = low; low = 1; high = (n + 1); while(((high - low) > 1)){ int mid = ((low + high) >> 1);  int ret = ask(mid,1,n,n); if ( (ret == 2)) {low = mid; } else {high = mid; }} int minX1 = low; low = 0; high = n; while(((high - low) > 1)){ int mid = ((low + high) >> 1);  int ret = askFlipped(1,1,mid,n); if ( (ret == 0)) {low = mid; } else {high = mid; }} int minY2 = high; low = 0; high = n; while(((high - low) > 1)){ int mid = ((low + high) >> 1);  int ret = askFlipped(1,1,mid,n); if ( (ret == 2)) {high = mid; } else {low = mid; }} int maxY2 = high; low = 1; high = (n + 1); while(((high - low) > 1)){ int mid = ((low + high) >> 1);  int ret = askFlipped(mid,1,n,n); if ( (ret == 0)) {high = mid; } else {low = mid; }} int maxY1 = low; low = 1; high = (n + 1); while(((high - low) > 1)){ int mid = ((low + high) >> 1);  int ret = askFlipped(mid,1,n,n); if ( (ret == 2)) {low = mid; } else {high = mid; }} int minY1 = low;  int[] x1s = {minX1,maxX1};  int[] x2s = {minX2,maxX2};  int[] y1s = {minY1,maxY1};  int[] y2s = {minY2,maxY2}; for ( int mask = 0;(mask < 8);mask++) { int x1 = x1s[0];  int x3 = x1s[1];  int x2 = x2s[get(mask,0)];  int x4 = x2s[(get(mask,0) ^ 1)];  int y1 = y1s[get(mask,1)];  int y3 = y1s[(get(mask,1) ^ 1)];  int y2 = y2s[get(mask,2)];  int y4 = y2s[(get(mask,2) ^ 1)]; if ( check(x1,y1,x2,y2,x3,y3,x4,y4)) {out.printf("! %d %d %d %d %d %d %d %d\n",x1,y1,x2,y2,x3,y3,x4,y4); out.flush(); return ;} }} int get( int mask, int i){ return ((mask >> i) & 1);} B()throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.close(); } public static void main( String[] args)throws IOException { new B(); } String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ eof = true; return null;} }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
2	public class CodeForces{ static private int gcd( int a, int b){ if ( (b == 0)) return a; return gcd(b,(a % b));} private long pow( long a, long p){ if ( (p == 0)) return 1; long b = pow(a,(p / 2)); b = (b * b); if ( ((p % 2) == 1)) b *= a; return (b % mod);} static private int countOne( int a){ if ( (a == 0)) return 0; return (countOne((a & (a - 1))) + 1);} int N ; int R ; int[][] C = new int[10][10]; int M ; int mod = 1_000_000_007; long IMPO ; int ans ; int[] dx = new int[]{1,0,-1,0}; int[] dy = new int[]{0,-1,0,1}; Map<String,Boolean> dp = new HashMap<>(); List<List<Integer>> graph = new ArrayList<>(); List<Edge> edges = new ArrayList<>(); int[] parent ; boolean[] visited ; public void run( Scanner scanner)throws IOException { long k = scanner.nextLong();  int len = 1;  long number = 9; for ( int i = 0;true;i++) {if ( ((len * number) < k)) {k -= (len * number); len++; number *= 10; } else {break;}}number /= 9; StringBuilder sb = new StringBuilder(); for ( int i = 1;(i <= 9);i++) {if ( ((len * number) < k)) {k -= (len * number); } else {sb.append(i); break;}}for ( int i = 1;(i < len);i++) {number /= 10; for ( int j = 0;(j <= 9);j++) {if ( ((len * number) < k)) {k -= (len * number); } else {sb.append(j); break;}}}System.out.println(sb.charAt(((int)k - 1))); } public static void main( String[] args)throws NumberFormatException,IOException { Scanner scanner = new Scanner(System.in);  CodeForces jam = new CodeForces(); jam.run(scanner); } }
6	public class Template{ BufferedReader br ; PrintWriter out ; StringTokenizer st ; public static void main( String[] args)throws IOException { new Template().run(); } void run()throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); st = null; out = new PrintWriter(System.out); solve(); br.close(); out.close(); } double dm[] ; double a[][] ; boolean fil[] ; int p[] ; int n ; void solve()throws IOException { n = nextInt(); a = new double[n][n]; for ( int i = 0;(i < n);++i) for ( int j = 0;(j < n);++j) {a[i][j] = nextDouble(); }dm = new double[(1 << n)]; dm[((1 << n) - 1)] = 1; for ( int mask = ((1 << n) - 1);(mask >= 1);--mask) { int c = Integer.bitCount(mask); if ( (c == 1)) continue; double p = ((2.0 / (double)(c - 1)) / (double)c); for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < n);++j) {if ( (((i != j) && ((mask & (1 << i)) > 0)) && ((mask & (1 << j)) > 0))) {dm[(mask ^ (1 << j))] += ((a[i][j] * dm[mask]) * p); } }}}for ( int i = 0;(i < n);++i) {out.print((dm[(1 << i)] + " ")); }} int nextInt()throws IOException { return Integer.parseInt(nextToken());} double nextDouble()throws IOException { return Double.parseDouble(nextToken());} String nextToken()throws IOException { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(br.readLine()); }return st.nextToken();} }
6	public class Main{ StreamTokenizer in ; PrintWriter out ; public static void main( String[] args)throws Exception { new Main().run(); } public void run()throws Exception { Locale.setDefault(Locale.US); in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(new OutputStreamWriter(System.out)); solve(); out.flush(); } public int nextInt()throws Exception { in.nextToken(); return (int)in.nval;} class Senator{ int b ; int l ; public Senator( int b, int l){ this.b = b; this.l = l; } } int n ,k ,A ; double max = Integer.MIN_VALUE; Senator[] a ; public void check( int step, int candy){ if ( (step == n)) { double tmp = 0.0; for ( int mask = 0;(mask < (1 << n));mask++) { double P = 1.0;  int q = 0; for ( int i = 0;(i < n);i++) {if ( (((mask >> i) & 1) != 0)) {P *= (a[i].l / 100.); } else {P *= (1.0 - (a[i].l / 100.)); q += a[i].b; }}if ( (Integer.bitCount(mask) > (n / 2))) {tmp += P; } else {tmp += ((P * A) / (A + q)); }max = Math.max(tmp,max); }} else {for ( int i = 0;(i <= Math.min(k,((100 - a[step].l) / 10)));i++) {a[step].l += (10 * i); check((step + 1),(k - i)); a[step].l -= (10 * i); }}} public void solve()throws Exception { n = nextInt(); k = nextInt(); A = nextInt(); a = new Senator[n]; for ( int i = 0;(i < n);i++) { Senator q = new Senator(nextInt(),nextInt()); a[i] = q; } double ans = 0; for ( int mask = 0;(mask < (1 << ((n + k) - 1)));mask++) {if ( (Integer.bitCount(mask) != k)) continue; int[] b = new int[n];  int x = mask; for ( int i = 0;(i < n);i++) {b[i] = a[i].l; while(((x % 2) == 1)){b[i] += 10; x /= 2; }b[i] = Math.min(b[i],100); x /= 2; } double tmp = 0; for ( int w = 0;(w < (1 << n));w++) { double p = 1.;  double B = 0; for ( int i = 0;(i < n);i++) if ( (((w >> i) & 1) != 0)) p *= (b[i] / 100.); else {p *= (1 - (b[i] / 100.)); B += a[i].b; }if ( (Integer.bitCount(w) > (n / 2))) tmp += p; else tmp += (p * (A / (A + B))); }ans = Math.max(ans,tmp); }out.printf("%.10f\n",ans); } }
6	public class Main{ InputReader input ; PrintWriter output ; void run(){ output = new PrintWriter(new OutputStreamWriter(System.out)); input = new InputReader(System.in); solve(); output.flush(); } public static void main( String[] args){ new Main().run(); } boolean isBitSet( int mask, int i){ return ((mask & (1 << i)) != 0);} int unSet( int mask, int i){ return (mask & (1 << i));} void solve(){ int n = input.ni();  double[][] prb = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {prb[i][j] = input.readDouble(); }} double[] dp = new double[(1 << n)]; dp[0] = 1.0; for ( int i = 0;(i < (1 << n));i++) { int remaining = (n - Integer.bitCount(i));  double remainingProbability = ((remaining * (remaining - 1)) / 2); for ( int j = 0;(j < n);j++) {if ( !isBitSet(i,j)) {for ( int k = 0;(k < n);k++) {if ( !isBitSet(i,k)) dp[(i | (1 << j))] += ((dp[i] * prb[k][j]) / remainingProbability); }} }}for ( int i = 0;(i < n);i++) {output.printf("%.7f ",dp[unSet(((1 << n) - 1),i)]); }output.println(); } class InputReader{ private boolean finished = false; private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private SpaceCharFilter filter ; 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 peek(){ if ( (numChars == -1)) return -1; if ( (curChar >= numChars)) {curChar = 0; try{numChars = stream.read(buf); }catch (IOException e){ return -1;} if ( (numChars <= 0)) return -1; } return buf[curChar];} public int ni(){ 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 String ns(){ 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 isWhitespace(c);} public boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} private String readLine0(){ StringBuilder buf = new StringBuilder();  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 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,ni())); 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,ni())); if ( ((c < '0') || (c > '9'))) throw (new InputMismatchException()); m /= 10; res += ((c - '0') * m); c = read(); }} return (res * sgn);} } public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } }
2	public final class CF_524_D2_D{ static boolean verb = true; static void log( Object X){ if ( verb) System.err.println(X); } static void log( Object[] X){ if ( verb) {for ( Object U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X){ if ( verb) {for ( int U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X, int L){ if ( verb) {for ( int i = 0;(i < L);i++) System.err.print((X[i] + " ")); System.err.println(""); } } static void log( long[] X){ if ( verb) {for ( long U :X) System.err.print((U + " ")); System.err.println(""); } } static void output( Object o){ outputWln((("" + o) + "\n")); } static void outputWln( Object o){ try{out.write(("" + o)); }catch (Exception e){ } } static BufferedWriter out ; static InputReader reader ; static long mod = 1000000007; static void process()throws Exception { out = new BufferedWriter(new OutputStreamWriter(System.out)); reader = new InputReader(System.in); long mymax = (1L << 62); log(mymax); long cut = 0;  int it = 0;  long squares = 1;  int GX = 32;  long[] maxgen = new long[GX]; while((cut < 2000000000000000000L)){maxgen[it] = cut; it++; cut = (1 + (4 * cut)); squares *= 4; } int T = reader.readInt(); for ( int t = 0;(t < T);t++) { int n = reader.readInt();  long k = reader.readLong(); if ( (n >= GX)) {output(("YES " + (n - 1))); } else { long pieces = 3;  long minc = 1;  int size = (n - 1);  long maxc = (1 + maxgen[size]); while(((size > 0) && (maxc < k))){minc += pieces; maxc += (pieces + (maxgen[(size - 1)] * ((2 * pieces) - 1))); size--; pieces = ((2 * pieces) + 1); }if ( ((minc <= k) && (maxc >= k))) {output(("YES " + size)); } else {output("NO"); }}}try{out.close(); }catch (Exception EX){ } } public static void main( String[] args)throws Exception { process(); } static final class InputReader{ private final InputStream stream ; private final byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read()throws IOException { if ( (curChar >= numChars)) {curChar = 0; numChars = stream.read(buf); if ( (numChars <= 0)) {return -1;} } return buf[curChar++];} public final int readInt()throws IOException { int c = read();  boolean neg = false; while(isSpaceChar(c)){c = read(); } char d = (char)c; if ( (d == '-')) {neg = true; c = read(); } int res = 0; do {res *= 10; res += (c - '0'); c = read(); }while(!isSpaceChar(c));if ( neg) return -res; return res;} public final long readLong()throws IOException { int c = read();  boolean neg = false; while(isSpaceChar(c)){c = read(); } char d = (char)c; if ( (d == '-')) {neg = true; c = read(); } long res = 0; do {res *= 10; res += (c - '0'); c = read(); }while(!isSpaceChar(c));if ( neg) return -res; return res;} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
6	public class E implements Runnable{ public static void main( String[] args){ new Thread(null,new E(),"_cf",(1 << 28)).start(); } int n ,m ; char[] str ; int[][] occs ,cost ; int[] dp ; int oo = (int)1e9; int min( int a, int b){ if ( (a < b)) return a; return b;} class FastScanner{ public int BS = (1 << 16); public char NC = (char)0; byte[] buf = new byte[BS]; int bId = 0,size = 0; char c = NC; double num = 1; BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } public char nextChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ num = 1; boolean neg = false; if ( (c == NC)) c = nextChar(); for ( ;((c < '0') || (c > '9'));c = nextChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = nextChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); num *= 10; }return (neg?-res:res);} public String next(){ StringBuilder res = new StringBuilder(); while((c <= 32))c = nextChar(); while((c > 32)){res.append(c); c = nextChar(); }return res.toString();} } }
2	public class Main{ static long initTime ; static final Random rnd = new Random(7777L); static boolean writeLog = false; public static void main( String[] args)throws IOException { initTime = System.currentTimeMillis(); try{writeLog = "true".equals(System.getProperty("LOCAL_RUN_7777")); }catch (SecurityException e){ } new Thread(null,new Runnable(){public void run(){ try{try{if ( new File("input.txt").exists()) System.setIn(new FileInputStream("input.txt"));  }catch (SecurityException e){ } long prevTime = System.currentTimeMillis(); new Main().run(); log((("Total time: " + (System.currentTimeMillis() - prevTime)) + " ms")); log(("Memory status: " + memoryStatus())); }catch (IOException e){ e.printStackTrace(); } } },"1",(1L << 24)).start(); } void run()throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.close(); in.close(); } void solve()throws IOException { long leftBorder = nextLong();  long rightBorder = nextLong();  long[][][][][] dp = new long[64][2][2][2][2]; for ( long[][][][] a :dp) for ( long[][][] b :a) for ( long[][] c :b) for ( long[] d :c) fill(d,-1L); dp[63][0][0][0][0] = 0L; for ( int lastBit = 63;(lastBit > 0);lastBit--) { int curBit = (lastBit - 1);  int leftBit = (int)((leftBorder >> curBit) & 1L);  int rightBit = (int)((rightBorder >> curBit) & 1L); for ( int agl = 0;(agl < 2);agl++) {for ( int alr = 0;(alr < 2);alr++) {for ( int bgl = 0;(bgl < 2);bgl++) {for ( int blr = 0;(blr < 2);blr++) { long prvXor = dp[lastBit][agl][alr][bgl][blr]; if ( (prvXor < 0L)) continue; for ( int ab = 0;(ab < 2);ab++) { int nagl = left(agl,leftBit,ab);  int nalr = right(alr,rightBit,ab); if ( ((nagl < 0) || (nalr < 0))) continue; for ( int bb = 0;(bb < 2);bb++) { int nbgl = left(bgl,leftBit,bb);  int nblr = right(blr,rightBit,bb); if ( ((nbgl < 0) || (nblr < 0))) continue; long setBit = (ab ^ bb); dp[curBit][nagl][nalr][nbgl][nblr] = max(dp[curBit][nagl][nalr][nbgl][nblr],(prvXor | (setBit << curBit))); }}}}}}} long answer = -1L; for ( int agl = 0;(agl < 2);agl++) {for ( int alr = 0;(alr < 2);alr++) {for ( int bgl = 0;(bgl < 2);bgl++) {for ( int blr = 0;(blr < 2);blr++) {answer = max(answer,dp[0][agl][alr][bgl][blr]); }}}}out.println(answer); } int left( int gl, int leftBit, int b){ if ( (gl == 0)) {if ( (b < leftBit)) return -1; if ( (b == leftBit)) return 0; if ( (b > leftBit)) return 1; } return 1;} int right( int lr, int rightBit, int b){ if ( (lr == 0)) {if ( (b < rightBit)) return 1; if ( (b == rightBit)) return 0; if ( (b > rightBit)) return -1; } return 1;} BufferedReader in ; PrintWriter out ; StringTokenizer st = new StringTokenizer(""); String nextToken()throws IOException { while(!st.hasMoreTokens())st = new StringTokenizer(in.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} long nextLong()throws IOException { return Long.parseLong(nextToken());} double nextDouble()throws IOException { return Double.parseDouble(nextToken());} static String memoryStatus(){ return (((((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20) + "/") + (Runtime.getRuntime().totalMemory() >> 20)) + " MB");} static long prevTimeStamp = Long.MIN_VALUE; static long elapsedTime(){ return (System.currentTimeMillis() - prevTimeStamp);} static void log( String format, Object... args){ if ( writeLog) System.err.println(String.format(Locale.US,format,args)); } }
6	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);  TaskE2 solver = new TaskE2(); solver.solve(1,in,out); out.close(); } static class TaskE2{ public void solve( int testNumber, FastScanner in, PrintWriter out){ int t = in.nextInt(); while((t-- > 0)){ int n = in.nextInt(),m = in.nextInt();  int[][] a = new int[n][m]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {a[i][j] = in.nextInt(); }} boolean[][] interesting = new boolean[n][m];  boolean[] hasInteresting = new boolean[m]; for ( int i = 0;(i < n);i++) { List<Pair> list = new ArrayList<>(); for ( int j = 0;(j < m);j++) {list.add(new Pair(a[i][j],j)); }Collections.sort(list,Comparator.comparing((pair)->-pair.val)); for ( int j = 0;((j < m) && (j <= n));j++) {interesting[i][list.get(j).pos] = true; hasInteresting[list.get(j).pos] = true; }} boolean[] goodMask = new boolean[(1 << n)]; for ( int mask = 0;(mask < (1 << n));mask++) { int best = Integer.MAX_VALUE;  int cur = mask; do {best = Math.min(best,cur); cur = ((cur >> 1) | ((cur & 1) << (n - 1))); }while((cur != mask));goodMask[mask] = (mask == best); } int[] dp = new int[(1 << n)]; for ( int i = 0;(i < m);i++) {if ( !hasInteresting[i]) {continue;} for ( int j = 0;(j < n);j++) {if ( !interesting[j][i]) {continue;} int supermask = (((1 << n) - 1) - (1 << j));  int val = a[j][i]; for ( int mask = supermask;;mask = ((mask - 1) & supermask)) {if ( ((dp[mask] + val) > dp[(mask | (1 << j))])) {dp[(mask | (1 << j))] = (dp[mask] + val); } if ( (mask == 0)) {break;} }}for ( int mask = 0;(mask < (1 << n));mask++) {if ( !goodMask[mask]) {continue;} int best = 0;  int cur = mask; do {best = Math.max(best,dp[cur]); cur = ((cur >> 1) | ((cur & 1) << (n - 1))); }while((cur != mask));do {dp[cur] = best; cur = ((cur >> 1) | ((cur & 1) << (n - 1))); }while((cur != mask));}}out.println(dp[((1 << n) - 1)]); }} class Pair{ int val ; int pos ; public Pair( int val, int pos){ this.val = val; this.pos = pos; } } } static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream in){ br = new BufferedReader(new InputStreamReader(in)); } public FastScanner( String fileName){ try{br = new BufferedReader(new FileReader(fileName)); }catch (FileNotFoundException e){ e.printStackTrace(); } } 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();} } }
6	public class E_fast{ static int g[][] ; static int n ,m ; static char[] s ; static int dp[] ,inf = (int)2e9; static int cost[][] ; public static void main( String[] args)throws Exception { InputReader in = new InputReader(System.in);  PrintWriter pw = new PrintWriter(System.out); n = in.nextInt(); m = in.nextInt(); s = in.next().toCharArray(); g = new int[m][m]; for ( int i = 1;(i < n);i++) { int x = (s[(i - 1)] - 'a'),y = (s[i] - 'a'); if ( (x != y)) {g[x][y]++; g[y][x]++; } }cost = new int[m][(1 << m)]; for ( int i = 0;(i < m);i++) { int w = 0; for ( int j = 0;(j < m);j++) w += g[i][j]; pre(i,0,0,-w); }dp = new int[(1 << m)]; Arrays.fill(dp,-1); pw.println(solve(0,0)); pw.close(); } static void pre( int x, int pos, int mask, int w){ if ( (pos >= m)) {cost[x][mask] = w; return ;} pre(x,(pos + 1),mask,w); pre(x,(pos + 1),set(mask,pos),(w + (2 * g[x][pos]))); } static int solve( int pos, int mask){ if ( (pos >= m)) return 0; if ( (dp[mask] != -1)) return dp[mask]; int min = inf; for ( int i = 0;(i < m);i++) {if ( !check(mask,i)) { int res = ((cost[i][mask] * pos) + solve((pos + 1),set(mask,i))); min = min(min,res); } }return dp[mask] = min;} static boolean check( int N, int pos){ return ((N & (1 << pos)) != 0);} static int set( int N, int pos){ return N = (N | (1 << pos));} static class InputReader{ public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public String next()throws Exception { while(((tokenizer == null) || !tokenizer.hasMoreTokens()))tokenizer = new StringTokenizer(reader.readLine()); return tokenizer.nextToken();} public int nextInt()throws Exception { return Integer.parseInt(next());} } }
4	public class cf1497_Div2_E2{ static int[] spf ; public static int factor( int n){ int val = 1; while((n > 1)){ int cnt = 0;  int p = spf[n]; while(((n % p) == 0)){cnt++; n /= p; }if ( ((cnt % 2) == 1)) val *= p; }return val;} public static void main( String[] args)throws IOException { FastScanner in = new FastScanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int t = in.nextInt();  int max = ((int)1e7 + 1);  boolean[] prime = new boolean[(max + 1)]; Arrays.fill(prime,true); prime[0] = prime[1] = false; spf = new int[max]; for ( int i = 2;(i < max);i++) spf[i] = i; for ( int i = 2;((i * i) < max);i++) {if ( prime[i]) {spf[i] = i; for ( int j = (i * i);(j < max);j += i) {prime[j] = false; spf[j] = i; }} } int[] cnts = new int[max]; for ( ;(t > 0);t--) { int n = in.nextInt();  int k = in.nextInt();  int[] vals = new int[n]; for ( int i = 0;(i < n);i++) vals[i] = factor(in.nextInt()); int[][] left = new int[(n + 1)][(k + 1)]; for ( int x = 0;(x <= k);x++) { int l = n;  int now = 0; for ( int i = (n - 1);(i >= 0);i--) {while((((l - 1) >= 0) && ((now + ((cnts[vals[(l - 1)]] > 0)?1:0)) <= x))){l--; now += ((cnts[vals[l]] > 0)?1:0); cnts[vals[l]]++; }left[i][x] = l; if ( (cnts[vals[i]] > 1)) now--; cnts[vals[i]]--; }} int oo = (int)1e9;  int[][] dp = new int[(n + 1)][(k + 1)]; for ( int i = 1;(i <= n);i++) Arrays.fill(dp[i],oo); for ( int i = 1;(i <= n);i++) {for ( int j = 0;(j <= k);j++) {if ( (j > 0)) dp[i][j] = dp[i][(j - 1)]; for ( int x = 0;(x <= j);x++) { int l = left[(i - 1)][x]; dp[i][j] = Math.min(dp[i][j],(dp[l][(j - x)] + 1)); }}} int min = Integer.MAX_VALUE; for ( int i = 0;(i <= k);i++) {min = Math.min(min,dp[n][i]); }out.println(min); }out.close(); } static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream i){ br = new BufferedReader(new InputStreamReader(i)); st = new StringTokenizer(""); } public String next()throws IOException { if ( st.hasMoreTokens()) return st.nextToken(); else st = new StringTokenizer(br.readLine()); return next();} public int nextInt()throws IOException { return Integer.parseInt(next());} } }
6	public class P111C{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); double EPS = 1e-9; int h ,w ; void run(){ h = sc.nextInt(); w = sc.nextInt(); solve(); } void solve(){ n = (w * h); g = new long[n]; int[] dx = {0,0,-1,1};  int[] dy = {-1,1,0,0}; for ( int y = 0;(y < h);y++) {for ( int x = 0;(x < w);x++) {for ( int k = 0;(k < 4);k++) { int x2 = (x + dx[k]);  int y2 = (y + dy[k]); if ( ((((x2 >= 0) && (x2 < w)) && (y2 >= 0)) && (y2 < h))) {g[((y * w) + x)] |= (1L << ((y2 * w) + x2)); } }}}candidate = new int[n]; xs = new Xorshift(); mds = ((1L << n) - 1); mds(0,0,0); println(((n - Long.bitCount(mds)) + "")); } int n ; long[] g ; long mds ; int[] candidate ; Xorshift xs ; void mds( long choosed, long removed, long covered){ if ( (Long.bitCount(choosed) >= Long.bitCount(mds))) return ; if ( (covered == ((1L << n) - 1))) {if ( (Long.bitCount(choosed) < Long.bitCount(mds))) mds = choosed; return ;} { long s = covered; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); s |= ((1L << i) | g[i]); }if ( (s != ((1L << n) - 1))) {return ;} } int index = 0;  int k = -1; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); if ( (((covered >>> i) & 1) == 1)) {if ( (Long.bitCount((g[i] & ~covered)) == 0)) {mds(choosed,(removed | (1L << i)),covered); return ;} else if ( ((Long.bitCount((g[i] & ~covered)) == 1) && (((g[i] & ~covered) & ~removed) != 0))) {mds(choosed,(removed | (1L << i)),covered); return ;} } else {if ( (Long.bitCount((g[i] & ~removed)) == 0)) {mds((choosed | (1L << i)),(removed | (1L << i)),((covered | (1L << i)) | g[i])); return ;} else if ( ((Long.bitCount((g[i] & ~removed)) == 1) && (((g[i] & ~removed) | (g[i] & ~covered)) == (g[i] & ~removed)))) { int j = Long.numberOfTrailingZeros((g[i] & ~removed)); mds((choosed | (1L << j)),((removed | (1L << i)) | (1L << j)),((covered | (1L << j)) | g[j])); return ;} }if ( ((k == -1) || (Long.bitCount((g[i] & ~covered)) > Long.bitCount((g[k] & ~covered))))) {index = 0; candidate[index++] = i; k = i; } else if ( (Long.bitCount((g[i] & ~covered)) == Long.bitCount((g[k] & ~covered)))) {candidate[index++] = i; } }if ( (k == -1)) return ; mds((choosed | (1L << k)),(removed | (1L << k)),((covered | (1L << k)) | g[k])); mds(choosed,(removed | (1L << k)),covered); } class Xorshift{ int x ,y ,z ,w ; public Xorshift(){ x = 123456789; y = 362436069; z = 521288629; w = 88675123; } public Xorshift( int seed){ x = _(seed,0); y = _(x,1); z = _(y,2); w = _(z,3); } int _( int s, int i){ return (((1812433253 * (s ^ (s >>> 30))) + i) + 1);} public int nextInt(){ int t = (x ^ (x << 11)); x = y; y = z; z = w; return w = (((w ^ (w >>> 19)) ^ t) ^ (t >>> 8));} public int nextInt( int n){ return (int)(n * nextDouble());} public double nextDouble(){ int a = (nextInt() >>> 5),b = (nextInt() >>> 6); return (((a * 67108864.0) + b) * (1.0 / (1L << 53)));} } void println( String s){ System.out.println(s); } void print( String s){ System.out.print(s); } public static void main( String[] args){ Locale.setDefault(Locale.US); new P111C().run(); } }
0	public class Codechef{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long n = in.nextLong();  long m = in.nextLong();  long k = in.nextLong();  long l = in.nextLong();  long j = ((k + l) / m); if ( (((k + l) % m) != 0)) j++; if ( (((k + l) > n) || ((j * m) > n))) {System.out.println(-1); } else {System.out.println(j); }} }
2	public class A{ static private final int mod = ((int)1e9 + 9); final IOFast io = new IOFast(); long k ; public void run()throws IOException { long n = io.nextLong();  long m = io.nextLong(); k = io.nextLong(); long low = -1,high = ((m / k) + 1); while(((high - low) > 1)){ long mid = ((low + high) / 2);  long u = (mid * k); if ( (m < u)) {high = mid; continue;} long val = u; val += (((m - u) / (k - 1)) * k); if ( (((m - u) % (k - 1)) == 0)) val -= 1; else val += ((m - u) % (k - 1)); if ( (val > n)) {low = mid; } else {high = mid; }} long pow = powmod(2,high,mod);  long score = (m - (high * k)); score = ((score + (((pow - 1) * 2) * k)) % mod); io.out.println(score); } static long powmod( long n, long r, int m){ long res = 1; for ( ;(r != 0);r >>>= 1,n = ((n * n) % m)) {if ( ((r & 1) == 1)) {res = (res * n); if ( (res >= m)) {res %= m; } } }return res;} void main()throws IOException { try{run(); }catch (EndOfFileRuntimeException e){ } io.out.flush(); } public static void main( String[] args)throws IOException { new A().main(); } static class EndOfFileRuntimeException extends RuntimeException{ static private final long serialVersionUID = -8565341110209207657L; } public static class IOFast{ private BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); private PrintWriter out = new PrintWriter(System.out); static private int pos ,readLen ; static private final char[] buffer = new char[(1024 * 8)]; static private final char[] str = new char[((500000 * 8) * 2)]; static private boolean[] isDigit = new boolean[256]; static private boolean[] isSpace = new boolean[256]; static private boolean[] isLineSep = new boolean[256]; {for ( int i = 0;(i < 10);i++) {isDigit[('0' + i)] = true; }isDigit['-'] = true; isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true; isLineSep['\r'] = isLineSep['\n'] = true; }public int read()throws IOException { if ( (pos >= readLen)) {pos = 0; readLen = in.read(buffer); if ( (readLen <= 0)) {throw (new EndOfFileRuntimeException());} } return buffer[pos++];} public long nextLong()throws IOException { return Long.parseLong(nextString());} public char nextChar()throws IOException { while(true){final int c = read(); if ( !isSpace[c]) {return (char)c;} }} int reads( char[] cs, int len, boolean[] accept)throws IOException { try{while(true){final int c = read(); if ( accept[c]) {break;} str[len++] = (char)c; } }catch (EndOfFileRuntimeException e){ ;} return len;} public String nextString()throws IOException { return new String(next());} public char[] next()throws IOException { int len = 0; str[len++] = nextChar(); len = reads(str,len,isSpace); return Arrays.copyOf(str,len);} } }
5	public class CF274A{ public static void main( String[] args)throws Exception { new CF274A().solve(); } private void solve()throws Exception { Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  long k = sc.nextInt();  Integer[] a = new Integer[n]; for ( int i = 0;(i < n);i++) {a[i] = sc.nextInt(); }Arrays.sort(a); HashSet<Integer> used = new HashSet<>(n);  int count = 0; for ( int i = 0;(i < n);i++) { Integer v = a[i]; if ( !used.contains(v)) {count++; long next = (v * k); if ( (next <= 1000000000)) used.add((int)next); } }System.out.println(count); } }
0	public class Main{ public static void main( String[] args)throws IOException { InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream); try(PrintWriter out=new PrintWriter(outputStream)){ TaskB solver = new TaskB(); solver.solve(1,in,out); }} } class TaskB{ public void solve( int testNumber, InputReader in, PrintWriter out)throws IOException { String n = in.next(); out.println(25); } } class InputReader{ private final BufferedReader reader ; private StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public String nextLine(){ try{return reader.readLine(); }catch (IOException e){ throw (new RuntimeException(e));} } public String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(nextLine()); }return tokenizer.nextToken();} }
0	public class Test{ public static void main( String[] args)throws IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(bf.readLine()); if ( ((n % 2) == 0)) System.out.println(((4 + " ") + (n - 4))); else System.out.println(((9 + " ") + (n - 9))); } }
1	public class Main{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  String str = in.next();  int cnt = 0; for ( int i = 0;(i < str.length());++i) {if ( (str.charAt(i) == '1')) {++cnt; } } int i = 0; for ( ;(i < str.length());++i) {if ( (str.charAt(i) == '0')) {System.out.print("0"); } else if ( (str.charAt(i) == '2')) {while((cnt-- > 0)){System.out.print("1"); }System.out.print("2"); } }while((cnt-- > 0)){System.out.print("1"); }in.close(); } }
4	public class E2_SquareFreeFast{ static FastScanner sc = new FastScanner(); static PrintWriter out = new PrintWriter(System.out); public static void main( String[] args){ int T = sc.nextInt();  int MAX = (int)1e7;  int[] canonical = new int[(MAX + 1)]; canonical[1] = 1; for ( int factor = 2;(factor <= MAX);factor++) {if ( (canonical[factor] == 0)) {for ( int mult = factor;(mult <= MAX);mult += factor) { int prev = canonical[(mult / factor)]; if ( ((prev % factor) == 0)) {canonical[mult] = (prev / factor); } else {canonical[mult] = (prev * factor); }}} } int[] last = new int[(MAX + 1)]; while((T-- > 0)){ int N = sc.nextInt();  int K = sc.nextInt();  int[] a = new int[(N + 1)];  int[][] dp = new int[2][(K + 1)];  int[][] start = new int[2][(K + 1)];  int ptr = 0; for ( int i = 1;(i <= N);i++) { int nxt = (1 ^ ptr); a[i] = canonical[sc.nextInt()]; for ( int k = 0;(k <= K);k++) {if ( (start[ptr][k] > last[a[i]])) {dp[nxt][k] = dp[ptr][k]; start[nxt][k] = start[ptr][k]; } else {dp[nxt][k] = (dp[ptr][k] + 1); start[nxt][k] = i; }if ( (((i > 1) && (k > 0)) && (start[ptr][(k - 1)] <= last[a[i]]))) {if ( ((dp[ptr][(k - 1)] < dp[nxt][k]) || ((dp[ptr][(k - 1)] == dp[nxt][k]) && (start[ptr][(k - 1)] > start[nxt][k])))) {dp[nxt][k] = dp[ptr][(k - 1)]; start[nxt][k] = start[ptr][(k - 1)]; } } }last[a[i]] = i; ptr = nxt; }for ( int v :a) {last[v] = 0; }out.println(dp[ptr][K]); }out.close(); } static class FastScanner{ private int BS = (1 << 16); private char NC = (char)0; private byte[] buf = new byte[BS]; private int bId = 0,size = 0; private char c = NC; private double cnt = 1; private BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } char getChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} int nextInt(){ return (int)nextLong();} long nextLong(){ cnt = 1; boolean neg = false; if ( (c == NC)) c = getChar(); for ( ;((c < '0') || (c > '9'));c = getChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = getChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); cnt *= 10; }return (neg?-res:res);} } }
4	public class realfast implements Runnable{ static private final int INF = (int)1e9; long in = 1000000007; long fac[] = new long[1000001]; long inv[] = new long[1000001]; public void solve()throws IOException { int n = readInt();  long m = readInt();  long method[][] = new long[(n + 1)][(n + 1)]; for ( int i = 0;(i <= n);i++) {method[0][i] = 1; method[i][0] = 1; }for ( int i = 1;(i <= n);i++) {for ( int j = 1;(j <= n);j++) {for ( int k = i;(k >= 0);k--) {method[i][j] = (((method[i][j] % m) + (method[k][(j - 1)] % m)) % m); }}} long sum[][] = new long[(n + 2)][(n + 2)]; sum[0][0] = 1; long len[][] = new long[(n + 1)][(n + 1)]; for ( int i = 0;(i <= n);i++) {len[i][0] = 1; len[0][i] = 1; }for ( int i = 2;(i <= n);i++) {for ( int j = 1;(j < i);j++) {len[j][(i - j)] = (((len[(j - 1)][(i - j)] % m) + (len[j][((i - j) - 1)] % m)) % m); }} long gal[] = new long[((2 * n) + 1)]; for ( int i = 0;(i <= n);i++) {for ( int j = 0;(j <= n);j++) {gal[(i + j)] = ((gal[(i + j)] + len[i][j]) % m); }}for ( int i = 1;(i <= n);i++) {if ( (i == (n - 1))) continue; for ( int j = 1;(j <= i);j++) {for ( int k = 1;(k <= j);k++) { long val = sum[(i - k)][(j - k)]; val = ((val * method[(j - k)][k]) % m); val = ((val * gal[(k - 1)]) % m); sum[(i + 1)][j] = ((sum[(i + 1)][j] + val) % m); }}} long ans = 0; for ( int i = 1;(i <= n);i++) {ans = ((ans + sum[(n + 1)][i]) % m); }out.println(ans); } public int value( int[] seg, int left, int right, int index, int l, int r){ if ( (left > right)) {return -100000000;} if ( ((right < l) || (left > r))) return -100000000; if ( ((left >= l) && (right <= r))) return seg[index]; int mid = (left + ((right - left) / 2));  int val = value(seg,left,mid,((2 * index) + 1),l,r);  int val2 = value(seg,(mid + 1),right,((2 * index) + 2),l,r); return Math.max(val,val2);} public int gcd( int a, int b){ if ( (a < b)) { int t = a; a = b; b = t; } if ( ((a % b) == 0)) return b; return gcd(b,(a % b));} public long pow( long n, long p, long m){ if ( (p == 0)) return 1; long val = pow(n,(p / 2),m); ;val = ((val * val) % m); if ( ((p % 2) == 0)) return val; else return ((val * n) % m);} public static void main( String[] args){ new Thread(null,new realfast(),"",(128 * (1L << 20))).start(); } static private final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null); private BufferedReader reader ; private StringTokenizer tokenizer ; private PrintWriter out ; private String readString()throws IOException { while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(reader.readLine()); }return tokenizer.nextToken();} @SuppressWarnings private int readInt()throws IOException { return Integer.parseInt(readString());} }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  Parser in = new Parser(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ int mod = 1000000009; public void solve( int testNumber, Parser in, OutputWriter out){ int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int o = m; m -= (n - (n / k)); if ( (m < 0)) m = 0;  long temp = (n / k);  long ans ; if ( (m == 0)) ans = 0; else {ans = (((MathUtils.modpow(2,(m + 1),mod) + mod) - 2) % mod); ans = ((ans * k) % mod); }out.println(((ans + (o - (m * k))) % mod)); } } class Parser{ private BufferedReader din ; private StringTokenizer tokenizer ; public Parser( InputStream in){ din = new BufferedReader(new InputStreamReader(in)); tokenizer = null; } public String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new StringTokenizer(din.readLine()); }catch (Exception e){ throw (new UnknownError());} }return tokenizer.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } class OutputWriter extends PrintWriter{ public OutputWriter( Writer out){ super(out); } public OutputWriter( OutputStream out){ super(out); } }
0	public class Main{ private StreamTokenizer in ; private PrintWriter out ; public static void main( String[] args)throws IOException { new Main().run(); } private void run()throws IOException { in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(new OutputStreamWriter(System.out)); out.print(25); out.flush(); } }
2	public class A{ static private final long MOD = 1000000009L; public static void main( String[] args)throws IOException { Scanner in = new Scanner(System.in);  long n = in.nextInt();  long m = in.nextInt();  long k = in.nextInt();  long w = (n - m);  long c = (w * k); if ( (c >= n)) {System.out.println(m); return ;} long rem = (n - c);  long h = (rem / k);  long p = power(2,(h + 1)); p -= 2; p += MOD; p %= MOD; p *= k; p %= MOD; long point = ((p + m) - ((h * k) % MOD)); point += MOD; point %= MOD; System.out.println(point); } static private long power( int num, long power){ if ( (power == 0)) return 1; long res = power(num,(power / 2)); res = ((res * res) % MOD); if ( ((power % 2) != 0)) res *= num; res %= MOD; return res;} }
0	public class pregunta1{ public static void main( String[] args){ System.out.println("25"); } }
4	public class D{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  int m = in.nextInt();  boolean[][] graph = new boolean[n][n]; for ( int i = 0;(i < m);i++) { int a = (in.nextInt() - 1);  int b = (in.nextInt() - 1); graph[a][b] = true; } int res = Integer.MAX_VALUE; for ( int center = 0;(center < n);center++) { int calc = 0; for ( int i = 0;(i < n);i++) {if ( !graph[center][i]) calc++; if ( !graph[i][center]) calc++; }if ( !graph[center][center]) calc--;  int[] match = new int[n]; Arrays.fill(match,-1); int max = 0; for ( int i = 0;(i < n);i++) if ( (i != center)) if ( can(i,graph,new boolean[n],center,match)) max++;  int unusable = ((m - (((2 * n) - 1) - calc)) - max); calc += unusable; calc += (((2 * (n - 1)) - (2 * max)) / 2); res = Math.min(res,calc); }System.out.println(res); } static private boolean can( int at, boolean[][] graph, boolean[] visited, int center, int[] match){ if ( visited[at]) return false; visited[at] = true; for ( int to = 0;(to < graph.length);to++) if ( graph[at][to]) if ( (to != center)) if ( ((match[to] == -1) || can(match[to],graph,visited,center,match))) {match[to] = at; return true;}  return false;} }
2	public class A{ public static void main( String[] ar)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  long k = Long.parseLong(br.readLine());  long l = 1,h = 1000000000000l;  long p[] = new long[13]; for ( int i = 1;(i <= 12);i++) { long ll = (9 * i); p[i] = (ll * (long)Math.pow(10,(i - 1))); p[i] += p[(i - 1)]; }while(((h - l) > 1)){ long mid = ((l + h) / 2);  long num = (long)(Math.log(mid) / Math.log(10));  long l1 = (p[(int)num] + ((num + 1) * (mid - (long)Math.pow(10,num))));  long l2 = (p[(int)num] + ((num + 1) * ((mid - (long)Math.pow(10,num)) + 1))); if ( (k <= l1)) h = mid; else if ( (k > l2)) l = mid; else {l = mid; h = mid; }}if ( ((h - l) == 1)) { long num = (long)(Math.log(h) / Math.log(10));  long l1 = (p[(int)num] + ((num + 1) * (h - (long)Math.pow(10,num))));  long l2 = (p[(int)num] + ((num + 1) * ((h - (long)Math.pow(10,num)) + 1))); if ( ((k > l1) && (k <= l2))) {l = h; } } long n = (long)(Math.log(l) / Math.log(10));  long u = (p[(int)n] + ((n + 1) * (l - (long)Math.pow(10,n)))); k -= u; String ss = String.valueOf(l); System.out.println(ss.charAt((int)(k - 1))); } }
6	public class P111C{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); double EPS = 1e-9; int h ,w ; void run(){ h = sc.nextInt(); w = sc.nextInt(); solve(); } void solve(){ n = (w * h); g = new long[n]; int[] dx = {0,0,-1,1};  int[] dy = {-1,1,0,0}; for ( int y = 0;(y < h);y++) {for ( int x = 0;(x < w);x++) {for ( int k = 0;(k < 4);k++) { int x2 = (x + dx[k]);  int y2 = (y + dy[k]); if ( ((((x2 >= 0) && (x2 < w)) && (y2 >= 0)) && (y2 < h))) {g[((y * w) + x)] |= (1L << ((y2 * w) + x2)); } }}}mds = ((1L << n) - 1); mds(0,0,0); println(((n - Long.bitCount(mds)) + "")); } int n ; long[] g ; long mds ; void mds( long choosed, long removed, long covered){ if ( (covered == ((1L << n) - 1))) {mds = choosed; return ;} if ( (Long.bitCount(choosed) >= (Long.bitCount(mds) - 1))) return ; long s = covered; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); s |= ((1L << i) | g[i]); }if ( (s != ((1L << n) - 1))) return ; int k = -1; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); if ( (((covered >>> i) & 1) == 1)) {if ( (Long.bitCount((g[i] & ~covered)) <= 1)) {mds(choosed,(removed | (1L << i)),covered); return ;} } else {if ( (Long.bitCount((g[i] & ~removed)) == 0)) {mds((choosed | (1L << i)),(removed | (1L << i)),((covered | (1L << i)) | g[i])); return ;} else if ( ((Long.bitCount((g[i] & ~removed)) == 1) && ((g[i] & (~removed | ~covered)) == (g[i] & ~removed)))) { int j = Long.numberOfTrailingZeros((g[i] & ~removed)); mds((choosed | (1L << j)),((removed | (1L << i)) | (1L << j)),((covered | (1L << j)) | g[j])); return ;} }if ( ((k == -1) || (Long.bitCount((g[i] & ~covered)) > Long.bitCount((g[k] & ~covered))))) k = i; }if ( (k == -1)) return ; mds((choosed | (1L << k)),(removed | (1L << k)),((covered | (1L << k)) | g[k])); mds(choosed,(removed | (1L << k)),covered); } void println( String s){ System.out.println(s); } public static void main( String[] args){ Locale.setDefault(Locale.US); new P111C().run(); } }
6	public class C599{ static ArrayList<Integer>[] adj ; static long[] a ; static int[] type ; static Map<Long,Integer> map ; static int[] vis ; static HashSet<Integer> cy ; static boolean[] good ; static int[] dp ; static HashSet<Integer>[] nodes ; public static void main( String[] args){ MyScanner sc = new MyScanner();  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  int k = sc.nextInt();  int cur = 0; a = new long[75007]; long sum = 0; type = new int[75007]; map = new HashMap<>(); long[] typeSum = new long[k]; for ( int i = 0;(i < k);i++) { int n = sc.nextInt();  long temp = sum; for ( int j = 0;(j < n);j++) {cur++; a[cur] = sc.nextLong(); type[cur] = i; map.put(a[cur],cur); sum += a[cur]; }typeSum[i] = (sum - temp); } boolean notDiv = ((sum % k) != 0);  long need = (sum / k);  int n = cur; adj = new ArrayList[(n + 1)]; for ( int i = 1;(i <= n);i++) adj[i] = new ArrayList<>(); for ( int i = 1;(i <= n);i++) { long delta = (need - typeSum[type[i]]);  long find = (a[i] + delta); if ( map.containsKey(find)) {if ( ((type[map.get(find)] != type[i]) || (delta == 0))) adj[i].add(map.get(find)); } }vis = new int[(n + 1)]; good = new boolean[(1 << k)]; good[0] = true; nodes = new HashSet[(1 << k)]; for ( int i = 1;(i <= n);i++) {if ( (vis[i] == 0)) {cy = new HashSet<>(); boolean b = dfs(i);  int mask = 0; for ( Integer node :cy) {mask |= (1 << type[node]); }if ( (mask != 0)) nodes[mask] = cy; good[mask] = true; } }dp = new int[(1 << k)]; Arrays.fill(dp,-1); int possible = solve(((1 << k) - 1)); if ( ((possible == 1) && !notDiv)) { ArrayList<Integer> masks = dfs2(((1 << k) - 1));  long[] num = new long[k];  int[] ret = new int[k]; for ( Integer mask :masks) {for ( Integer node :nodes[mask]) {num[type[node]] = a[node]; ret[type[adj[node].get(0)]] = (type[node] + 1); }} boolean good = true;  Set<Integer> soFar = new HashSet<>(); for ( int i = 0;(i < ret.length);i++) {if ( soFar.contains(ret[i])) good = false; soFar.add(ret[i]); }if ( !good) {out.println("No"); out.close(); return ;} out.println("Yes"); for ( int i = 0;(i < k);i++) {out.println(((num[i] + " ") + ret[i])); }} else {out.println("No"); }out.close(); } static int solve( int mask){ if ( (dp[mask] != -1)) return dp[mask]; if ( good[mask]) return dp[mask] = 1; int ret = 0; for ( int i = ((mask - 1) & mask);(i > 0);i = ((i - 1) & mask)) {ret = (solve(i) & solve((mask ^ i))); if ( (ret == 1)) break; }return dp[mask] = ret;} static ArrayList<Integer> dfs2( int mask){ ArrayList<Integer> ret = new ArrayList<>(); if ( good[mask]) {ret.add(mask); return ret;} for ( int i = ((mask - 1) & mask);(i > 0);i = ((i - 1) & mask)) {if ( ((dp[i] == 1) && (dp[(mask ^ i)] == 1))) { ArrayList<Integer> one = dfs2(i);  ArrayList<Integer> two = dfs2((mask ^ i)); ret.addAll(one); ret.addAll(two); break;} }return ret;} static boolean dfs( int cur){ vis[cur] = 1; boolean ret = false; for ( Integer next :adj[cur]) {if ( (vis[next] == 0)) { boolean cycle = dfs(next); if ( cycle) {if ( !cy.contains(cur)) {cy.add(cur); ret = true; break;} } } else if ( (vis[next] == 1)) {cy.add(next); cy.add(cur); if ( (next != cur)) ret = true; break;} }vis[cur] = 2; return ret;} public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } }
0	public class ToyArmy{ public static void main( String[] args){ int n = new Scanner(System.in).nextInt(); System.out.println((n + (n / 2))); } }
0	public class test5{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long x = in.nextLong(); if ( (x >= 3)) {if ( ((x % 2) != 0)) System.out.println(((x * (x - 1)) * (x - 2))); else if ( ((x % 3) == 0)) System.out.println((((x - 3) * (x - 1)) * (x - 2))); else System.out.println(((x * (x - 1)) * (x - 3))); } else System.out.println(x); } }
5	public class A{ static MyScanner sc ; static PrintWriter pw ; public static void main( String[] args)throws Throwable { sc = new MyScanner(); pw = new PrintWriter(System.out); n = sc.nextInt(); T = sc.nextLong(); p = new int[n]; l = new int[n]; x = new int[n]; t = new int[n]; adj = new ArrayList[n]; for ( int i = 0;(i < n);i++) x[i] = sc.nextInt(); for ( int i = 0;(i < n);i++) t[i] = sc.nextInt(); adj[0] = new ArrayList<>(); for ( int i = 1;(i < n);i++) {adj[i] = new ArrayList<>(); p[i] = (sc.nextInt() - 1); l[i] = sc.nextInt(); adj[p[i]].add(i); }ftCnt = new long[N]; ftSum = new long[N]; ans = new long[n]; dfs(0); pw.println(ans[0]); pw.flush(); pw.close(); } static int n ; static long T ; static int[] p ,l ,x ,t ; static ArrayList<Integer>[] adj ; static long[] ans ; static void dfs( int u){ update(t[u],x[u],((1L * x[u]) * t[u])); ans[u] = getMaxCnt(); long[] vals = {-1,-1,-1}; for ( int v :adj[u]) {T -= (2 * l[v]); dfs(v); vals[0] = ans[v]; Arrays.sort(vals); T += (2 * l[v]); }if ( (u != 0)) {if ( (vals[1] != -1)) ans[u] = Math.max(ans[u],vals[1]); } else {if ( (vals[2] != -1)) ans[u] = Math.max(ans[u],vals[2]); }update(t[u],-x[u],((-1L * x[u]) * t[u])); } static int N = ((int)1e6 + 2); static long[] ftCnt ,ftSum ; static void update( int idx, long cnt, long val){ while((idx < N)){ftCnt[idx] += cnt; ftSum[idx] += val; idx += (idx & -idx); }} static long getSum( int idx){ long ret = 0; while((idx > 0)){ret += ftSum[idx]; idx -= (idx & -idx); }return ret;} static long getCnt( int idx){ long ret = 0; while((idx > 0)){ret += ftCnt[idx]; idx -= (idx & -idx); }return ret;} static long getMaxCnt(){ int start = 1,end = (N - 1),ans = (N - 1); while((start <= end)){ int mid = ((start + end) / 2); if ( (getSum(mid) >= T)) {ans = mid; end = (mid - 1); } else start = (mid + 1); } long remT = (T - ((ans > 1)?getSum((ans - 1)):0));  long cnt = ((ans > 1)?getCnt((ans - 1)):0);  long cntOfVal = (getCnt(ans) - cnt); cnt += Math.min(cntOfVal,(remT / ans)); return cnt;} static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } }
2	public class ProblemA{ static private long MOD = 1000000009; public void solve()throws Exception { long n = nextInt();  long m = nextInt();  long k = nextInt();  long tmp = (1024 * 1024);  long res = 0;  long nTmp = n;  long mTmp = m; while((tmp > 0)){while(((mTmp >= ((k - 1) * tmp)) && ((nTmp - (k * tmp)) >= (mTmp - ((k - 1) * tmp))))){nTmp -= (k * tmp); mTmp -= ((k - 1) * tmp); }tmp /= 2; } long fullC = (mTmp / k);  long pow2 = getPow(2,(fullC + 1),MOD); res = ((((((res + pow2) + MOD) - 2) % MOD) * k) % MOD); mTmp = (mTmp % k); res = ((res + mTmp) % MOD); nTmp = n; mTmp = ((m - (fullC * k)) - mTmp); tmp = (1024 * 1024); while((tmp > 0)){while(((mTmp >= ((k - 1) * tmp)) && ((nTmp - (k * tmp)) >= (mTmp - ((k - 1) * tmp))))){nTmp -= (k * tmp); mTmp -= ((k - 1) * tmp); res = ((res + ((k - 1) * tmp)) % MOD); }tmp /= 2; }out.println(res); } static long[] pows = new long[1000000]; public static long getPow( long base, long pow, long mod){ if ( ((pow < pows.length) && (pows[(int)pow] != 0))) {return pows[(int)pow];} if ( (pow == 0)) {pows[0] = 1; return 1;} if ( (pow == 1)) {pows[1] = base; return base;} long res = getPow(base,(pow / 2),mod); res = ((res * res) % mod); res = ((res * getPow(base,(pow % 2),mod)) % mod); if ( (pow < pows.length)) {pows[(int)pow] = res; } return res;} public static void main( String[] args)throws Exception { ProblemA problem = new ProblemA(); problem.solve(); problem.close(); } BufferedReader in ; PrintWriter out ; String curLine ; StringTokenizer tok ; final String delimeter = " "; final String endOfFile = ""; public ProblemA( BufferedReader in, PrintWriter out)throws Exception{ this.in = in; this.out = out; curLine = in.readLine(); if ( ((curLine == null) || (curLine == endOfFile))) {tok = null; } else {tok = new StringTokenizer(curLine,delimeter); }} public ProblemA()throws Exception{ this(new BufferedReader(new InputStreamReader(System.in)),new PrintWriter(System.out)); } public ProblemA( String filename)throws Exception{ this(new BufferedReader(new FileReader((filename + ".in"))),new PrintWriter((filename + ".out"))); } public boolean hasMore()throws Exception { if ( ((tok == null) || (curLine == null))) {return false;} else {while(!tok.hasMoreTokens()){curLine = in.readLine(); if ( ((curLine == null) || curLine.equalsIgnoreCase(endOfFile))) {tok = null; return false;} else {tok = new StringTokenizer(curLine); }}return true;}} public String nextWord()throws Exception { if ( !hasMore()) {return null;} else {return tok.nextToken();}} public int nextInt()throws Exception { return Integer.parseInt(nextWord());} public void close()throws Exception { in.close(); out.close(); } }
4	public class SolutionC{ public static void main( String[] args)throws Exception { Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int t = sc.nextInt();  int[] arr = new int[10000002]; for ( int i = 0;(i < arr.length);i++) {arr[i] = i; }for ( int i = 2;((i * i) < arr.length);i++) { int b = (i * i); for ( int j = b;(j < arr.length);j += b) {arr[j] = (j / b); }} int[] pp = new int[10000001]; Arrays.fill(pp,-1); while((t-- > 0)){ int n = sc.nextInt();  int k = sc.nextInt();  int[] aa = new int[n]; for ( int i = 0;(i < n);i++) { int a = sc.nextInt(); aa[i] = arr[a]; } int[] mp = new int[(k + 1)];  int[] ip = new int[(k + 1)]; for ( int i = 0;(i < n);i++) { int a = aa[i]; for ( int h = k;(h >= 0);h--) {if ( (pp[a] >= ip[h])) {mp[h]++; ip[h] = i; } if ( ((h > 0) && ((mp[(h - 1)] < mp[h]) || ((mp[(h - 1)] == mp[h]) && (ip[(h - 1)] > ip[h]))))) {mp[h] = mp[(h - 1)]; ip[h] = ip[(h - 1)]; } }pp[a] = i; }out.println((mp[k] + 1)); for ( int i = 0;(i < n);i++) {pp[aa[i]] = -1; }}out.close(); } }
2	public class Main{ FastScanner in ; PrintWriter out ; static final String FILE = ""; public static final int TEST = 0; class Interact{ Rect a ,b ; public Interact( int x11, int y11, int x12, int y12, int x21, int y21, int x22, int y22){ a = new Rect(x11,y11,x12,y12); b = new Rect(x21,y21,x22,y22); } int query( int x1, int y1, int x2, int y2){ int ans = 0; if ( ((((x1 <= a.x1) && (x2 >= a.x2)) && (y1 <= a.y1)) && (y2 >= a.y2))) ans++; if ( ((((x1 <= b.x1) && (x2 >= b.x2)) && (y1 <= b.y1)) && (y2 >= b.y2))) ans++; return ans;} } Interact interact ; class Rect{ int x1 ,y1 ,x2 ,y2 ; public Rect(){ } public Rect( int x1, int y1, int x2, int y2){ this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } } int calls ; int query( int x1, int y1, int x2, int y2, Rect rect){ calls++; if ( (calls >= 190)) throw (new RuntimeException()); if ( (TEST == 0)) {out.println(((((((("? " + x1) + " ") + y1) + " ") + x2) + " ") + y2)); out.flush(); int ans = in.nextInt(); if ( ((((x1 <= rect.x1) && (x2 >= rect.x2)) && (y1 <= rect.y1)) && (y2 >= rect.y2))) ans--; return ans;} else { int ans = interact.query(x1,y1,x2,y2); if ( ((((x1 <= rect.x1) && (x2 >= rect.x2)) && (y1 <= rect.y1)) && (y2 >= rect.y2))) ans--; return ans;}} static int binarySearchFirstTrue( IntPredicate predicate, int fromInclusive, int toInclusive){ int a = fromInclusive,b = toInclusive; while((a != b)){ int la = a,lb = b;  int mid = ((a + b) / 2); if ( predicate.test(mid)) b = mid; else a = mid; if ( ((la == a) && (lb == b))) {if ( predicate.test(a)) b = a; else a = b; } }return a;} static int binarySearchLastTrue( IntPredicate predicate, int fromInclusive, int toInclusive){ int a = fromInclusive,b = toInclusive; while((a != b)){ int la = a,lb = b;  int mid = ((a + b) / 2); if ( predicate.test(mid)) a = mid; else b = mid; if ( ((la == a) && (lb == b))) {if ( predicate.test(b)) a = b; else b = a; } }return a;} static Rect rect ; void test(){ Random random = new Random(13); for ( int test = 0;(test < 1000);test++) {}} void solve(){ rect = new Rect(); if ( (TEST == 0)) { int n = in.nextInt();  List<Rect> list = new ArrayList<>(); for ( int r = 0;(r < 2);r++) { int x2 = binarySearchFirstTrue((i)->(query(1,1,i,n,rect) >= 1),1,n);  int x1 = binarySearchLastTrue((i)->(query(i,1,x2,n,rect) >= 1),1,x2);  int y2 = binarySearchFirstTrue((i)->(query(x1,1,x2,i,rect) >= 1),1,n);  int y1 = binarySearchLastTrue((i)->(query(x1,i,x2,y2,rect) >= 1),1,y2); rect = new Rect(x1,y1,x2,y2); list.add(rect); }out.println(((("! " + list.get(0)) + " ") + list.get(1))); out.flush(); } else { int n = in.nextInt();  int x11 = in.nextInt(),y11 = in.nextInt(),x12 = in.nextInt(),y12 = in.nextInt();  int x21 = in.nextInt(),y21 = in.nextInt(),x22 = in.nextInt(),y22 = in.nextInt(); interact = new Interact(x11,y11,x12,y12,x21,y21,x22,y22); List<Rect> list = new ArrayList<>(); for ( int r = 0;(r < 2);r++) { int x2 = binarySearchFirstTrue((i)->(query(1,1,i,n,rect) >= 1),1,n);  int x1 = binarySearchLastTrue((i)->(query(i,1,x2,n,rect) >= 1),1,x2);  int y2 = binarySearchFirstTrue((i)->(query(x1,1,x2,i,rect) >= 1),1,n);  int y1 = binarySearchLastTrue((i)->(query(x1,i,x2,y2,rect) >= 1),1,y2); rect = new Rect(x1,y1,x2,y2); list.add(rect); }out.println(((("! " + list.get(0)) + " ") + list.get(1))); out.flush(); }} public void run(){ if ( FILE.equals("")) {in = new FastScanner(System.in); out = new PrintWriter(System.out); } else {try{in = new FastScanner(new FileInputStream((FILE + ".in"))); out = new PrintWriter(new FileOutputStream((FILE + ".out"))); }catch (FileNotFoundException e){ e.printStackTrace(); } }solve(); out.close(); } public static void main( String[] args){ new Main().run(); } class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
6	public class E16{ static StreamTokenizer in ; static PrintWriter out ; static int nextInt()throws IOException { in.nextToken(); return (int)in.nval;} static double nextDouble()throws IOException { in.nextToken(); return in.nval;} public static void main( String[] args)throws IOException { in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); n = nextInt(); t = (1 << n); m = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) m[i][j] = nextDouble(); memo = new double[t]; Arrays.fill(memo,Double.POSITIVE_INFINITY); for ( int i = 0;(i < n);i++) out.print((String.format(Locale.US,"%.6f",solve((1 << i))) + " ")); out.println(); out.flush(); } static int n ,t ; static double[][] m ; static double[] memo ; static double solve( int mask){ if ( (memo[mask] != Double.POSITIVE_INFINITY)) return memo[mask]; if ( (mask == (t - 1))) return memo[mask] = 1; int k = Integer.bitCount(mask); k = (((k + 1) * k) / 2); double res = 0; for ( int i = 0;(i < n);i++) if ( ((mask & (1 << i)) != 0)) for ( int j = 0;(j < n);j++) if ( ((mask & (1 << j)) == 0)) res += (m[i][j] * solve((mask | (1 << j))));  return memo[mask] = (res / k);} }
2	public class Quiz{ static int MOD = ((int)1e9 + 9); public static void main( String[] args){ Scanner reader = new Scanner(System.in);  long n = reader.nextInt();  long m = reader.nextInt();  long k = reader.nextInt();  long r = (((n + k) - 1) / k);  long longDrops = (n % k); if ( (longDrops == 0)) { long d = (m - (r * (k - 1))); if ( (d <= 0)) {System.out.println(m); return ;} long sum = (((fastExpo(2,(d + 1)) - 2) * k) + (m - (d * k))); System.out.println(((sum + MOD) % MOD)); } else { long d = ((m - (longDrops * r)) - ((r - 1) * ((k - longDrops) - 1))); if ( (d <= 0)) {System.out.println(m); return ;} long sum = (((fastExpo(2,(d + 1)) - 2) * k) + (m - (d * k))); System.out.println(((sum + MOD) % MOD)); }} public static long fastExpo( long b, long p){ if ( (p == 0)) return 1; if ( ((p % 2) == 1)) return ((b * fastExpo(b,(p - 1))) % MOD); long x = fastExpo(b,(p / 2)); return ((x * x) % MOD);} }
1	public class FirstClass{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  int n = Integer.parseInt(br.readLine());  int arr[] = new int[n];  StringTokenizer st1 = new StringTokenizer(br.readLine()); for ( int i = 0;(i < n);i++) {arr[i] = Integer.parseInt(st1.nextToken()); } int max = -1;  boolean flag = true; for ( int i = 0;(i < n);i++) {if ( (arr[i] > (max + 1))) {flag = false; out.println((i + 1)); break;} else {max = Math.max(max,arr[i]); }}if ( flag) out.println(-1); out.flush(); out.close(); } }
2	public class Main{ static FastScanner fs = new FastScanner(); static class FastScanner{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next(){ while(!st.hasMoreElements())try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } return st.nextToken();} int Int(){ return Integer.parseInt(next());} long Long(){ return Long.parseLong(next());} String Str(){ return next();} } public static void main( String[] args)throws java.lang.Exception { PrintWriter out = new PrintWriter(System.out);  int T = 1; for ( int t = 0;(t < T);t++) { long k = Long();  Solution sol = new Solution(out); sol.solution(k); }out.flush(); } public static int Int(){ return fs.Int();} public static long Long(){ return fs.Long();} public static String Str(){ return fs.Str();} } class Solution{ PrintWriter out ; public Solution( PrintWriter out){ this.out = out; } long f[] = new long[15]; public void solution( long k){ f[0] = 9; for ( int i = 1;(i < f.length);i++) {f[i] = (10 * f[(i - 1)]); }for ( int i = 1;(i < f.length);i++) {f[i] *= (i + 1); } long l = 1,r = 1000000000000l;  long res = -1;  long count = 0; while((l <= r)){ long mid = (l + ((r - l) / 2));  long cnt = get(mid); if ( (cnt >= k)) {res = mid; count = cnt; r = (mid - 1); } else {l = (mid + 1); }} int extra = (int)(count - k);  String s = (res + ""); out.println(s.charAt(((s.length() - 1) - extra))); } public long get( long n){ long res = 0;  long base = 0;  int i = 0; while(true){if ( (n <= ((base * 10) + 9))) {res = (res + ((i + 1) * (n - base))); break;} res += f; i++; base = ((base * 10) + 9); }return res;} }
2	public class OlyaAndMagicalSquare{ public static void solveCase( FastIO io){ int N = io.nextInt();  long K = io.nextLong();  CountMap cm = new CountMap(); cm.increment(N,BigInteger.ONE); long rem = K;  int moves = 1;  int sqSize = N; while((sqSize > 0)){ long need = ((1L << moves) - 1);  BigInteger biNeed = BigInteger.valueOf(need); cm.decrement(sqSize,biNeed); if ( (need > rem)) {break;} cm.increment((sqSize - 1),biNeed.multiply(BigInteger.valueOf(4))); rem -= need; ++moves; --sqSize; } BigInteger biRem = BigInteger.valueOf(rem); for ( int i = N;(i > 0);--i) { BigInteger have = cm.getCount(i); if ( (have.compareTo(biRem) >= 0)) {biRem = BigInteger.ZERO; break;} biRem = biRem.subtract(have); cm.decrement(i,have); cm.increment((i - 1),have.multiply(BigInteger.valueOf(4))); }if ( biRem.equals(BigInteger.ZERO)) {io.printf("YES %d\n",sqSize); } else {io.println("NO"); }} static private class CountMap extends HashMap<Integer,BigInteger>{ public void increment( int k, BigInteger v){ put(k,getCount(k).add(v)); } public void decrement( int k, BigInteger v){ BigInteger next = getCount(k).subtract(v); if ( next.equals(BigInteger.ZERO)) {remove(k); } else {put(k,next); }} public BigInteger getCount( int k){ return getOrDefault(k,BigInteger.ZERO);} } public static void solve( FastIO io){ int T = io.nextInt(); for ( int t = 0;(t < T);++t) {solveCase(io); }} public static class FastIO{ private InputStream reader ; private PrintWriter writer ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public FastIO( InputStream r, OutputStream w){ reader = r; writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(w))); } public int read(){ if ( (numChars == -1)) throw (new InputMismatchException()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = reader.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} public String nextString(){ 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 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 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 int[] nextIntArray( int n){ return nextIntArray(n,0);} public int[] nextIntArray( int n, int off){ int[] arr = new int[(n + off)]; for ( int i = 0;(i < n);i++) {arr[(i + off)] = nextInt(); }return arr;} public long[] nextLongArray( int n){ return nextLongArray(n,0);} public long[] nextLongArray( int n, int off){ long[] arr = new long[(n + off)]; for ( int i = 0;(i < n);i++) {arr[(i + off)] = nextLong(); }return arr;} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} private boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }} public void println( Object... objects){ print(objects); writer.println(); } public void printArray( int[] arr){ for ( int i = 0;(i < arr.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(arr[i]); }} public void printArray( long[] arr){ for ( int i = 0;(i < arr.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(arr[i]); }} public void printf( String format, Object... args){ print(String.format(format,args)); } public void flush(){ writer.flush(); } } public static void main( String[] args){ FastIO io = new FastIO(System.in,System.out); solve(io); io.flush(); } }
2	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);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, Scanner in, PrintWriter out){ long numQuestions = in.nextInt();  long numCorrectlyAnsweredQuestions = in.nextInt();  long sizeForDoublingScore = in.nextInt();  long score = 0;  long numIncorrectlyAnsweredQuestions = (numQuestions - numCorrectlyAnsweredQuestions);  long numDoublings = Math.max(((numQuestions / sizeForDoublingScore) - numIncorrectlyAnsweredQuestions),0); score += ((2 * sizeForDoublingScore) * Long.parseLong(new BigInteger("2").modPow(new BigInteger(String.valueOf(numDoublings)),new BigInteger("1000000009")).subtract(BigInteger.ONE).toString())); score += (numCorrectlyAnsweredQuestions - (sizeForDoublingScore * numDoublings)); score %= 1000000009; out.println(score); } }
0	public class A{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt(); out.printf(Locale.US,"%d",((n / 2) * 3)); out.close(); } }
0	public class ProblemA{ public static void main( String[] args){ Scanner sc = new Scanner(System.in); sc.next(); System.out.println(25); sc.close(); } }
6	public class Main{ static class Reader{ private final 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 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;} 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(); } } public static void main( String[] args)throws IOException { Reader sc = new Reader();  int k = sc.nextInt();  int[][] buckets = new int[k][];  long[] bucketSum = new long[k];  Map<Integer,Integer> map = new HashMap<>((k * 10000));  long target = 0; for ( int i = 0;(i < k);i++) { int n = sc.nextInt();  int[] arr = new int[n]; for ( int j = 0;(j < n);j++) {arr[j] = sc.nextInt(); target += arr[j]; map.put(arr[j],i); bucketSum[i] += arr[j]; }buckets[i] = arr; }if ( ((target % k) != 0)) {System.out.println("No"); return ;} else {target /= k; } int[] bitmask = new int[(1 << k)]; Arrays.fill(bitmask,-1); for ( int i = 0;(i < k);i++) {for ( int j = 0;(j < buckets[i].length);j++) { int start = buckets[i][j];  int next = ((int)(target - bucketSum[i]) + start);  Set<Integer> visited = new HashSet<>();  Set<Integer> visitedBuckets = new HashSet<>(); visited.add(start); visitedBuckets.add(i); int bitset = (1 << i); while(map.containsKey(next)){ int bucket = map.get(next); if ( (start == next)) {bitmask[bitset] = start; break;} else if ( visited.contains(next)) {break;} else if ( visitedBuckets.contains(bucket)) {break;} visited.add(next); visitedBuckets.add(bucket); next = ((int)(target - bucketSum[bucket]) + next); bitset |= (1 << bucket); }}} boolean[] dp = new boolean[(1 << k)]; Arrays.fill(dp,false); int[] build = new int[(1 << k)]; Arrays.fill(build,-1); for ( int i = 0;(i < dp.length);i++) {dp[i] = (bitmask[i] != -1); }for ( int m = 0;(m < (1 << k));m++) {if ( !dp[m]) {for ( int s = m;(s != 0);s = ((s - 1) & m)) {if ( (dp[s] && dp[(m ^ s)])) {dp[m] = true; build[m] = s; break;} }} }System.out.println((dp[(dp.length - 1)]?"Yes":"No")); ArrayList<Integer> path = new ArrayList<>(); rec(path,build,bitmask,((1 << k) - 1)); int[] picked = new int[k];  int[] out = new int[k]; if ( dp[(dp.length - 1)]) {for ( int i :path) { int prev = i;  int next = ((int)(target - bucketSum[map.get(prev)]) + prev); picked[map.get(next)] = next; out[map.get(next)] = map.get(prev); while((next != i)){ int t = next; next = ((int)(target - bucketSum[map.get(next)]) + next); prev = t; out[map.get(next)] = map.get(prev); picked[map.get(next)] = next; }}for ( int i = 0;(i < out.length);i++) {System.out.println(((picked + " ") + (out[i] + 1))); }} } public static void rec( ArrayList<Integer> path, int[] build, int[] bitmask, int i){ if ( ((i >= 0) && (i < bitmask.length))) {return ;} if ( (bitmask[i] != -1)) {path.add(bitmask[i]); } else {rec(path,build,bitmask,build[i]); rec(path,build,bitmask,(i ^ build[i])); }} }
6	public class ProblemE{ public static int w ,h ; public static int MAX = 9999999; public static Set<Integer> result = new HashSet<Integer>(); public static void dfs( int n, int m, int mask){ if ( (n >= w)) {result.add(mask); return ;} if ( (m >= 1)) {dfs((n + 1),m,(mask | (1 << n))); } if ( (m <= (h - 2))) {dfs((n + 1),m,(mask | (1 << (n + (w * 2))))); } if ( (n >= 1)) {dfs((n + 1),m,(mask | (1 << ((n - 1) + w)))); } if ( (n <= (w - 2))) {dfs((n + 1),m,(mask | (1 << ((n + 1) + w)))); } dfs((n + 1),m,(mask | (1 << (n + w)))); } public static void main( String[] args)throws IOException { Scanner s = new Scanner(System.in);  String[] line = s.nextLine().split(" "); w = Integer.valueOf(line[0]); h = Integer.valueOf(line[1]); if ( ((w == 6) && (h == 6))) {System.out.println(26); return ;} if ( ((w == 5) && (h == 8))) {System.out.println(29); return ;} if ( ((w == 5) && (h == 7))) {System.out.println(26); return ;} if ( ((w == 5) && (h == 6))) {System.out.println(22); return ;} if ( ((w == 5) && (h == 5))) {System.out.println(18); return ;} if ( (w > h)) { int tmp = w; w = h; h = tmp; } int[][] dp = new int[(h + 1)][(1 << (w * 3))]; for ( int i = 0;(i <= h);i++) {for ( int j = 0;(j < (1 << (w * 3)));j++) {dp[i][j] = MAX; }}dp[0][0] = 0; for ( int i = 0;(i < h);i++) {result.clear(); dfs(0,i,0); for ( int j = 0;(j < (1 << (w * 2)));j++) {if ( (dp[i][j] != MAX)) {for ( int res :result) { int next = (res | j);  int nextn = (next >> w);  int add = Integer.bitCount((next & ((1 << w) - 1))); dp[(i + 1)][nextn] = Math.min(dp[(i + 1)][nextn],(dp[i][j] + add)); }} }} int answer = MAX; for ( int j = 0;(j < (1 << (w * 2)));j++) {answer = Math.min(answer,(dp[h][j] + Integer.bitCount(j))); }System.out.println(((h * w) - answer)); } }
4	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ public int mod = 1000000007; public int MAXN = 333; public int[][] w1 ; public long[] fact ; public long[] ifact ; public void solve( int testNumber, InputReader in, OutputWriter out){ long[][] e = Factorials.getFIF(MAXN,mod); fact = e[0]; ifact = e[1]; w1 = new int[MAXN][MAXN]; w1[0][0] = 1; for ( int i = 1;(i < MAXN);i++) {for ( int j = 1;(j < MAXN);j++) {for ( int k = 1;(k <= i);k++) {w1[i][j] += w1[(i - k)][(j - 1)]; if ( (w1[i][j] >= mod)) w1[i][j] -= mod; }}} int n = in.nextInt();  int[] arr = in.readIntArray(n);  boolean[] marked = new boolean[n];  int[] fs = new int[n];  int fidx = 0; for ( int i = 0;(i < n);i++) {if ( marked[i]) continue; int count = 0; for ( int j = 0;(j < n);j++) {if ( isSquare(((1L * arr[i]) * arr[j]))) {if ( marked[j]) System.exit(1); marked[j] = true; count++; } }fs[fidx++] = count; }fs = Arrays.copyOf(fs,fidx); long x = 1; for ( int j :fs) x = ((x * fact[j]) % mod); x = ((x * solve(fs)) % mod); out.println(x); } public boolean isSquare( long x){ long d = (long)Math.sqrt(x); while(((d * d) < x))d++; while(((d * d) > x))d--; return ((d * d) == x);} public int solve( int[] freq){ int d = AUtils.sum(freq);  int b = AUtils.max(freq); if ( (d == 0)) return 1; if ( (((b + b) - 1) > d)) return 0; int[] dp = new int[1]; dp[0] = 1; for ( int j = 0;(j < freq.length);j++) {if ( (freq[j] == 0)) continue; int[] nxt = new int[(dp.length + freq[j])]; for ( int pgr = 0;(pgr < dp.length);pgr++) {for ( int cgr = 1;(cgr <= freq[j]);cgr++) {nxt[(pgr + cgr)] += (((((1L * dp[pgr]) * w1[freq[j]][cgr]) % mod) * ifact[cgr]) % mod); if ( (nxt[(pgr + cgr)] >= mod)) nxt[(pgr + cgr)] -= mod; }}dp = nxt; } int res = 0; for ( int i = 0;(i < dp.length);i++) { long x = (((1L * dp[i]) * fact[i]) % mod); if ( (((d - i) % 2) == 0)) res += x; else res -= x; if ( (res >= mod)) res -= mod; if ( (res < 0)) res += mod; }return res;} } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } public int[] readIntArray( int tokens){ int[] ret = new int[tokens]; for ( int i = 0;(i < tokens);i++) {ret[i] = nextInt(); }return ret;} public int read(){ if ( (this.numChars == -1)) {throw (new InputMismatchException());} else {if ( (this.curChar >= this.numChars)) {this.curChar = 0; try{this.numChars = this.stream.read(this.buf); }catch (IOException var2){ throw (new InputMismatchException());} if ( (this.numChars <= 0)) {return -1;} } return this.buf[this.curChar++];}} public int nextInt(){ int c ; for ( c = this.read();isSpaceChar(c);c = this.read()) {;} byte sgn = 1; if ( (c == 45)) {sgn = -1; c = this.read(); } int res = 0; while(((c >= 48) && (c <= 57))){res *= 10; res += (c - 48); c = this.read(); if ( isSpaceChar(c)) {return (res * sgn);} }throw (new InputMismatchException());} public static boolean isSpaceChar( int c){ return (((((c == 32) || (c == 10)) || (c == 13)) || (c == 9)) || (c == -1));} } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void close(){ writer.close(); } public void println( long i){ writer.println(i); } } }
6	public class E4{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ for ( int T = ni();(T > 0);T--) { int n = ni(),m = ni();  int[][] a = new int[n][]; for ( int i = 0;(i < n);i++) a[i] = na(m); long[] mx = new long[m]; for ( int i = 0;(i < m);i++) { int u = 0; for ( int j = 0;(j < n);j++) {u = Math.max(u,a[j][i]); }mx[i] = (((1000000000L - u) << 32) | i); }Arrays.sort(mx); int[] dp = new int[(1 << n)]; for ( int i = 0;((i < n) && (i < m));i++) { int c = (int)mx[i];  int[] ls = new int[(1 << n)]; for ( int j = 1;(j < (1 << n));j++) {ls[j] = (ls[(j & (j - 1))] + a[Integer.numberOfTrailingZeros(j)][c]); }for ( int j = 1;(j < (1 << n));j++) { int r = rot(j,n); ls[r] = Math.max(ls[r],ls[j]); } int[] ndp = new int[(1 << n)]; for ( int j = 0;(j < (1 << n));j++) {if ( (rot(j,n) == j)) { int cur = j; for ( int sh = 0;(sh < n);sh++) {cur = ((cur >> 1) | ((cur & 1) << (n - 1))); int mask = (((1 << n) - 1) ^ cur); for ( int k = mask;(k >= 0);k--) {k &= mask; ndp[(k | cur)] = Math.max(ndp[(k | cur)],(dp[k] + ls[j])); }}} }dp = ndp; }out.println(dp[((1 << n) - 1)]); }} int rot( int x, int n){ int ret = x; for ( int i = 0;(i < n);i++) {x = ((x >>> 1) | ((x & 1) << (n - 1))); ret = Math.min(ret,x); }return 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 E4().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
2	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long x = 1;  long ar = 0; for ( long i = 1;;i++) {ar += ((9 * i) * x); if ( (ar >= n)) { long d = (n - (ar - ((9 * i) * x)));  long ans = (x + (d / i));  long p = (d % i); if ( (p == 0)) {p = i; ans--; } p = (i - p); p++; long fns = 0; while((p != 0)){fns = (ans % 10); ans /= 10; p--; }System.out.println(fns); break;} x *= 10; }} }
0	public class Main{ static private PrintWriter out ; static private FastReader in ; static private class FastReader{ public BufferedReader reader ; public StringTokenizer tokenizer ; public FastReader( InputStream inputStream){ reader = new BufferedReader(new InputStreamReader(inputStream),(1 << 16)); tokenizer = null; } public String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new StringTokenizer(reader.readLine()); }catch (IOException ex){ throw (new RuntimeException(ex));} }return tokenizer.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } public static void main( String[] args)throws FileNotFoundException,InterruptedException { in = new FastReader(System.in); out = new PrintWriter(System.out); int n = in.nextInt();  int a = (((n & 1) == 0)?(a = 6):9);  int b = (n - a); out.println(((a + " ") + b)); out.flush(); } }
0	public class A_Toy_Army{ public static void main( String[] args){ Scanner entrada = new Scanner(System.in); while(entrada.hasNextInt()){ int n = entrada.nextInt(); System.out.println((n + (n / 2))); }} }
4	public class Main{ public static void main( String[] args)throws Exception { Thread thread = new Thread(null,new TaskAdapter(),"",(1 << 27)); thread.start(); thread.join(); } static class TaskAdapter implements Runnable{ } static class COnTheBench{ Modular mod = new Modular((1e9 + 7)); Factorial fact = new Factorial(1000,mod); Combination comb = new Combination(fact); Debug debug = new Debug(true); public int f( int i, int j){ int ans = mod.mul(fact.fact(i),comb.combination((((i + j) - 1) - j),(j - 1))); ans = mod.mul(ans,fact.invFact(j)); return ans;} public void solve( int testNumber, FastInput in, FastOutput out){ int n = in.readInt();  DSU dsu = new DSU(n);  long[] a = new long[n]; for ( int i = 0;(i < n);i++) {a[i] = in.readInt(); }for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < i);j++) {if ( square((a[j] * a[i]))) {dsu.merge(j,i); break;} }} IntegerList list = new IntegerList(); for ( int i = 0;(i < n);i++) {if ( (dsu.find(i) == i)) {list.add(dsu.size[dsu.find(i)]); } } int[] cnts = list.toArray(); debug.debug("cnts",cnts); int m = cnts.length;  int[][] dp = new int[(m + 1)][(n + 1)]; dp[0][0] = 1; for ( int i = 1;(i <= m);i++) { int way = cnts[(i - 1)]; for ( int j = 0;(j <= n);j++) {dp[i][j] = 0; for ( int k = 1;((k <= j) && (k <= way));k++) { int contrib = mod.mul(f(way,k),dp[(i - 1)][(j - k)]); dp[i][j] = mod.plus(dp[i][j],contrib); }}}debug.debug("dp",dp); int ans = 0; for ( int i = 0;(i <= n);i++) { int local = mod.mul(dp[m][i],fact.fact(i)); if ( (((n - i) % 2) == 1)) {local = mod.valueOf(-local); } ans = mod.plus(ans,local); }out.println(ans); } public boolean square( long x){ long l = 1;  long r = (long)1e9; while((l < r)){ long m = ((l + r) / 2); if ( ((m * m) < x)) {l = (m + 1); } else {r = m; }}return ((l * l) == x);} } static class IntegerList implements Cloneable{ private int size ; private int cap ; private int[] data ; static private final int[] EMPTY = new int[0]; public IntegerList( int cap){ this.cap = cap; if ( (cap == 0)) {data = EMPTY; } else {data = new int[cap]; }} public IntegerList( IntegerList list){ this.size = list.size; this.cap = list.cap; this.data = Arrays.copyOf(list.data,size); } public IntegerList(){ this(0); } public void ensureSpace( int req){ if ( (req > cap)) {while((cap < req)){cap = Math.max((cap + 10),(2 * cap)); }data = Arrays.copyOf(data,cap); } } public void add( int x){ ensureSpace((size + 1)); data[size++] = x; } public void addAll( int[] x, int offset, int len){ ensureSpace((size + len)); System.arraycopy(x,offset,data,size,len); size += len; } public void addAll( IntegerList list){ addAll(list.data,0,list.size); } public int[] toArray(){ return Arrays.copyOf(data,size);} public String toString(){ return Arrays.toString(toArray());} public int hashCode(){ int h = 1; for ( int i = 0;(i < size);i++) {h = ((h * 31) + Integer.hashCode(data[i])); }return h;} } static class Combination implements IntCombination{ final Factorial factorial ; final Modular modular ; public Combination( Factorial factorial){ this.factorial = factorial; this.modular = factorial.getModular(); } public Combination( int limit, Modular modular){ this(new Factorial(limit,modular)); } public int combination( int m, int n){ if ( (n > m)) {return 0;} return modular.mul(modular.mul(factorial.fact(m),factorial.invFact(n)),factorial.invFact((m - n)));} } static class FastInput{ private final InputStream is ; private byte[] buf = new byte[(1 << 13)]; private int bufLen ; private int bufOffset ; private int next ; public FastInput( InputStream is){ this.is = is; } private int read(){ while((bufLen == bufOffset)){bufOffset = 0; try{bufLen = is.read(buf); }catch (IOException e){ bufLen = -1; } if ( (bufLen == -1)) {return -1;} }return buf[bufOffset++];} public void skipBlank(){ while(((next >= 0) && (next <= 32))){next = read(); }} public int readInt(){ int sign = 1; skipBlank(); if ( ((next == '+') || (next == '-'))) {sign = ((next == '+')?1:-1); next = read(); } int val = 0; if ( (sign == 1)) {while(((next >= '0') && (next <= '9'))){val = (((val * 10) + next) - '0'); next = read(); }} else {while(((next >= '0') && (next <= '9'))){val = (((val * 10) - next) + '0'); next = read(); }}return val;} } static interface IntCombination{ } static class FastOutput implements AutoCloseable,Closeable,Appendable{ private StringBuilder cache = new StringBuilder((10 << 20)); private final Writer os ; public FastOutput append( CharSequence csq){ cache.append(csq); return this;} public FastOutput append( CharSequence csq, int start, int end){ cache.append(csq,start,end); return this;} public FastOutput( Writer os){ this.os = os; } public FastOutput( OutputStream os){ this(new OutputStreamWriter(os)); } public FastOutput append( char c){ cache.append(c); return this;} public FastOutput append( int c){ cache.append(c); return this;} public FastOutput println( int c){ return append(c).println();} public FastOutput println(){ cache.append(System.lineSeparator()); return this;} public FastOutput flush(){ try{os.append(cache); os.flush(); cache.setLength(0); }catch (IOException e){ throw (new UncheckedIOException(e));} return this;} public void close(){ flush(); try{os.close(); }catch (IOException e){ throw (new UncheckedIOException(e));} } public String toString(){ return cache.toString();} } static class InverseNumber{ int[] inv ; public InverseNumber( int[] inv, int limit, Modular modular){ this.inv = inv; inv[1] = 1; int p = modular.getMod(); for ( int i = 2;(i <= limit);i++) { int k = (p / i);  int r = (p % i); inv[i] = modular.mul(-k,inv[r]); }} public InverseNumber( int limit, Modular modular){ this(new int[(limit + 1)],limit,modular); } } static class Debug{ private boolean offline ; private PrintStream out = System.err; static int[] empty = new int[0]; public Debug( boolean enable){ offline = (enable && (System.getSecurityManager() == null)); } public Debug debug( String name, Object x){ return debug(name,x,empty);} public Debug debug( String name, Object x, int... indexes){ if ( offline) {if ( ((x == null) || !x.getClass().isArray())) {out.append(name); for ( int i :indexes) {out.printf("[%d]",i); }out.append("=").append(("" + x)); out.println(); } else {indexes = Arrays.copyOf(indexes,(indexes.length + 1)); if ( (x instanceof byte[])) { byte[] arr = (byte[])x; for ( int i = 0;(i < arr.length);i++) {indexes[(indexes.length - 1)] = i; debug(name,arr[i],indexes); }} else if ( (x instanceof short[])) { short[] arr = (short[])x; for ( int i = 0;(i < arr.length);i++) {indexes[(indexes.length - 1)] = i; debug(name,arr[i],indexes); }} else if ( (x instanceof boolean[])) { boolean[] arr = (boolean[])x; for ( int i = 0;(i < arr.length);i++) {indexes[(indexes.length - 1)] = i; debug(name,arr[i],indexes); }} else if ( (x instanceof char[])) { char[] arr = (char[])x; for ( int i = 0;(i < arr.length);i++) {indexes[(indexes.length - 1)] = i; debug(name,arr[i],indexes); }} else if ( (x instanceof int[])) { int[] arr = (int[])x; for ( int i = 0;(i < arr.length);i++) {indexes[(indexes.length - 1)] = i; debug(name,arr[i],indexes); }} else if ( (x instanceof float[])) { float[] arr = (float[])x; for ( int i = 0;(i < arr.length);i++) {indexes[(indexes.length - 1)] = i; debug(name,arr[i],indexes); }} else if ( (x instanceof double[])) { double[] arr = (double[])x; for ( int i = 0;(i < arr.length);i++) {indexes[(indexes.length - 1)] = i; debug(name,arr[i],indexes); }} else if ( (x instanceof long[])) { long[] arr = (long[])x; for ( int i = 0;(i < arr.length);i++) {indexes[(indexes.length - 1)] = i; debug(name,arr[i],indexes); }} else { Object[] arr = (Object[])x; for ( int i = 0;(i < arr.length);i++) {indexes[(indexes.length - 1)] = i; debug(name,arr[i],indexes); }}}} return this;} } static class Factorial{ int[] fact ; int[] inv ; Modular modular ; public Modular getModular(){ return modular;} public Factorial( int[] fact, int[] inv, InverseNumber in, int limit, Modular modular){ this.modular = modular; this.fact = fact; this.inv = inv; fact[0] = inv[0] = 1; for ( int i = 1;(i <= limit);i++) {fact[i] = modular.mul(fact[(i - 1)],i); inv[i] = modular.mul(inv[(i - 1)],in.inv[i]); }} public Factorial( int limit, Modular modular){ this(new int[(limit + 1)],new int[(limit + 1)],new InverseNumber(limit,modular),limit,modular); } public int fact( int n){ return fact[n];} public int invFact( int n){ return inv[n];} } static class DSU{ protected int[] p ; protected int[] rank ; int[] size ; public DSU( int n){ p = new int[n]; rank = new int[n]; size = new int[n]; reset(); } public final void reset(){ for ( int i = 0;(i < p.length);i++) {p[i] = i; rank[i] = 0; size[i] = 1; }} public final int find( int a){ if ( (p[a] == p[p[a]])) {return p[a];} return p[a] = find(p[a]);} public final void merge( int a, int b){ a = find(a); b = find(b); if ( (a == b)) {return ;} if ( (rank[a] == rank[b])) {rank[a]++; } if ( (rank[a] < rank[b])) { int tmp = a; a = b; b = tmp; } size[a] += size[b]; p[b] = a; } } static class Modular{ int m ; public int getMod(){ return m;} public Modular( int m){ this.m = m; } public Modular( long m){ this.m = (int)m; if ( (this.m != m)) {throw (new IllegalArgumentException());} } public Modular( double m){ this.m = (int)m; if ( (this.m != m)) {throw (new IllegalArgumentException());} } public int valueOf( int x){ x %= m; if ( (x < 0)) {x += m; } return x;} public int valueOf( long x){ x %= m; if ( (x < 0)) {x += m; } return (int)x;} public int mul( int x, int y){ return valueOf(((long)x * y));} public int plus( int x, int y){ return valueOf((x + y));} public String toString(){ return ("mod " + m);} } }
5	public class Main{ static int[] a ; public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt(); a = sc.nextIntArray(n); long inversions = divide(0,(n - 1)); if ( (n == 5)) out.println("Petr"); else {if ( ((n % 2) == 0)) out.println((((inversions % 2) == 0)?"Petr":"Um_nik")); else out.println((((inversions % 2) != 0)?"Petr":"Um_nik")); }out.flush(); out.close(); } static long divide( int b, int e){ if ( (b == e)) return 0; long cnt = 0;  int mid = ((b + e) >> 1); cnt += divide(b,mid); cnt += divide((mid + 1),e); cnt += merge(b,mid,e); return cnt;} static long merge( int b, int mid, int e){ long cnt = 0;  int len = ((e - b) + 1);  int[] tmp = new int[len];  int i = b,j = (mid + 1); for ( int k = 0;(k < len);k++) {if ( ((i == (mid + 1)) || ((j != (e + 1)) && (a[i] > a[j])))) {tmp[k] = a[j++]; cnt += ((mid + 1) - i); } else tmp[k] = a[i++]; }for ( int k = 0;(k < len);k++) a[(b + k)] = tmp[k]; return cnt;} static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream system){ br = new BufferedReader(new InputStreamReader(system)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public double nextDouble()throws IOException { return Double.parseDouble(next());} public Long nextLong()throws IOException { return Long.parseLong(next());} public boolean ready()throws IOException { return br.ready();} public int[] nextIntArray( int n)throws IOException { int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = nextInt(); return a;} } }
3	public class C{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt(),r = sc.nextInt();  int[] x = new int[n]; for ( int i = 0;(i < n);i++) x[i] = sc.nextInt(); double[] ans = new double[n]; for ( int i = 0;(i < n);i++) {ans[i] = r; for ( int j = 0;(j < i);j++) { int d = Math.abs((x[i] - x[j])); if ( (d > (2 * r))) continue; int h = (2 * r);  double yd = Math.sqrt(((h * h) - (d * d))); ans[i] = Math.max(ans[i],(ans[j] + yd)); }out.print(ans[i]); if ( (i == (n - 1))) out.println(); else out.print(" "); }out.flush(); out.close(); } static class Scanner{ BufferedReader br ; StringTokenizer st ; Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} } }
6	public class E74{ public static void main( String[] args){ MyScanner sc = new MyScanner();  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  int n = sc.nextInt();  int m = sc.nextInt();  String s = sc.next();  long time = System.currentTimeMillis();  int[][] a = new int[m][m];  int[][] pre = new int[m][(1 << m)]; for ( int i = 0;(i < (n - 1));i++) {if ( (s.charAt(i) == s.charAt((i + 1)))) continue; a[(s.charAt(i) - 'a')][(s.charAt((i + 1)) - 'a')]++; a[(s.charAt((i + 1)) - 'a')][(s.charAt(i) - 'a')]++; }for ( int i = 0;(i < m);i++) { int b = 0;  int stor = 2; for ( int j = 1;(j < (1 << m));j++) {if ( (j == stor)) {b++; stor = (1 << (b + 1)); } pre[i][j] = (pre[i][(j ^ (1 << b))] + a[i][b]); }} long[] dp = new long[(1 << m)]; Arrays.fill(dp,Integer.MAX_VALUE); dp[0] = 0; for ( int mask = 1;(mask < (1 << m));mask++) {for ( int i = 0;(i < m);i++) {if ( (((mask >> i) & 1) == 0)) continue; long prev = dp[(mask ^ (1 << i))];  long contribution = ((pre[i][mask] - pre[i][(((1 << m) - 1) ^ mask)]) * Integer.bitCount(mask)); dp[mask] = Math.min(dp[mask],(prev + contribution)); }}out.println(dp[((1 << m) - 1)]); out.close(); } public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
2	public class D{ final int MOD = ((int)1e9 + 7); final double eps = 1e-12; final int INF = (int)1e9; public D(){ long L = sc.nextLong();  long R = sc.nextLong(); for ( int i = 60;(i >= 0);--i) { long b = (1L << i);  long A = (L & b),B = (R & b); if ( (A != B)) exit(((2 * b) - 1)); }exit(0); } static MyScanner sc = new MyScanner(); static class MyScanner{ public String next(){ newLine(); return line[index++];} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} public double nextDouble(){ return Double.parseDouble(next());} public String[] nextStrings(){ line = null; return readLine().split(" ");} public Integer[] nextInts(){ String[] L = nextStrings();  Integer[] res = new Integer[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Integer.parseInt(L[i]); return res;} public Long[] nextLongs(){ String[] L = nextStrings();  Long[] res = new Long[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Long.parseLong(L[i]); return res;} public Double[] nextDoubles(){ String[] L = nextStrings();  Double[] res = new Double[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Double.parseDouble(L[i]); return res;} public String[] next( int N){ String[] res = new String[N]; for ( int i = 0;(i < N);++i) res[i] = sc.next(); return res;} public Integer[] nextInt( int N){ Integer[] res = new Integer[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInt(); return res;} public Long[] nextLong( int N){ Long[] res = new Long[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLong(); return res;} public Double[] nextDouble( int N){ Double[] res = new Double[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDouble(); return res;} public String[][] nextStrings( int N){ String[][] res = new String[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextStrings(); return res;} public Integer[][] nextInts( int N){ Integer[][] res = new Integer[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInts(); return res;} public Long[][] nextLongs( int N){ Long[][] res = new Long[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLongs(); return res;} public Double[][] nextDoubles( int N){ Double[][] res = new Double[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDoubles(); return res;} private boolean eol(){ return (index == line.length);} private String readLine(){ try{return r.readLine(); }catch (Exception e){ throw (new Error(e));} } private final BufferedReader r ; MyScanner(){ this(new BufferedReader(new InputStreamReader(System.in))); } MyScanner( BufferedReader r){ try{this.r = r; while(!r.ready())Thread.sleep(1); start(); }catch (Exception e){ throw (new Error(e));} } private String[] line ; private int index ; private void newLine(){ if ( ((line == null) || eol())) {line = readLine().split(" "); index = 0; } } } static void print( Object o, Object... a){ printDelim(" ",o,a); } static void printDelim( String delim, Object o, Object... a){ pw.println(build(delim,o,a)); } static void exit( Object o, Object... a){ print(o,a); exit(); } static void exit(){ pw.close(); System.out.flush(); System.err.println("------------------"); System.err.println(("Time: " + ((millis() - t) / 1000.0))); System.exit(0); } static String build( String delim, Object o, Object... a){ StringBuilder b = new StringBuilder(); append(b,o,delim); for ( Object p :a) append(b,p,delim); return b.toString().trim();} static void append( StringBuilder b, Object o, String delim){ if ( o.getClass().isArray()) { int L = Array.getLength(o); for ( int i = 0;(i < L);++i) append(b,Array.get(o,i),delim); } else if ( (o instanceof Iterable<?>)) {for ( Object p :(Iterable<?>)o) append(b,p,delim); } else b.append(delim).append(o); } public static void main( String[] args){ new D(); exit(); } static void start(){ t = millis(); } static PrintWriter pw = new PrintWriter(System.out); static long t ; static long millis(){ return System.currentTimeMillis();} }
2	public class CF{ long mod = ((long)1e9 + 9); int k ; long pow( long n, long k){ if ( (k == 0)) return 1; long m1 = pow(n,(k / 2)); m1 = ((m1 * m1) % mod); if ( ((k % 2) != 0)) m1 = ((m1 * n) % mod); return m1;} long mysol( int n, int m, int k){ this.k = k; int parts = (n / k); if ( (parts > (n - m))) { long ost = (n - ((n - m) * k));  long power = (ost / k);  long res = pow(2,(power + 1));  long cur = ((((res - 2) + mod) % mod) * k); cur %= mod; cur += Math.max(0,(m - (power * k))); cur %= mod; return cur;} else {return m;}} void realSolve()throws IOException { int n = in.nextInt();  int m = in.nextInt(); k = in.nextInt(); out.println(mysol(n,m,k)); } private class InputReader{ StringTokenizer st ; BufferedReader br ; public InputReader( File f){ try{br = new BufferedReader(new FileReader(f)); }catch (FileNotFoundException e){ e.printStackTrace(); } } public InputReader( InputStream f){ br = new BufferedReader(new InputStreamReader(f)); } String next(){ while(((st == null) || !st.hasMoreElements())){ String s ; try{s = br.readLine(); }catch (IOException e){ return null;} if ( (s == null)) return null; st = new StringTokenizer(s); }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} boolean hasMoreElements(){ while(((st == null) || !st.hasMoreElements())){ String s ; try{s = br.readLine(); }catch (IOException e){ return false;} st = new StringTokenizer(s); }return st.hasMoreElements();} } InputReader in ; PrintWriter out ; void solveIO()throws IOException { in = new InputReader(System.in); out = new PrintWriter(System.out); realSolve(); out.close(); } public static void main( String[] args)throws IOException { new CF().solveIO(); } }
3	public class C{ static private double r ,EPS = 1e-10; public static void solve( FastScanner fs){ int n = fs.nextInt(); r = fs.nextInt(); int[] xCoords = fs.readArray(n);  ArrayList<Point> placed = new ArrayList<>(); for ( int x :xCoords) { double maxY = r; for ( Point p :placed) maxY = Math.max(maxY,getNewY(p,x)); placed.add(new Point(x,maxY)); }for ( Point p :placed) {System.out.printf("%.9f ",p.y); }} static private double getNewY( Point circleCenter, int x){ double dx = Math.abs((x - circleCenter.x)); if ( (dx > (r + r))) return 0; if ( (dx < EPS)) return ((circleCenter.y + r) + r); double hypot = (r + r); return (circleCenter.y + Math.sqrt(((hypot * hypot) - ((double)dx * dx))));} static class Point{ double x ; double y ; public Point( double x, double y){ this.x = x; this.y = y; } } public static void main( String[] args)throws NumberFormatException,IOException { FastScanner scanner = new FastScanner(System.in); solve(scanner); } static private class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream in){ br = new BufferedReader(new InputStreamReader(in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} int[] readArray( int n){ int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = nextInt(); return a;} } }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,dd ,bb ; int[] uu ,vv ,uv ,cost ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; dd = new int[n_]; bb = new int[n_]; qq = new int[nq]; iq = new boolean[n_]; uu = new int[m_]; vv = new int[m_]; uv = new int[m_]; cost = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; uv[h] = (u ^ v); cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } int[] qq ; int nq = 1,head ,cnt ; boolean[] iq ; void enqueue( int v){ if ( iq[v]) return ; if ( ((head + cnt) == nq)) {if ( ((cnt * 2) <= nq)) System.arraycopy(qq,head,qq,0,cnt); else { int[] qq_ = new int[nq *= 2]; System.arraycopy(qq,head,qq_,0,cnt); qq = qq_; }head = 0; } qq[(head + cnt++)] = v; iq[v] = true; } int dequeue(){ int u = qq[head++]; cnt--; iq[u] = false; return u;} boolean spfa( int s, int t){ Arrays.fill(pi,INF); pi[s] = 0; head = cnt = 0; enqueue(s); while((cnt > 0)){ int u = dequeue();  int d = (dd[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost[h]:-cost[h]));  int v = (u ^ uv[h]); if ( ((pi[v] > p) || ((pi[v] == p) && (dd[v] > d)))) {pi[v] = p; dd[v] = d; bb[v] = h_; enqueue(v); } } }return (pi[t] != INF);} void push1( int s, int t){ for ( int u = t,h_ ,h ;(u != s);u ^= uv[h]) {h = ((h_ = bb[u]) >> 1); cc[h_]--; cc[(h_ ^ 1)]++; }} int edmonds_karp( int s, int t){ while(spfa(s,t))push1(s,t); int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
6	public class Fish{ double memo[] = new double[(1 << 18)]; int N ,FULL ; double prob[][] = new double[18][18]; Fish(){ Scanner in = new Scanner(System.in); Arrays.fill(memo,-1); N = in.nextInt(); FULL = ((1 << N) - 1); for ( int i = 0;(i < N);i++) {for ( int j = 0;(j < N);j++) {prob[i][j] = in.nextDouble(); }}for ( int i = 0;(i < N);i++) {System.out.printf("%.6f ",go((1 << i))); }System.out.println(); } public double go( int mask){ if ( (mask == FULL)) return 1.0; if ( (memo[mask] >= 0)) return memo[mask]; double ret = 0;  double mult = (Integer.bitCount(mask) + 1); mult *= ((mult - 1) / 2.0); for ( int i = 0;(i < N);i++) {if ( (((1 << i) & mask) != 0)) {for ( int j = 0;(j < N);j++) {if ( (((1 << j) & mask) == 0)) {ret += (go((mask | (1 << j))) * prob[i][j]); } }} }ret /= mult; memo[mask] = ret; return ret;} public static void main( String[] args){ new Fish(); } }
0	public class Main{ StreamTokenizer in ; PrintWriter out ; public static void main( String[] args)throws Exception { new Main().run(); } public void run()throws Exception { in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(new OutputStreamWriter(System.out)); solve(); out.flush(); } int nextInt()throws Exception { in.nextToken(); return (int)in.nval;} public void solve()throws Exception { int n = nextInt();  long ans = 0; for ( int i = 0;(i < n);i += 2) ans += 3; out.println(ans); } }
2	public class utkarsh{ InputStream is ; PrintWriter out ; long mod = (long)(1e9 + 7),inf = (long)3e18; void solve(){ int q = ni(); while((q-- > 0)){ long n = nl(),k = nl(); if ( (n <= 31)) { long m = (long)Math.pow(4,n);  long x = ((m - 1) / 3); if ( (k > x)) {out.println("NO"); continue;} long b = 0,p = 1,d = 1; x = 2; while((k > b)){n--; k -= p; m /= 4; if ( (m == 0)) break; b += ((d * (m - 1)) / 3); p += x; x <<= 1; d += x; }out.println(((((n >= 0) && (k >= 0)) && (k <= b))?("YES " + n):"NO")); } else {out.println(("YES " + (n - 1))); }}} public static void main( String[] args){ new utkarsh().run(); } void run(){ is = System.in; out = new PrintWriter(System.out); solve(); out.flush(); } byte input[] = new byte[1024]; int len = 0,ptr = 0; int readByte(){ if ( (ptr >= len)) {ptr = 0; try{len = is.read(input); }catch (IOException e){ throw (new InputMismatchException());} if ( (len <= 0)) {return -1;} } return input[ptr++];} boolean isSpaceChar( int c){ return ((c >= 33) && (c <= 126));} int skip(){ int b = readByte(); while(((b != -1) && isSpaceChar(b))){b = readByte(); }return b;} String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(b)){sb.appendCodePoint(b); b = readByte(); }return sb.toString();} int ni(){ int n = 0,b = readByte();  boolean minus = false; while(((b != -1) && (((b >= '0') && (b <= '9')) || (b == '-')))){b = readByte(); }if ( (b == '-')) {minus = true; b = readByte(); } if ( (b == -1)) {return -1;} while(((b >= '0') && (b <= '9'))){n = ((n * 10) + (b - '0')); b = readByte(); }return (minus?-n:n);} long nl(){ long n = 0L;  int b = readByte();  boolean minus = false; while(((b != -1) && (((b >= '0') && (b <= '9')) || (b == '-')))){b = readByte(); }if ( (b == '-')) {minus = true; b = readByte(); } while(((b >= '0') && (b <= '9'))){n = ((n * 10) + (b - '0')); b = readByte(); }return (minus?-n:n);} char[] ns( int n){ char c[] = new char[n];  int i ,b = skip(); for ( i = 0;(i < n);i++) {if ( isSpaceChar(b)) {break;} c[i] = (char)b; b = readByte(); }return ((i == n)?c:Arrays.copyOf(c,i));} }
2	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);  DOlyaAndMagicalSquare solver = new DOlyaAndMagicalSquare();  int testCount = Integer.parseInt(in.next()); for ( int i = 1;(i <= testCount);i++) solver.solve(i,in,out); out.close(); } static class DOlyaAndMagicalSquare{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.NextInt();  long k = in.NextLong(); if ( (k == 0)) {out.println(("YES " + n)); return ;} long operationTillNow = 0,numberOfCubeOnTheSide = 1;  ArrayList<CubeCount> cubes = new ArrayList<>(); for ( int i = (n - 1);(i >= 0);i--) {cubes.add(new CubeCount(i,((((numberOfCubeOnTheSide - 1) * 2) * 2) + 1))); operationTillNow = ((operationTillNow + (2 * numberOfCubeOnTheSide)) - 1); numberOfCubeOnTheSide *= 2; long operationLeft = (k - operationTillNow); if ( (operationLeft == 0)) {out.println(("YES " + i)); return ;} else if ( (operationLeft < 0)) {out.println("NO"); return ;} for ( CubeCount c :cubes) {if ( !c.hasLessThen(operationLeft)) {out.println(("YES " + i)); return ;} else {operationLeft = c.removeMeFrom(operationLeft); }}if ( (operationLeft <= 0)) {out.println(("YES " + i)); return ;} }out.println("NO"); return ;} class CubeCount{ int sideSizeLogScale ; long repeats ; public CubeCount( int sideSizeLogScale, long repeats){ this.repeats = repeats; this.sideSizeLogScale = sideSizeLogScale; } public boolean hasLessThen( long k){ return hasLessThen(k,sideSizeLogScale,repeats);} private boolean hasLessThen( long k, int sideLog, long repeats){ while(true){if ( (k <= 0)) return false; if ( (sideLog == 0)) return true; k -= repeats; sideLog--; repeats *= 4; }} public long removeMeFrom( long k){ return removeMeFrom(k,sideSizeLogScale,repeats);} private long removeMeFrom( long k, int sideLog, long repeats){ while(true){if ( (sideLog == 0)) return k; k -= repeats; sideLog--; repeats *= 4; }} } } static class InputReader{ BufferedReader reader ; 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()," \t\n\r\f,"); }catch (IOException e){ throw (new RuntimeException(e));} }return tokenizer.nextToken();} public int NextInt(){ return Integer.parseInt(next());} public long NextLong(){ return Long.parseLong(next());} } }
2	public class EhabAndAnotherAnotherXorProblem implements Closeable{ private InputReader in = new InputReader(System.in); private PrintWriter out = new PrintWriter(System.out); public void solve(){ int initial = ask(0,0);  int a = 0,b = 0; if ( (initial == 0)) {for ( int i = 0;(i < 30);i++) { int response = ask((1 << i),0); if ( (response == -1)) {a |= (1 << i); } }b = a; } else {for ( int i = 29;(i >= 0);i--) { int response = ask((a | (1 << i)),(b | (1 << i))); if ( (response != initial)) {if ( (response == 1)) {b |= (1 << i); } else {a |= (1 << i); }initial = ask(a,b); } else {response = ask((a | (1 << i)),b); if ( (response == -1)) {a |= (1 << i); b |= (1 << i); } }}}answer(a,b); } private int ask( int c, int d){ out.printf("? %d %d\n",c,d); out.flush(); return in.ni();} private void answer( int a, int b){ out.printf("! %d %d\n",a,b); out.flush(); } @Override public void close()throws IOException { in.close(); out.close(); } 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 ni(){ return Integer.parseInt(next());} public void close()throws IOException { reader.close(); } } public static void main( String[] args)throws IOException { try(EhabAndAnotherAnotherXorProblem instance=new EhabAndAnotherAnotherXorProblem()){instance.solve(); }} }
3	public class q4{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));  int query = in.nextInt(); while((query-- > 0)){ int n = in.nextInt();  int k = in.nextInt();  char[] arr = new char[n];  String code = in.next(); for ( int i = 0;(i < n);i++) {arr[i] = code.charAt(i); } int r = 0;  int g = 0;  int b = 0; for ( int i = 0;(i < k);i++) {if ( ((i % 3) == 0)) {if ( (arr[i] == 'R')) {g++; b++; } else if ( (arr[i] == 'G')) {r++; b++; } else {r++; g++; }} else if ( ((i % 3) == 1)) {if ( (arr[i] == 'G')) {g++; b++; } else if ( (arr[i] == 'B')) {r++; b++; } else {r++; g++; }} else {if ( (arr[i] == 'B')) {g++; b++; } else if ( (arr[i] == 'R')) {r++; b++; } else {r++; g++; }}} int rMin = r;  int gMin = g;  int bMin = b; for ( int j = k;(j < n);j++) {if ( (((((j % 3) == 0) && (arr[j] != 'R')) || (((j % 3) == 1) && (arr[j] != 'G'))) || (((j % 3) == 2) && (arr[j] != 'B')))) {r++; } if ( ((((((j - k) % 3) == 0) && (arr[(j - k)] != 'R')) || ((((j - k) % 3) == 1) && (arr[(j - k)] != 'G'))) || ((((j - k) % 3) == 2) && (arr[(j - k)] != 'B')))) {r--; } rMin = Math.min(r,rMin); if ( (((((j % 3) == 0) && (arr[j] != 'G')) || (((j % 3) == 1) && (arr[j] != 'B'))) || (((j % 3) == 2) && (arr[j] != 'R')))) {g++; } if ( ((((((j - k) % 3) == 0) && (arr[(j - k)] != 'G')) || ((((j - k) % 3) == 1) && (arr[(j - k)] != 'B'))) || ((((j - k) % 3) == 2) && (arr[(j - k)] != 'R')))) {g--; } gMin = Math.min(gMin,g); if ( (((((j % 3) == 0) && (arr[j] != 'B')) || (((j % 3) == 1) && (arr[j] != 'R'))) || (((j % 3) == 2) && (arr[j] != 'G')))) {b++; } if ( ((((((j - k) % 3) == 0) && (arr[(j - k)] != 'B')) || ((((j - k) % 3) == 1) && (arr[(j - k)] != 'R'))) || ((((j - k) % 3) == 2) && (arr[(j - k)] != 'G')))) {b--; } bMin = Math.min(bMin,b); }out.println(Math.min(Math.min(rMin,gMin),bMin)); }out.flush(); } }
6	public class Main implements Runnable{ final String filename = ""; public void solve()throws Exception { int n = iread(),m = iread();  int INF = -1; if ( (m > n)) { int t = m; m = n; n = t; } int[][][] d = new int[2][(1 << m)][(1 << m)]; for ( int i = 0;(i < (1 << m));i++) Arrays.fill(d[0][i],INF); int[] cnt = new int[(1 << m)]; for ( int i = 0;(i < (1 << m));i++) cnt[i] = (cnt[(i / 2)] + (i % 2)); int step = 0; d[0][0][0] = 0; for ( int u = 0;(u < n);u++) {for ( int i = 0;(i < (1 << m));i++) Arrays.fill(d[(step ^ 1)][i],INF); for ( int mask1 = 0;(mask1 < (1 << m));mask1++) for ( int mask2 = 0;(mask2 < (1 << m));mask2++) { int t = d[step][mask1][mask2]; if ( (t == INF)) continue; for ( int mask = 0;(mask < (1 << m));mask++) {if ( ((mask1 & mask) != mask1)) continue; int mask01 = (((1 << m) - 1) & ~mask2); for ( int j = 0;(j < m);j++) if ( ((mask & (1 << j)) != 0)) {if ( (j > 0)) mask01 &= (1 << (j - 1)); mask01 &= (1 << j); if ( ((j + 1) < m)) mask01 &= (1 << (j + 1)); } int mask02 = mask;  int t2 = (t + cnt[(((1 << m) - 1) & ~mask)]); if ( (d[(step ^ 1)][mask01][mask02] < t2)) {d[(step ^ 1)][mask01][mask02] = t2; } }}step ^= 1; } int ans = INF; for ( int mask = 0;(mask < (1 << m));mask++) {ans = Math.max(ans,d[step][0][mask]); }out.write((ans + "\n")); } public int iread()throws Exception { return Integer.parseInt(readword());} BufferedReader in ; BufferedWriter out ; public String readword()throws IOException { StringBuilder b = new StringBuilder();  int c ; c = in.read(); while(((c >= 0) && (c <= ' ')))c = in.read(); if ( (c < 0)) return ""; while((c > ' ')){b.append((char)c); c = in.read(); }return b.toString();} public static void main( String[] args){ try{Locale.setDefault(Locale.US); }catch (Exception e){ } new Thread(null,new Main(),"1",(1 << 25)).start(); } }
0	public class a{ public static void main( String[] args){ Scanner br = new Scanner(System.in);  long n = br.nextLong(); System.out.println("25"); } }
0	public class A235{ public static void main( String[] args)throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  long n = Long.parseLong(reader.readLine()); if ( (n <= 2)) System.out.println(n); else if ( (n == 3)) System.out.println("6"); else if ( ((n % 2) == 0)) {if ( ((n % 3) == 0)) {System.out.println((((n - 3) * (n - 1)) * (n - 2))); } else System.out.println(((n * (n - 1)) * (n - 3))); } else System.out.println(((n * (n - 1)) * (n - 2))); } }
3	public class C{ static int sqr( int x){ return (x * x);} static void solve()throws Exception { int n = scanInt();  int r = scanInt();  int x[] = new int[n];  double y[] = new double[n]; for ( int i = 0;(i < n);i++) { int cx = x[i] = scanInt();  double cy = r; for ( int j = 0;(j < i);j++) {if ( (abs((cx - x[j])) <= (2 * r))) {cy = max(cy,(y[j] + sqrt((sqr((2 * r)) - sqr((cx - x[j])))))); } }y[i] = cy; if ( (i > 0)) {out.print(' '); } out.printf(Locale.US,"%.9f",cy); }} static int scanInt()throws IOException { return parseInt(scanString());} static String scanString()throws IOException { while(((tok == null) || !tok.hasMoreTokens())){tok = new StringTokenizer(in.readLine()); }return tok.nextToken();} static BufferedReader in ; static PrintWriter out ; static StringTokenizer tok ; public static void main( String[] args){ try{in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); in.close(); out.close(); }catch (Throwable e){ e.printStackTrace(); exit(1); } } }
0	public class Main{ FastScanner in ; PrintWriter out ; static final String FILE = ""; public void solve(){ out.print(25); } public void run(){ if ( FILE.equals("")) {in = new FastScanner(System.in); out = new PrintWriter(System.out); } else {try{in = new FastScanner(new FileInputStream((FILE + ".in"))); out = new PrintWriter(new FileOutputStream((FILE + ".out"))); }catch (FileNotFoundException e){ e.printStackTrace(); } }solve(); out.close(); } public static void main( String[] args){ new Main().run(); } class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} } }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out,true); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,kk ; int[] uu ,vv ,uv ,cost ,cost_ ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; kk = new int[n_]; uu = new int[m_]; vv = new int[m_]; uv = new int[m_]; cost = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; uv[h] = (u ^ v); cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } boolean dijkstra( int s, int t){ Arrays.fill(pi,INF); pi[s] = 0; TreeSet<Integer> pq = new TreeSet<>((u,v)->((pi[u] != pi[v])?(pi[u] - pi[v]):((kk[u] != kk[v])?(kk[u] - kk[v]):(u - v)))); pq.add(s); Integer first ; while(((first = pq.pollFirst()) != null)){ int u = first;  int k = (kk[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost_[h]:-cost_[h]));  int v = (u ^ uv[h]); if ( ((pi[v] > p) || ((pi[v] == p) && (kk[v] > k)))) {if ( (pi[v] != INF)) pq.remove(v); pi[v] = p; kk[v] = k; pq.add(v); } } }return (pi[t] != INF);} int dfs( int u, int t, int c){ if ( ((u == t) || (c == 0))) return c; int k = (kk[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) { int h = (h_ >> 1);  int v = (u ^ uv[h]); if ( (kk[v] != k)) continue; int p = (pi[u] + (((h_ & 1) == 0)?cost_[h]:-cost_[h])),f ; if ( ((pi[v] == p) && ((f = dfs(v,t,Math.min(c,cc[h_]))) != 0))) {cc[h_] -= f; cc[(h_ ^ 1)] += f; return f;} }kk[u] = INF; return 0;} int edmonds_karp( int s, int t){ cost_ = Arrays.copyOf(cost,m_); while(dijkstra(s,t)){while((dfs(s,t,INF) > 0));for ( int h = 0;(h < m_);h++) { int u = uu[h],v = vv[h]; if ( ((pi[u] != INF) && (pi[v] != INF))) cost_[h] += (pi[u] - pi[v]); }} int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
6	public class Main{ static MyScanner scan ; static PrintWriter pw ; static long MOD = 1_000_000_007; static long INF = 1_000_000_000_000_000_000L; static long inf = 2_000_000_000; public static void main( String[] args){ new Thread(null,null,"BaZ",(1 << 27)){}.start(); } static int n ,m ; static int dp[] ,cnt[][] ,sum[] ; static void solve()throws IOException { initIo(false); StringBuilder sb = new StringBuilder(); n = ni(); m = ni(); dp = new int[(1 << m)]; char c[] = ne().toCharArray(); cnt = new int[m][m]; for ( int i = 0;((i + 1) < n);++i) {if ( (c[i] != c[(i + 1)])) {++cnt[(c[i] - 'a')][(c[(i + 1)] - 'a')]; ++cnt[(c[(i + 1)] - 'a')][(c[i] - 'a')]; } }sum = new int[(1 << m)]; calc(0,0,0); Arrays.fill(dp,-1); pl(f(0)); pw.flush(); pw.close(); } static void calc( int mask, int S, int pos){ if ( (pos == m)) {sum[mask] = S; return ;} calc(mask,S,(pos + 1)); int newSum = S; for ( int i = 0;(i < pos);++i) {if ( ((mask & (1 << i)) != 0)) {newSum -= cnt[i][pos]; } else {newSum += cnt[i][pos]; }}for ( int i = (pos + 1);(i < m);++i) {newSum += cnt[i][pos]; }calc((mask | (1 << pos)),newSum,(pos + 1)); } static int f( int mask){ if ( (mask == ((1 << m) - 1))) {return 0;} if ( (dp[mask] != -1)) {return dp[mask];} int min = Integer.MAX_VALUE; for ( int i = 0;(i < m);++i) {if ( ((mask & (1 << i)) == 0)) {min = min(min,(sum[mask] + f((mask | (1 << i))))); } }return dp[mask] = min;} static void initIo( boolean isFileIO)throws IOException { scan = new MyScanner(isFileIO); if ( isFileIO) {pw = new PrintWriter("/Users/amandeep/Desktop/output.txt"); } else {pw = new PrintWriter(System.out,true); }} static int ni()throws IOException { return scan.nextInt();} static String ne()throws IOException { return scan.next();} static void pl(){ pw.println(); } static void p( Object o){ pw.print((o + " ")); } static void pl( Object o){ pw.println(o); } static class MyScanner{ BufferedReader br ; StringTokenizer st ; MyScanner( boolean readingFromFile)throws IOException{ if ( readingFromFile) {br = new BufferedReader(new FileReader("/Users/amandeep/Desktop/input.txt")); } else {br = new BufferedReader(new InputStreamReader(System.in)); }} String nextLine()throws IOException { return br.readLine();} String next()throws IOException { if ( ((st == null) || !st.hasMoreTokens())) st = new StringTokenizer(br.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} long nextLong()throws IOException { return Long.parseLong(next());} double nextDouble()throws IOException { return Double.parseDouble(next());} } }
2	public class DigitsSequence2{ public static void main( String[] args){ Scanner scanner = new Scanner(System.in);  long index = scanner.nextLong(); solution1(index); } static void solution1( Long index){ int i = 1;  long len = 9;  long max = 9; while((len < index)){ long tmp = (9 * (long)Math.pow(10,i)); i++; len += (i * tmp); max += tmp; } long diff = (len - index);  long laterCount = (diff / i);  int remainder = (int)(diff % i);  long current = (max - laterCount);  int k = ((i - 1) - remainder); System.out.println(String.valueOf(current).charAt(k)); } }
5	public class A{ final int MOD = ((int)1e9 + 7); final double eps = 1e-12; final int INF = (int)1e9; public A(){ int N = sc.nextInt();  int K = sc.nextInt();  Long[] A = sc.nextLongs(); sort(A); Set<Long> S = new HashSet<Long>(); for ( long a :A) {if ( (((a % K) == 0) && S.contains((P * (a / K))))) continue; S.add((P * a)); } int res = S.size(); exit(res); } long P = probablePrime(50,new Random()).longValue(); static MyScanner sc = new MyScanner(); static class MyScanner{ public String next(){ newLine(); return line[index++];} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} public double nextDouble(){ return Double.parseDouble(next());} public String[] nextStrings(){ line = null; return readLine().split(" ");} public Integer[] nextInts(){ String[] L = nextStrings();  Integer[] res = new Integer[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Integer.parseInt(L[i]); return res;} public Long[] nextLongs(){ String[] L = nextStrings();  Long[] res = new Long[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Long.parseLong(L[i]); return res;} public Double[] nextDoubles(){ String[] L = nextStrings();  Double[] res = new Double[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Double.parseDouble(L[i]); return res;} public String[] next( int N){ String[] res = new String[N]; for ( int i = 0;(i < N);++i) res[i] = sc.next(); return res;} public Integer[] nextInt( int N){ Integer[] res = new Integer[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInt(); return res;} public Long[] nextLong( int N){ Long[] res = new Long[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLong(); return res;} public Double[] nextDouble( int N){ Double[] res = new Double[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDouble(); return res;} public String[][] nextStrings( int N){ String[][] res = new String[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextStrings(); return res;} public Integer[][] nextInts( int N){ Integer[][] res = new Integer[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInts(); return res;} public Long[][] nextLongs( int N){ Long[][] res = new Long[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLongs(); return res;} public Double[][] nextDoubles( int N){ Double[][] res = new Double[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDoubles(); return res;} private boolean eol(){ return (index == line.length);} private String readLine(){ try{return r.readLine(); }catch (Exception e){ throw (new Error(e));} } private final BufferedReader r ; MyScanner(){ this(new BufferedReader(new InputStreamReader(System.in))); } MyScanner( BufferedReader r){ try{this.r = r; while(!r.ready())Thread.sleep(1); start(); }catch (Exception e){ throw (new Error(e));} } private String[] line ; private int index ; private void newLine(){ if ( ((line == null) || eol())) {line = readLine().split(" "); index = 0; } } } static void print( Object o, Object... a){ printDelim(" ",o,a); } static void printDelim( String delim, Object o, Object... a){ pw.println(build(delim,o,a)); } static void exit( Object o, Object... a){ print(o,a); exit(); } static void exit(){ pw.close(); System.out.flush(); System.err.println("------------------"); System.err.println(("Time: " + ((millis() - t) / 1000.0))); System.exit(0); } static String build( String delim, Object o, Object... a){ StringBuilder b = new StringBuilder(); append(b,o,delim); for ( Object p :a) append(b,p,delim); return b.toString().trim();} static void append( StringBuilder b, Object o, String delim){ if ( o.getClass().isArray()) { int L = Array.getLength(o); for ( int i = 0;(i < L);++i) append(b,Array.get(o,i),delim); } else if ( (o instanceof Iterable<?>)) {for ( Object p :(Iterable<?>)o) append(b,p,delim); } else b.append(delim).append(o); } public static void main( String[] args){ new A(); exit(); } static void start(){ t = millis(); } static PrintWriter pw = new PrintWriter(System.out); static long t ; static long millis(){ return System.currentTimeMillis();} }
6	public class ProblemE{ static final int INF = 1000000; public static void main( String[] args)throws IOException { BufferedReader s = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  int n = Integer.valueOf(s.readLine());  double[][] prob = new double[n][n];  double[] dp = new double[(1 << n)]; for ( int i = 0;(i < n);i++) { String[] line = s.readLine().split(" "); for ( int j = 0;(j < n);j++) {prob[i][j] = Double.valueOf(line[j]); }}dp[((1 << n) - 1)] = 1.0d; for ( int p = ((1 << n) - 1);(p >= 1);p--) {if ( (dp[p] > 0.0d)) { int left = Integer.bitCount(p); if ( (left == 1)) {continue;} double baseProb = (1.0d / ((left * (left - 1)) / 2)); for ( int i = 0;(i < n);i++) {if ( ((p & (1 << i)) == 0)) {continue;} for ( int j = (i + 1);(j < n);j++) {if ( ((p & (1 << j)) == 0)) {continue;} dp[(p - (1 << i))] += ((dp[p] * baseProb) * prob[j][i]); dp[(p - (1 << j))] += ((dp[p] * baseProb) * prob[i][j]); }}} } StringBuffer b = new StringBuffer(); for ( int i = 0;(i < n);i++) {b.append(" ").append(dp[(1 << i)]); }out.println(b.substring(1)); out.flush(); } }
3	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);  TaskG solver = new TaskG(); solver.solve(1,in,out); out.close(); } static class TaskG{ static final long MODULO = (long)(1e9 + 7); public void solve( int testNumber, InputReader in, PrintWriter out){ String x = in.next();  int[][] comb = new int[(x.length() + 2)][(x.length() + 2)]; comb[0][0] = 1; for ( int i = 1;(i < comb.length);++i) {comb[i][0] = 1; for ( int j = 1;(j < comb.length);++j) {comb[i][j] = ((comb[(i - 1)][(j - 1)] + comb[(i - 1)][j]) % (int)MODULO); }} int[][] pow = new int[11][(x.length() + 2)]; for ( int i = 0;(i < pow.length);++i) {pow[i][0] = 1; for ( int j = 1;(j < pow[i].length);++j) {pow[i][j] = (int)((i * (long)pow[i][(j - 1)]) % MODULO); }} int[] oneSum = new int[(x.length() + 2)]; for ( int i = 1;(i < oneSum.length);++i) {oneSum[i] = (int)(((10 * (long)oneSum[(i - 1)]) + 1) % MODULO); } int[][] s1 = new int[10][(x.length() + 1)];  int[][] s2 = new int[10][(x.length() + 1)]; for ( int what = 1;(what <= 9);++what) {for ( int max = 0;(max <= x.length());++max) { long sum1 = 0;  long sum2 = 0; for ( int equalExtra = 0;(equalExtra <= max);++equalExtra) { long cways = 1; cways *= comb[max][equalExtra]; cways %= MODULO; cways *= pow[what][(max - equalExtra)]; cways %= MODULO; sum1 += (cways * oneSum[equalExtra]); sum1 %= MODULO; sum2 += cways; sum2 %= MODULO; }s1[what][max] = (int)sum1; s2[what][max] = (int)sum2; }} int[] sofar = new int[10];  long res = 0; for ( int firstLess = 0;(firstLess < x.length());++firstLess) { int min = 0;  int max = (x.charAt(firstLess) - '0'); if ( (firstLess < (x.length() - 1))) --max; for ( int dig = min;(dig <= max);++dig) {++sofar[dig]; int totalSofar = (firstLess + 1);  int sofarBigger = 0; for ( int what = 9;(what >= 1);--what) { int sofarThisOrLess = (totalSofar - sofarBigger);  int sofarThis = sofar[what];  int sofarLess = (sofarThisOrLess - sofarThis); for ( int bigger = sofarBigger;((bigger + sofarThisOrLess) <= x.length());++bigger) { long ways = comb[(x.length() - totalSofar)][(bigger - sofarBigger)]; ways *= pow[(9 - what)][(bigger - sofarBigger)]; ways %= MODULO; long sum1 = s1[what][((x.length() - bigger) - sofarThisOrLess)];  long sum2 = s2[what][((x.length() - bigger) - sofarThisOrLess)];  long sum = (((sum1 * (long)pow[10][sofarThis]) + (sum2 * oneSum[sofarThis])) % MODULO); sum *= pow[10][bigger]; sum %= MODULO; res = ((res + (((sum * ways) % MODULO) * what)) % MODULO); }sofarBigger += sofarThis; }--sofar[dig]; }++sofar[(x.charAt(firstLess) - '0')]; }out.println(res); } } 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();} } }
2	public class ABC{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long k ,c ,n ,d ; c = 1; d = 9; n = 1; k = sc.nextLong(); while((k > (c * d))){k -= (c * d); n *= 10; d *= 10; c++; }n += ((k - 1) / c); char[] num = String.valueOf(n).toCharArray(); System.out.println(num[(int)((k - 1) % c)]); } }
6	public class Main{ public static void main( String[] args)throws Exception { Reader.init(System.in); PrintWriter out = new PrintWriter(System.out);  Main mm = new Main();  int n = Reader.nextInt();  int m = Reader.nextInt();  String s = Reader.next();  int[][] count = new int[m][m]; for ( int i = 1;(i < n);i++) {count[(s.charAt(i) - 'a')][(s.charAt((i - 1)) - 'a')]++; count[(s.charAt((i - 1)) - 'a')][(s.charAt(i) - 'a')]++; } int[] dp = new int[(1 << m)]; Arrays.fill(dp,(Integer.MAX_VALUE / 10)); for ( int i = 0;(i < m);i++) {dp[(1 << i)] = 0; }for ( int i = 0;(i < (1 << m));i++) { int extra = 0; for ( int j = 0;(j < m);j++) {if ( ((i & (1 << j)) > 0)) {for ( int k = 0;(k < m);k++) {if ( ((j != k) && ((i & (1 << k)) == 0))) {extra += count[j][k]; } }} }for ( int j = 0;(j < m);j++) {if ( ((i & (1 << j)) == 0)) {dp[(i | (1 << j))] = Math.min(dp[(i | (1 << j))],(dp[i] + extra)); } }}out.println(dp[((1 << m) - 1)]); out.close(); } }
6	public class TaskB{ int[] levels ; int[] loyalty ; int n ,k ,A ; double ans = Double.NEGATIVE_INFINITY; void rec( int ix, int sweets, int[] loyalty){ if ( (ix == n)) { double nres = 0.0; for ( int mask = 0;(mask < (1 << n));mask++) { double res = 1.0,totalStrength = 0; for ( int i = 0;(i < n);i++) {if ( ((mask & (1 << i)) > 0)) {res *= (loyalty[i] / 100.0); } else {res *= (1.0 - (loyalty[i] / 100.0)); totalStrength += levels[i]; }} int bitCount = Integer.bitCount(mask); if ( (bitCount > (n / 2))) {nres += res; } else {nres += ((res * A) / (A + totalStrength)); }}ans = Math.max(ans,nres); return ;} for ( int j = 0;(j <= sweets);j++) {if ( ((loyalty[ix] + (10 * j)) > 100)) break; int[] nloyalty = loyalty.clone(); nloyalty[ix] += (10 * j); rec((ix + 1),(sweets - j),nloyalty); }} void run(){ n = nextInt(); k = nextInt(); A = nextInt(); levels = new int[n]; loyalty = new int[n]; for ( int i = 0;(i < n);i++) {levels[i] = nextInt(); loyalty[i] = nextInt(); }rec(0,k,loyalty); System.out.println(ans); } int nextInt(){ try{ int c = System.in.read(); if ( (c == -1)) return c; while(((c != '-') && ((c < '0') || ('9' < c)))){c = System.in.read(); if ( (c == -1)) return c; }if ( (c == '-')) return -nextInt(); int res = 0; do {res *= 10; res += (c - '0'); c = System.in.read(); }while((('0' <= c) && (c <= '9')));return res; }catch (Exception e){ return -1;} } long nextLong(){ try{ int c = System.in.read(); if ( (c == -1)) return -1; while(((c != '-') && ((c < '0') || ('9' < c)))){c = System.in.read(); if ( (c == -1)) return -1; }if ( (c == '-')) return -nextLong(); long res = 0; do {res *= 10; res += (c - '0'); c = System.in.read(); }while((('0' <= c) && (c <= '9')));return res; }catch (Exception e){ return -1;} } String next(){ try{ StringBuilder res = new StringBuilder("");  int c = System.in.read(); while(Character.isWhitespace(c))c = System.in.read(); do {res.append((char)c); }while(!Character.isWhitespace(c = System.in.read()));return res.toString(); }catch (Exception e){ return null;} } public static void main( String[] args){ new TaskB().run(); } }
6	public final class CF_599_D1_C{ static boolean verb = true; static void log( Object X){ if ( verb) System.err.println(X); } static void log( Object[] X){ if ( verb) {for ( Object U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X){ if ( verb) {for ( int U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X, int L){ if ( verb) {for ( int i = 0;(i < L);i++) System.err.print((X[i] + " ")); System.err.println(""); } } static void log( long[] X){ if ( verb) {for ( long U :X) System.err.print((U + " ")); System.err.println(""); } } static void output( Object o){ outputWln((("" + o) + "\n")); } static void outputWln( Object o){ try{out.write(("" + o)); }catch (Exception e){ } } static long mod = 1000000007; static BufferedWriter out ; static InputReader reader ; static void explore( ArrayList<Integer>[] components, ArrayList<Integer> bob, int[][] move, ArrayList<int[]>[] howto, int[][] list){ for ( int x :bob) {if ( (components[x].size() == 1)) { int tm[] = howto[x].get(0);  int L = howto[x].size(); howto[x].add(tm); for ( int i = 0;(i < L);i++) { int[] cur = howto[x].get(i);  int[] nx = howto[x].get((i + 1));  int a = cur[0];  int a2 = nx[0];  int b2 = nx[1]; move[a2][0] = list[a2][b2]; move[a2][1] = a; }} else {explore(components,components[x],move,howto,list); }}} static void process()throws Exception { out = new BufferedWriter(new OutputStreamWriter(System.out)); reader = new InputReader(System.in); int k = reader.readInt();  int[][] list = new int[k][];  long[] sum = new long[k];  int[] L = new int[k];  HashMap<Integer,int[]> target = new HashMap<Integer,int[]>();  long tot = 0; for ( int i = 0;(i < k);i++) {L[i] = reader.readInt(); list[i] = new int[L[i]]; for ( int j = 0;(j < L[i]);j++) {list[i][j] = reader.readInt(); sum[i] += list[i][j]; target.put(list[i][j],new int[]{i,j}); }tot += sum[i]; } int MX = (1 << k);  int AX = 1000000001;  ArrayList<int[]>[] howto = new ArrayList[MX]; log("ok with the data"); if ( ((tot % k) != 0)) {output("No"); } else {tot /= k; for ( int i = 0;(i < k);i++) {if ( (sum[i] == tot)) { int mask = (1 << i);  ArrayList<int[]> cand = new ArrayList<int[]>(); cand.add(new int[]{i,0}); howto[mask] = cand; } else for ( int j = 0;(j < L[i]);j++) { int u = i;  int v = j;  boolean ok = true;  int src_u = u;  int src_v = v;  int mask = 0;  boolean goon = true;  ArrayList<int[]> cand = new ArrayList<int[]>(); while(goon){cand.add(new int[]{u,v}); ok = false; goon = false; long need = (tot - ((long)sum[u] - (long)list[u][v])); if ( (Math.abs(need) <= AX)) { int nd = (int)need;  int[] tm = target.get(nd); if ( (tm != null)) { int nxu = tm[0];  int nxv = tm[1]; if ( ((mask & (1 << nxu)) == 0)) {mask |= (1 << nxu); if ( (nxu == src_u)) {if ( (nxv == src_v)) ok = true; } else {u = nxu; v = nxv; ok = true; goon = true; }} } } }if ( ok) {if ( (howto[mask] == null)) {howto[mask] = cand; } } }}log("step 1 done"); ArrayList[] components = new ArrayList[MX]; for ( int m = 0;(m < MX);m++) {if ( (howto[m] != null)) {components[m] = new ArrayList<Integer>(); components[m].add(m); } } int[] msk = new int[MX];  int w = 0; for ( int a = 0;(a < MX);a++) {if ( (howto[a] != null)) { ArrayList<Integer> add = new ArrayList<Integer>();  int ww = w; for ( int i = 0;(i < ww);i++) { int b = msk[i]; if ( ((b & a) == 0)) { int c = (b | a); if ( (components[c] == null)) {components[c] = new ArrayList<Integer>(); components[c].add(a); components[c].add(b); msk[w++] = c; } } }msk[w++] = a; } }if ( (components[(MX - 1)] != null)) {output("Yes"); int[][] move = new int[k][2]; explore(components,components[(MX - 1)],move,howto,list); for ( int i = 0;(i < k);i++) {output(((move[i][0] + " ") + (move[i][1] + 1))); }} else {output("No"); }}try{out.close(); }catch (Exception e){ } } public static void main( String[] args)throws Exception { process(); } static final class InputReader{ private final InputStream stream ; private final byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read()throws IOException { if ( (curChar >= numChars)) {curChar = 0; numChars = stream.read(buf); if ( (numChars <= 0)) {return -1;} } return buf[curChar++];} public final int readInt()throws IOException { int c = read();  boolean neg = false; while(isSpaceChar(c)){c = read(); } char d = (char)c; if ( (d == '-')) {neg = true; c = read(); } int res = 0; do {res *= 10; res += (c - '0'); c = read(); }while(!isSpaceChar(c));if ( neg) return -res; return res;} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
0	public class Test{ static int pos = 0; static int arr[] ; static LinkedList l1 = new LinkedList(); public static void main( String[] args){ Scanner in = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  int k = in.nextInt(),n = in.nextInt(),s = in.nextInt(),p = in.nextInt();  int paper = (n / s); if ( ((n % s) != 0)) paper++; paper *= k; int fin = (paper / p); if ( ((paper % p) != 0)) fin++; System.out.println(fin); } }
2	public class Main{ public static void main( String[] args)throws Exception { InputReader in = new InputReader(System.in);  int n = in.readInt();  int m = in.readInt();  int k = in.readInt();  long wrong = (n - m);  long c = ((wrong * (k)+k) - 1);  long xk = (n - c); if ( (xk <= 0)) System.out.println(((n - wrong) % 1000000009)); else { long x = (long)Math.ceil((xk / (k * 1.0)));  long power = Long.parseLong((BigInteger.valueOf(2) + "")); power += 1000000009; power %= 1000000009; long first = ((power * k) % 1000000009); first += ((n - (x * k)) - wrong); System.out.println((first % 1000000009)); }} static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1000]; private int curChar ,numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read(){ if ( (numChars == -1)) throw (new InputMismatchException()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} public 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);} 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))){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();} } }
2	public class Template{ BufferedReader in ; PrintWriter out ; StringTokenizer st ; String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (Exception e){ } }return st.nextToken();} long nextLong(){ return Long.parseLong(next());} public void run()throws Exception { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.flush(); out.close(); in.close(); } public void solve()throws Exception { long l = nextLong();  long r = nextLong();  long[] x = new long[100];  int kx = 0; while((r > 0)){x[kx++] = (r % 2); r /= 2; } long[] y = new long[100];  int ky = 0; while((l > 0)){y[ky++] = (l % 2); l /= 2; } long[] ans = new long[100];  boolean ok = false; for ( int k = (kx - 1);(k >= 0);k--) {if ( ok) {ans[k] = 1; continue;} if ( (x[k] > y[k])) {ans[k] = 1; ok = true; } } long a = 0;  long p2 = 1; for ( int i = 0;(i < kx);i++) {a += (p2 * ans[i]); p2 *= 2; }out.println(a); } public static void main( String[] args)throws Exception { new Template().run(); } }
3	public class Solution{ private long[] sums ; private void solve(){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int[] arr = new int[n]; this.sums = new long[n]; for ( int i = 0;(i < n);i++) {arr[i] = sc.nextInt(); sums[i] = (arr[i] + ((i == 0)?0:sums[(i - 1)])); } long ans = 0; for ( int i = 1;((i <= n) && (i <= m));i++) {ans = Math.max(ans,(sum(0,(i - 1)) - k)); } long[] dp = new long[n]; for ( int i = 0;(i < n);i++) {if ( ((i + 1) >= m)) { long cur = (sum(((i - m) + 1),i) - k); if ( ((i - m) >= 0)) {cur += dp[(i - m)]; } dp[i] = Math.max(dp[i],cur); } for ( int j = 0;((j <= m) && ((i + j) < n));j++) {ans = Math.max(ans,((dp[i] + sum((i + 1),(i + j))) - (k * ((j > 0)?1:0)))); }}System.out.println(ans); } private long sum( int l, int r){ if ( (l <= 0)) {return sums[r];} else {return (sums[r] - sums[(l - 1)]);}} public static void main( String[] args){ new Solution().solve(); } }
1	public class A{ public static void main( String[] ar)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String s1[] = br.readLine().split(" ");  String s2[] = br.readLine().split(" ");  int n = Integer.parseInt(s1[0]);  int m = Integer.parseInt(s1[1]);  int a[] = new int[n];  int b[] = new int[n];  int c[] = new int[n];  int d[] = new int[n];  HashSet<Integer> hs = new HashSet<Integer>(); hs.add(0); hs.add(m); int max = 0; for ( int i = 0;(i < n);i++) {a[i] = Integer.parseInt(s2[i]); if ( ((i % 2) == 0)) b[i] = 1; hs.add(a[i]); }c[0] = a[0]; for ( int i = 1;(i < n);i++) {if ( (b[i] == 0)) c[i] = c[(i - 1)]; else c[i] = ((c[(i - 1)] + a[i]) - a[(i - 1)]); }if ( (b[(n - 1)] == 0)) d[(n - 1)] = (m - a[(n - 1)]); for ( int i = (n - 2);(i >= 0);i--) {if ( (b[i] == 1)) d[i] = d[(i + 1)]; else d[i] = ((d[(i + 1)] + a[(i + 1)]) - a[i]); }max = c[(n - 1)]; if ( (b[(n - 1)] == 0)) max += (m - a[(n - 1)]); for ( int i = (n - 1);(i >= 0);i--) { int u = (a[i] - 1);  int v = (a[i] + 1); if ( !hs.contains(u)) {if ( (b[i] == 0)) { int r = ((((1 + m) - a[i]) - d[i]) + c[(i - 1)]); max = Math.max(max,r); } else { int l = 0; if ( (i > 0)) l = a[(i - 1)];  int r = ((((c[i] - 1) + m) - a[i]) - d[i]); max = Math.max(max,r); }} if ( !hs.contains(v)) {if ( (b[i] == 0)) {if ( (i == (n - 1))) { int r = (c[i] + 1); max = Math.max(max,r); } else { int r = ((((c[i] + 1) + m) - a[(i + 1)]) - d[(i + 1)]); max = Math.max(max,r); }} else {if ( (i == (n - 1))) { int r = (((c[i] + m) - a[i]) - 1); max = Math.max(max,r); } else { int r = ((((((c[i] + m) - a[(i + 1)]) - d[(i + 1)]) + a[(i + 1)]) - 1) - a[i]); max = Math.max(max,r); }}} }System.out.println(max); } }
1	public class CF1197B{ public static void main( String[] args){ FastReader input = new FastReader();  int n = input.nextInt();  int[] arr = new int[n];  int max = 0;  int maxIndex = 0; for ( int i = 0;(i < n);i++) {arr[i] = input.nextInt(); if ( (arr[i] > max)) {max = arr[i]; maxIndex = i; } } int j = (maxIndex - 1);  int k = (maxIndex + 1); while(((j >= 0) && (k < n))){if ( (arr[j] > arr[k])) {if ( (arr[j] < max)) {max = arr[j]; j--; } else {System.out.println("NO"); return ;}} else {if ( (arr[k] < max)) {max = arr[k]; k++; } else {System.out.println("NO"); return ;}}}if ( (j >= 0)) {while((j >= 0)){if ( (arr[j] < max)) {max = arr[j]; j--; } else {System.out.println("NO"); return ;}}} if ( (k < n)) {while((k < n)){if ( (arr[k] < max)) {max = arr[k]; k++; } else {System.out.println("NO"); return ;}}} if ( ((j == -1) && (k == n))) {System.out.println("YES"); } } static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
5	public class A274{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  int k = in.nextInt();  Long a[] = new Long[n];  Hashtable<Long,Boolean> hash = new Hashtable<Long,Boolean>(); for ( int i = 0;(i < n);i++) {a[i] = in.nextLong(); }Arrays.sort(a); for ( int i = 0;(i < n);i++) {if ( !hash.containsKey(a[i])) {hash.put((a[i] * k),true); } }System.out.println(hash.size()); } }
3	public class Solution{ public static void main( String[] args)throws Exception { int n = nextInt();  int r = nextInt();  int x[] = new int[n];  double y[] = new double[n]; for ( int i = 0;(i < n);i++) x[i] = nextInt(); for ( int i = 0;(i < n);i++) {y[i] = r; for ( int j = 0;(j < i);j++) { int d = (sq((2 * r)) - sq((x[i] - x[j]))); if ( (d >= 0)) { double y1 = (Math.sqrt(d) + y[j]); y[i] = Math.max(y1,y[i]); } }}for ( int i = 0;(i < n);i++) System.out.printf("%.12g ",y[i]); } static int sq( int a){ return (a * a);} static int nextInt()throws IOException { InputStream in = System.in;  int ans = 0;  boolean flag = true;  byte b = 0; while((((b > 47) && (b < 58)) || flag)){if ( ((b >= 48) && (b < 58))) {ans = ((ans * 10) + (b - 48)); flag = false; } b = (byte)in.read(); }return ans;} static boolean isWhiteSpace( byte b){ char ch = (char)b; return (((ch == '\0') || (ch == ' ')) || (ch == '\n'));} }
2	public class D{ static long max ; public static long[] getOneRange( long min, long max, int bit){ long st = ((min & (((1l << 63) - 1) & ((1l << (bit + 1)) - 1))) | (1l << bit));  long end = (st | ((1l << (bit + 1)) - 1));  long interSt = Math.max(st,min);  long interEnd = Math.min(end,max); if ( (interSt > interEnd)) return null; return new long[]{interSt,interEnd};} public static long[] getZeroRange( long min, long max, int bit){ long st = (min & (((1l << 63) - 1) & ((1l << (bit + 1)) - 1)));  long end = (st | ((1l << bit) - 1));  long interSt = Math.max(st,min);  long interEnd = Math.min(end,max); if ( (interSt > interEnd)) return null; return new long[]{interSt,interEnd};} public static void solve( int bitPosition, long min1, long max1, long min2, long max2, long curNum){ if ( (bitPosition == -1)) {max = Math.max(max,curNum); return ;} long[] firZeroRange = getZeroRange(min1,max1,bitPosition);  long[] secZeroRange = getZeroRange(min2,max2,bitPosition);  long[] firOneRange = getOneRange(min1,max1,bitPosition);  long[] secOneRange = getOneRange(min2,max2,bitPosition); if ( (((firOneRange != null) && (secZeroRange != null)) || ((firZeroRange != null) && (secOneRange != null)))) { long newNum = (curNum | (1l << bitPosition)); if ( ((((firOneRange != null) && (secZeroRange != null)) && (((firOneRange[1] - firOneRange[0]) + 1) == (1l << bitPosition))) && (((secZeroRange[1] - secZeroRange[0]) + 1) == (1l << bitPosition)))) {solve((bitPosition - 1),firOneRange[0],firOneRange[1],secZeroRange[0],secZeroRange[1],newNum); return ;} if ( ((((firZeroRange != null) && (secOneRange != null)) && (((firZeroRange[1] - firZeroRange[0]) + 1) == (1l << bitPosition))) && (((secOneRange[1] - secOneRange[0]) + 1) == (1l << bitPosition)))) {solve((bitPosition - 1),firZeroRange[0],firZeroRange[1],secOneRange[0],secOneRange[1],newNum); return ;} if ( ((firOneRange != null) && (secZeroRange != null))) {solve((bitPosition - 1),firOneRange[0],firOneRange[1],secZeroRange[0],secZeroRange[1],newNum); } if ( ((firZeroRange != null) && (secOneRange != null))) {solve((bitPosition - 1),firZeroRange[0],firZeroRange[1],secOneRange[0],secOneRange[1],newNum); } } else {solve((bitPosition - 1),min1,max1,min2,max2,curNum); }} public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long l = sc.nextLong();  long r = sc.nextLong(); max = 0; solve(62,l,r,l,r,0); System.out.println(max); } }
0	public class ProA{ static long n ; public static void main( String[] args){ Scanner in = new Scanner(System.in); n = in.nextLong(); System.out.println(25); } }
2	public class P1177A{ public static void main( String[] args){ try(Scanner sc=new Scanner(System.in)){ long k = sc.nextLong();  int pow = 1; while(((long)((Math.pow(10,pow) - Math.pow(10,(pow - 1))) * pow) < k)){k -= (long)((Math.pow(10,pow) - Math.pow(10,(pow - 1))) * pow); pow++; }k--; long n = ((long)Math.pow(10,(pow - 1)) + (k / pow)); k %= pow; System.out.println(String.valueOf(n).charAt((int)k)); }catch (Exception e){ e.printStackTrace(); } } }
4	public class C2{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni();  int[] a = na(n); for ( int i = 0;(i < n);i++) { int v = a[i]; for ( int j = 2;((j * j) <= v);j++) {while(((v % (j * j)) == 0)){v /= (j * j); }}a[i] = v; }Arrays.sort(a); int[] f = new int[n];  int p = 0; for ( int i = 0;(i < n);i++) {if ( ((i > 0) && (a[i] != a[(i - 1)]))) {p++; } f[p]++; }f = Arrays.copyOf(f,(p + 1)); int mod = 1000000007;  int[][] fif = enumFIF(1000,mod);  long[] res = countSameNeighborsSequence(f,fif,mod);  long ans = res[0]; for ( int v :f) {ans = ((ans * fif[0][v]) % mod); }out.println(ans); } public static int[][] enumFIF( int n, int mod){ int[] f = new int[(n + 1)];  int[] invf = new int[(n + 1)]; f[0] = 1; for ( int i = 1;(i <= n);i++) {f[i] = (int)(((long)f[(i - 1)] * i) % mod); } long a = f[n];  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)); }invf[n] = (int)((p < 0)?(p + mod):p); for ( int i = (n - 1);(i >= 0);i--) {invf[i] = (int)(((long)invf[(i + 1)] * (i + 1)) % mod); }return new int[][]{f,invf};} public static long[] countSameNeighborsSequence( int[] a, int[][] fif, int mod){ int n = a.length;  int bef = a[0];  int aft = a[0];  long[] dp = new long[bef]; dp[(bef - 1)] = 1; for ( int u = 1;(u < n);u++) { int v = a[u]; aft += v; long[][] ldp = new long[bef][aft]; for ( int i = 0;(i < dp.length);i++) {ldp[i][0] = dp[i]; }for ( int i = 0;(i < v);i++) { long[][] ndp = new long[bef][aft]; for ( int j = 0;(j < bef);j++) {for ( int k = 0;((j + k) < aft);k++) {if ( (ldp[j][k] == 0)) continue; if ( (j > 0)) {ndp[(j - 1)][k] += (ldp[j][k] * j); ndp[(j - 1)][k] %= mod; } if ( (k > 0)) {ndp[j][(k + 1)] += (ldp[j][k] * k); ndp[j][(k + 1)] %= mod; } if ( ((2 * (i - k)) > 0)) {ndp[j][(k + 1)] += (ldp[j][k] * (2 * (i - k))); ndp[j][(k + 1)] %= mod; } if ( ((((((bef + i) + 1) - j) - k) - (2 * (i - k))) > 0)) {ndp[j][k] += (ldp[j][k] * (((((bef + i) + 1) - j) - k) - (2 * (i - k)))); ndp[j][k] %= mod; } }}ldp = ndp; }dp = new long[aft]; for ( int j = 0;(j < bef);j++) {for ( int k = 0;((j + k) < aft);k++) {dp[(j + k)] += ldp[j][k]; if ( (dp[(j + k)] >= mod)) dp[(j + k)] -= mod; }}for ( int j = 0;(j < aft);j++) dp[j] = ((dp[j] * fif[1][v]) % mod); bef = aft; }return dp;} 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 C2().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
2	public class Main{ @SuppressWarnings public static void main( String[] args)throws IOException { Reader ob = new Reader();  Writer out = new Writer(System.out);  Random oo = new Random();  long k = ob.nL(),ans = 0,p = 9,num = 0; for ( int i = 1;(i < 18);i++) {if ( ((num + (i * p)) < k)) {num += (i * p); p *= 10; ans = 0; for ( int j = 0;(j < i);j++) ans = (9 + (ans * 10)); } else { long left = (k - num);  long r = (left / i); left -= (r * i); ans += r; if ( (left > 0)) { String s = Long.toString((ans + 1)); out.pln(s.charAt(((int)left - 1))); } else { String s = Long.toString(ans); out.pln(s.charAt(((i - 1) - (int)left))); }break;}}out.flush(); } static void sort( int[] a){ RA(a); Arrays.sort(a); } public static Pairs[] RA( Pairs[] array){ Random rgen = new Random(); for ( int i = 0;(i < array.length);i++) { int randomPosition = rgen.nextInt(array.length);  Pairs temp = array[i]; array[i] = array[randomPosition]; array[randomPosition] = temp; }return array;} public static int[] RA( int[] array){ Random rgen = new Random(); for ( int i = 0;(i < array.length);i++) { int randomPosition = rgen.nextInt(array.length);  int temp = array[i]; array[i] = array[randomPosition]; array[randomPosition] = temp; }return array;} static void sort( long[] a){ RA(a); Arrays.sort(a); } public static long[] RA( long[] array){ Random rgen = new Random(); for ( int i = 0;(i < array.length);i++) { int randomPosition = rgen.nextInt(array.length);  long temp = array[i]; array[i] = array[randomPosition]; array[randomPosition] = temp; }return array;} static void sort( String[] a){ RA(a); Arrays.sort(a); } public static String[] RA( String[] array){ Random rgen = new Random(); for ( int i = 0;(i < array.length);i++) { int randomPosition = rgen.nextInt(array.length);  String temp = array[i]; array[i] = array[randomPosition]; array[randomPosition] = temp; }return array;} static long gcd( long a, long b){ if ( (a < b)) return gcd(b,a); else if ( (b == 0)) return a; else return gcd(b,(a % b));} static long pow( long a, long b, long mod){ if ( (b == 0)) return 1; long t = pow(a,(b >> 1),mod); t = ((t * t) % mod); if ( ((b & 1) == 1)) t = (t * a); if ( (t >= mod)) t %= mod; return t;} static long pow( long a, long b){ if ( (b == 0)) return 1; long t = pow(a,(b >> 1)); t = (t * t); if ( ((b & 1) == 1)) t = (t * a); return t;} static int max( int... a){ int m = a[0]; for ( int i = 0;(i < a.length);i++) m = Math.max(m,a[i]); return m;} static long max( long... a){ long m = a[0]; for ( int i = 0;(i < a.length);i++) m = Math.max(m,a[i]); return m;} static int min( int... a){ int m = a[0]; for ( int i = 0;(i < a.length);i++) m = Math.min(m,a[i]); return m;} static long min( long... a){ long m = a[0]; for ( int i = 0;(i < a.length);i++) m = Math.min(m,a[i]); return m;} static class Writer{ private final PrintWriter p ; Writer( OutputStream o){ p = new PrintWriter(new BufferedWriter(new OutputStreamWriter(o))); } void p( Object... o1){ for ( Object o11 :o1) {p.print((o11 + "")); }} void p( String s){ p.print(s); } void pln( Object... o1){ p(o1); p.println(); } void flush(){ p.flush(); } void close(){ p.close(); } } static class Reader{ private byte[] buf = new byte[1024]; private int curChar ; private int snumChars ; int flag = 0; FileReader file ; Reader(){ } Reader( String x)throws IOException{ flag = 1; file = new FileReader(x); } public int read(){ if ( (snumChars == -1)) throw (new InputMismatchException()); if ( (curChar >= snumChars)) {curChar = 0; try{snumChars = System.in.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (snumChars <= 0)) return -1; } return buf[curChar++];} public long nL(){ 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 int nI(){ 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);} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} private boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} } }
0	public class LCMChallenge{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long n = in.nextInt(); if ( (n == 1l)) System.out.println(1); else if ( (n == 2l)) System.out.println(2); else { long c1 = ((n * (n - 1)) * (n - 2));  long c2 = ((n * (n - 1)) * (n - 3));  long c3 = (((n - 1) * (n - 2)) * (n - 3)); if ( ((n % 2) == 0)) c1 /= 2; else c3 /= 2; if ( ((n % 3) == 0)) c2 /= 3;  long ans = Math.max(c1,c2); ans = Math.max(ans,c3); System.out.println(ans); }} }
6	public class Main{ public static void main( String[] args){ new Main().run(); } FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ out.println(work()); out.flush(); } long mod = 1000000007; long gcd( long a, long b){ return ((b == 0)?a:gcd(b,(a % b)));} long work(){ int n = in.nextInt();  int m = in.nextInt();  String str = in.next();  long[] dp = new long[(1 << m)];  long[][] cnt = new long[m][m];  long[] rec = new long[(1 << m)]; for ( int i = 1;(i < n);i++) { int n1 = (str.charAt((i - 1)) - 'a');  int n2 = (str.charAt(i) - 'a'); cnt[n1][n2]++; cnt[n2][n1]++; }for ( int i = 1;(i < (1 << m));i++) {dp[i] = 9999999999L; long v = 0;  int b = 0; for ( int j = 0;(j < m);j++) {if ( ((i & (1 << j)) > 0)) {b = j; break;} }for ( int j = 0;(j < m);j++) {if ( ((i & (1 << j)) == 0)) {v += cnt[b][j]; } else {if ( (b != j)) v -= cnt[b][j]; }}v += rec[(i - (1 << b))]; for ( int j = 0;(j < m);j++) {if ( ((i & (1 << j)) > 0)) {dp[i] = Math.min(dp[i],(dp[(i - (1 << j))] + v)); } }rec[i] = v; }return dp[((1 << m) - 1)];} } class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ if ( ((st == null) || !st.hasMoreElements())) {try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } } return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} }
5	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);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  long k = in.nextLong();  long[] a = new long[n]; for ( int i = 0;(i < n);i++) a[i] = in.nextInt(); Arrays.sort(a); boolean[] ok = new boolean[n]; Arrays.fill(ok,true); if ( (k > 1)) for ( int i = 0;(i < n);i++) {if ( (ok[i] == false)) continue; int pos = Arrays.binarySearch(a,(a[i] * k)); if ( (pos >= 0)) {ok[pos] = false; } } int ans = 0; for ( boolean x :ok) if ( x) ans++; out.println(ans); } } class InputReader{ BufferedReader br ; StringTokenizer st ; public InputReader( InputStream in){ br = new BufferedReader(new InputStreamReader(in)); st = null; } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} }
3	public class C{ public static void main( String[] args){ FastScanner sc = new FastScanner();  int n = sc.nextInt();  long r = sc.nextInt();  double d = (2 * r);  long[] xs = sc.readLongArray(n);  P[] points = new P[n];  StringBuilder sb = new StringBuilder(); for ( int i = 0;(i < n);i++) {if ( (i > 0)) sb.append(' ');  double y = r; for ( int j = 0;(j < i);j++) { long diff = Math.abs((xs[i] - points[j].x)); if ( (diff <= (2 * r))) { double dy = Math.sqrt(((d * d) - (diff * diff)));  double testY = (points[j].y + dy); y = Math.max(y,testY); } }sb.append(y); points[i] = new P(xs[i],y); }System.out.println(sb); } static class P{ final long x ; final double y ; public P( long x, double y){ this.x = x; this.y = y; } } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( Reader in){ br = new BufferedReader(in); } public FastScanner(){ this(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} long[] readLongArray( int n){ long[] a = new long[n]; for ( int idx = 0;(idx < n);idx++) {a[idx] = nextLong(); }return a;} } }
4	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  EPhoenixAndComputers solver = new EPhoenixAndComputers(); solver.solve(1,in,out); out.close(); } static class EPhoenixAndComputers{ public void solve( int testNumber, InputReader in, OutputWriter out){ int n = in.nextInt(),m = in.nextInt();  ModInt mod = new ModInt(m);  int[] factorial = new int[(n + 1)];  int[][] binomial = new int[(n + 1)][(n + 1)];  int[] two = new int[(n + 1)]; for ( int i = 0;(i <= n);i++) {binomial[i][0] = 1; for ( int j = 1;(j <= i);j++) binomial[i][j] = mod.add(binomial[(i - 1)][j],binomial[(i - 1)][(j - 1)]); factorial[i] = ((i == 0)?1:mod.multiply(factorial[(i - 1)],i)); two[i] = ((i == 0)?1:mod.multiply(2,two[(i - 1)])); } int[][] dp = new int[(n + 1)][(n + 1)]; dp[0][0] = 1; int answer = 0; for ( int i = 1;(i <= n);i++) {for ( int j = 1;(j <= i);j++) {for ( int x = 1;(x <= i);x++) {dp[i][j] = mod.add(dp[i][j],mod.multiply(binomial[i][x],mod.multiply(two[(x - 1)],dp[(i - x)][(j - 1)]))); }}}for ( int k = 0;(k < n);k++) {answer = mod.add(answer,dp[(n - k)][(k + 1)]); }out.println(answer); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void println( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }writer.print('\n'); } public void close(){ writer.close(); } } static class ModInt{ int modulo ; public ModInt( int m){ modulo = m; } public int add( int x, int y){ x += y; if ( (x >= modulo)) x -= modulo; return x;} public int multiply( int x, int y){ return (int)(((x * 1L) * y) % modulo);} } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputReader.SpaceCharFilter filter ; 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 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 boolean isSpaceChar( int c){ if ( (filter != null)) {return filter.isSpaceChar(c);} return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } }
0	public class ToyArmy{ public static void main( String[] args)throws NumberFormatException,IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine()); System.out.println(((n / 2) * 3)); } }
6	public class Solution implements Runnable{ public static void main( String[] args){ new Thread(new Solution()).start(); } BufferedReader in ; PrintWriter out ; StringTokenizer st ; String nextToken()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String r = in.readLine(); if ( (r == null)) return null; st = new StringTokenizer(r); }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} int n ; int[] b ,l ; double ans ; int[] sw ; int a ; void sol(){ for ( int i = 0;(i < n);i++) l[i] += (sw[i] * 10); double yes = 0; for ( int q = 0;(q < (1 << n));q++) { double p = 1;  int bb = 0;  int cnt = 0; for ( int i = 0;(i < n);i++) {if ( ((q & (1 << i)) == 0)) {p *= (1.0 - ((double)l[i] / 100)); bb += b[i]; } else {p *= ((1.0 * (double)l[i]) / 100); cnt++; }}if ( (cnt > (n / 2))) {yes += p; } else {yes += ((p * (double)a) / (double)(a + bb)); }}if ( (ans < yes)) ans = yes; for ( int i = 0;(i < n);i++) l[i] -= (sw[i] * 10); } void rek( int i, int k){ if ( (i == n)) sol(); else {for ( int q = 0;((q <= k) && ((l[i] + (q * 10)) <= 100));q++) {sw[i] = q; rek((i + 1),(k - q)); }}} void solve()throws Exception { n = nextInt(); int k = nextInt(); a = nextInt(); b = new int[n]; l = new int[n]; sw = new int[n]; for ( int i = 0;(i < n);i++) {b[i] = nextInt(); l[i] = nextInt(); }rek(0,k); out.printf("%.10f",ans); } }
6	public class x111C{ public static void main( String[] omkar)throws Exception { BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(infile.readLine());  int R = Integer.parseInt(st.nextToken());  int C = Integer.parseInt(st.nextToken()); if ( (R > C)) { int t = R; R = C; C = t; } int[][][] dp = new int[(C + 1)][(1 << R)][(1 << R)]; for ( int i = 0;(i <= C);i++) for ( int mask = 0;(mask < (1 << R));mask++) Arrays.fill(dp[i][mask],69); for ( int mask = 0;(mask < (1 << R));mask++) dp[0][0][mask] = 0; for ( int c = 1;(c <= C);c++) for ( int mask1 = 0;(mask1 < (1 << R));mask1++) for ( int mask2 = 0;(mask2 < (1 << R));mask2++) for ( int mask3 = 0;(mask3 < (1 << R));mask3++) { boolean works = true; for ( int b = 0;(b < R);b++) if ( ((mask2 & (1 << b)) == 0)) {if ( ((b > 0) && ((mask2 & (1 << (b - 1))) > 0))) ; else if ( (((b + 1) < R) && ((mask2 & (1 << (b + 1))) > 0))) ; else if ( ((mask1 & (1 << b)) > 0)) ; else if ( ((mask3 & (1 << b)) > 0)) ; else works = false; } if ( works) dp[c][mask2][mask3] = Math.min(dp[c][mask2][mask3],(dp[(c - 1)][mask1][mask2] + Integer.bitCount(mask1))); } int res = 0; for ( int mask = 0;(mask < (1 << R));mask++) res = Math.max(res,((R * C) - (dp[C][mask][0] + Integer.bitCount(mask)))); System.out.println(res); } }
6	public class E{ public static void main( String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  ArrayList<Integer>[][] nexts = new ArrayList[13][];  ArrayList<Integer>[] bs = new ArrayList[13];  int[][] index = new int[13][];  int[][] eqcl = new int[13][]; for ( int n = 1;(n <= 12);n++) {eqcl[n] = new int[(1 << n)]; bs[n] = new ArrayList<Integer>(); index[n] = new int[(1 << n)]; int ind = 0; for ( int mask = 0;(mask < (1 << n));mask++) { boolean add = true; for ( int k = 0;(k < n);k++) {if ( (rot(mask,k,n) < mask)) add = false; }if ( add) {bs[n].add(mask); index[n][mask] = ind; ind++; } }nexts[n] = new ArrayList[bs[n].size()]; for ( int i = 0;(i < bs[n].size());i++) { int mask = bs[n].get(i); for ( int k = 0;(k < n);k++) {eqcl[n][rot(mask,k,n)] = mask; }nexts[n][i] = new ArrayList<>(); for ( int y = 0;(y < (1 << n));y++) {if ( ((mask & y) == 0)) {nexts[n][i].add(y); } }}} int T = Integer.parseInt(br.readLine());  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); for ( int test = 0;(test < T);test++) { StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int m = Integer.parseInt(st.nextToken());  int[][] arrt = new int[m][n]; for ( int i = 0;(i < n);i++) {st = new StringTokenizer(br.readLine()); for ( int j = 0;(j < m);j++) {arrt[j][i] = Integer.parseInt(st.nextToken()); }} Column[] cols = new Column[m]; for ( int j = 0;(j < m);j++) {cols[j] = new Column(arrt[j]); }Arrays.sort(cols,Collections.reverseOrder()); m = Integer.min(n,m); int[][] arr = new int[n][m]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {arr[i][j] = cols[j].arr[i]; }} int[][] max = new int[m][bs[n].size()]; for ( int c = 0;(c < m);c++) {for ( int mask = 0;(mask < (1 << n));mask++) { int curr = 0; for ( int i = 0;(i < n);i++) {if ( ((mask & (1 << i)) > 0)) curr += arr[i][c]; } int cl = eqcl[n][mask]; max[c][index[n][cl]] = Integer.max(max[c][index[n][cl]],curr); }} int[][] dp = new int[(m + 1)][bs[n].size()]; for ( int c = 0;(c < m);c++) {for ( int i = 0;(i < bs[n].size());i++) { int mask = bs[n].get(i); for ( int next :nexts[n][i]) { int cl = eqcl[n][next];  int dl = eqcl[n][(mask | next)]; if ( ((dp[c][i] + max[c][index[n][cl]]) > dp[(c + 1)][index[n][dl]])) {dp[(c + 1)][index[n][dl]] = (dp[c][i] + max[c][index[n][cl]]); } }}}bw.write((dp[m][(bs[n].size() - 1)] + "\n")); }bw.flush(); } static int rot( int x, int k, int n){ int a = (x << k);  int b = (x >> (n - k)); return ((a + b) & ((1 << n) - 1));} static class Column implements Comparable<Column>{ int[] arr ; int max ; public Column( int[] arr){ this.arr = arr; max = 0; for ( int k :arr) {max = Integer.max(max,k); }} } }
6	public class E{ public static void main( String[] args)throws IOException { new E(); } FastScanner in = new FastScanner(System.in); PrintWriter out = new PrintWriter(System.out); int n ,m ,oo = (1 << 28); int[] dp ,cost ; int[][] to ; char[] w ; E()throws IOException{ n = in.nextInt(); m = in.nextInt(); w = in.next().toCharArray(); to = new int[(m + 1)][(m + 1)]; for ( int i = 0;(i < (n - 1));i++) if ( (w[i] != w[(i + 1)])) {to[(w[i] - 'a')][(w[(i + 1)] - 'a')]++; to[(w[(i + 1)] - 'a')][(w[i] - 'a')]++; } cost = new int[(1 << m)]; for ( int i = 0;(i < (1 << m));i++) for ( int j = 0;(j < m);j++) {if ( (((1 << j) & i) > 0)) continue; for ( int k = 0;(k < m);k++) {if ( (((1 << k) & i) == 0)) continue; cost[i] += to[j][k]; }}dp = new int[(1 << m)]; Arrays.fill(dp,oo); dp[0] = 0; for ( int i = 1;(i < (1 << m));i++) {for ( int j = 0;(j < m);j++) if ( (((i >> j) & 1) > 0)) dp[i] = Math.min(dp[i],dp[(i ^ (1 << j))]); dp[i] += cost[i]; }out.println(dp[((1 << m) - 1)]); out.close(); } void sort( int[] x){ int sz = x.length;  Random r = new Random(); for ( int i = 0;(i < sz);i++) { int j = r.nextInt(sz); x[i] = (x[j] - (x[i] - (x[j] = x[i]))); }Arrays.sort(x); } class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream i){ br = new BufferedReader(new InputStreamReader(i)); st = new StringTokenizer(""); } public String next()throws IOException { if ( st.hasMoreTokens()) return st.nextToken(); else st = new StringTokenizer(br.readLine()); return next();} public int nextInt()throws IOException { return Integer.parseInt(next());} } }
5	public class A{ public static void main( String[] args)throws IOException { InputReader in = new InputReader();  int n = in.nextInt();  long k = in.nextInt();  Long[] a = new Long[n]; for ( int i = 0;(i < n);i++) a[i] = in.nextLong(); if ( (k == 1)) System.out.println(n); else { int res = 0; Arrays.sort(a); boolean[] v = new boolean[n]; for ( int i = 0;(i < n);i++) {if ( !v[i]) { long cur = a[i];  int cnt = 1; while(true){ int idx = Arrays.binarySearch(a,(cur * k)); if ( (idx < 0)) {res += ((cnt / 2) + (cnt % 2)); break;} v[idx] = true; cur = a[idx]; cnt++; }} }System.out.println(res); }} static class InputReader{ BufferedReader in ; StringTokenizer st ; public InputReader()throws IOException{ in = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(in.readLine()); } public String next()throws IOException { while(!st.hasMoreElements())st = new StringTokenizer(in.readLine()); return st.nextToken();} public int nextInt()throws NumberFormatException,IOException { return Integer.parseInt(next());} public long nextLong()throws NumberFormatException,IOException { return Long.parseLong(next());} } }
6	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{ int n ; int[] bitCount ; long neededSum ; long[] sums ; Map<Long,Integer> where ; public void solve( int testNumber, FastScanner in, PrintWriter out){ n = in.nextInt(); int[][] a = new int[n][]; neededSum = 0; sums = new long[n]; for ( int i = 0;(i < n);i++) { int k = in.nextInt(); a[i] = new int[k]; for ( int j = 0;(j < k);j++) {a[i][j] = in.nextInt(); neededSum += a[i][j]; sums[i] += a[i][j]; }}if ( ((neededSum % n) != 0)) {out.println("No"); return ;} neededSum /= n; where = new HashMap<>(); for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < a[i].length);j++) {where.put((long)a[i][j],i); }}bitCount = new int[(1 << n)]; for ( int i = 0;(i < bitCount.length);i++) {bitCount[i] = Integer.bitCount(i); } Entry[][] cycleSol = new Entry[(1 << n)][];  List<Entry> sol = new ArrayList<>(); for ( int i = 0;(i < n);i++) {for ( int x :a[i]) {search(i,i,x,x,0,0,sol,cycleSol); }} boolean[] can = new boolean[(1 << n)];  int[] via = new int[(1 << n)]; can[0] = true; for ( int mask = 0;(mask < (1 << n));mask++) {for ( int submask = mask;(submask > 0);submask = ((submask - 1) & mask)) {if ( ((cycleSol[submask] != null) && can[(mask ^ submask)])) {can[mask] = true; via[mask] = submask; } }}if ( !can[((1 << n) - 1)]) {out.println("No"); return ;} int[][] ans = new int[n][2]; for ( int mask = ((1 << n) - 1);(mask > 0);) { int sm = via[mask]; mask ^= sm; for ( Entry e :cycleSol[sm]) {ans[e.from][0] = e.what; ans[e.from][1] = (e.to + 1); }}out.println("Yes"); for ( int i = 0;(i < n);i++) {out.println(((ans[i][0] + " ") + ans[i][1])); }} private void search( int start, int cur, long fromStart, long fromCur, int hasIn, int hasOut, List<Entry> sol, Entry[][] cycleSol){ for ( int i = start;(i < n);i++) {if ( ((hasIn & (1 << i)) > 0)) {continue;} if ( ((hasOut & (1 << cur)) > 0)) {continue;} long fromI = ((sums[i] + fromCur) - neededSum);  Integer w = where.get(fromI); if ( ((w == null) || (w != i))) {continue;} sol.add(new Entry(cur,i,(int)fromCur)); int nHasIn = (hasIn | (1 << i));  int nHasOut = (hasOut | (1 << cur)); if ( ((i == start) && (fromI == fromStart))) {cycleSol[nHasOut] = sol.toArray(new Entry[0]); } search(start,i,fromStart,fromI,nHasIn,nHasOut,sol,cycleSol); sol.remove((sol.size() - 1)); }} class Entry{ int from ; int to ; int what ; Entry( int from, int to, int what){ this.from = from; this.to = to; this.what = what; } } } static class FastScanner{ private BufferedReader in ; private StringTokenizer st ; public FastScanner( InputStream stream){ in = new BufferedReader(new InputStreamReader(stream)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{ String rl = in.readLine(); if ( (rl == null)) {return null;} st = new StringTokenizer(rl); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
2	public class Main{ static final int MAXN = 100005; static int n ; static Scanner cin ; static int[] a ; static boolean[] used ; public static int Query( int x){ System.out.print("? "); System.out.println(x); System.out.flush(); int a = cin.nextInt(); return a;} public static int Q( int x){ if ( used[x]) return a[x]; used[x] = true; a[x] = (Query(x) - Query((x + (n / 2)))); if ( (a[x] == 0)) {System.out.print("! "); System.out.println(x); System.out.flush(); cin.close(); System.exit(0); } return a[x];} public static void main( String[] args){ cin = new Scanner(System.in); n = cin.nextInt(); a = new int[MAXN]; used = new boolean[MAXN]; if ( ((n % 4) != 0)) {System.out.println("! -1\n"); System.out.flush(); cin.close(); return ;} int l = 1,r = (n / 2),mid ; while((l <= r)){mid = ((l + r) / 2); int x = Q(mid); if ( ((Q(l) * x) < 0)) {r = (mid - 1); } else if ( ((x * Q(r)) < 0)) {l = (mid + 1); } }System.out.println("! -1\n"); System.out.flush(); cin.close(); } }
6	public class Main{ static double max = 0.0; public static void main( String[] args){ Scanner r = new Scanner(System.in);  int n = r.nextInt();  int k = r.nextInt();  int A = r.nextInt();  Person[] p = new Person[n]; for ( int i = 0;(i < n);i++) { int l = r.nextInt();  int prob = r.nextInt(); p[i] = new Person(l,prob); } int[] add = new int[n];  double res = dfs(0,k,p,add,n,A); System.out.println(res); } static private double dfs( int ptr, int k, Person[] p, int[] add, int n, int A){ if ( (k < 0)) return 0; double res1 = 0; for ( int m = 0;(m < (1 << n));m++) { double win = 1;  int cnt = 0; for ( int i = 0;(i < n);i++) {if ( ((m & (1 << i)) == 0)) {win *= (((100 - (p[i].p + add[i])) * 1.0) / 100); } else {win *= (((add[i] + p[i].p) * 1.0) / 100); cnt++; }}if ( (cnt > (n / 2))) {res1 += win; } else { int B = 0; for ( int i = 0;(i < n);i++) {if ( ((m & (1 << i)) == 0)) {B += p[i].l; } }win *= ((A * 1.0) / (A + B)); res1 += win; }} double res2 = 0,res3 = 0; if ( ((add[ptr] + p[ptr].p) < 100)) {add[ptr] += 10; res2 = dfs(ptr,(k - 1),p,add,n,A); add[ptr] -= 10; } if ( ((ptr + 1) < n)) {res3 = dfs((ptr + 1),k,p,add,n,A); } return Math.max(res1,Math.max(res2,res3));} } class Person{ int l ,p ; public Person( int li, int pi){ l = li; p = pi; } }
6	public class P111C{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); int n ,m ; void run(){ n = sc.nextInt(); m = sc.nextInt(); solve(); } void solve(){ if ( (n < m)) { int t = n; n = m; m = t; } int full = ((1 << m) - 1);  int[][] dp = new int[(1 << m)][(1 << m)];  int[][] tmp = new int[(1 << m)][(1 << m)]; for ( int i = 0;(i < (1 << m));i++) {fill(dp[i],INF); }for ( int i = 0;(i < (1 << m));i++) { int b1 = (((i | (i >> 1)) | (i << 1)) & full);  int b2 = i; dp[b1][b2] = Integer.bitCount(i); }for ( int j = 0;(j < (n - 1));j++) {for ( int i = 0;(i < (1 << m));i++) {System.arraycopy(dp[i],0,tmp[i],0,(1 << m)); fill(dp[i],INF); }for ( int b1 = 0;(b1 < (1 << m));b1++) {for ( int b2 = 0;(b2 < (1 << m));b2++) {for ( int i = 0;(i < (1 << m));i++) {if ( ((b1 | i) != full)) {continue;} int b = (((i | (i >> 1)) | (i << 1)) & full); dp[(b2 | b)][i] = min(dp[(b2 | b)][i],(tmp[b1][b2] + Integer.bitCount(i))); }}}} int min = INF; for ( int i = 0;(i < (1 << m));i++) {min = min(min,dp[full][i]); } int ans = ((m * n) - min); println((ans + "")); } void println( String s){ System.out.println(s); } public static void main( String[] args){ new P111C().run(); } }
0	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  Long N = sc.nextLong();  Long ans ; sc.close(); if ( (N <= 2)) System.out.println(N); else {if ( ((N % 6) == 0)) {ans = (((N - 1) * (N - 2)) * (N - 3)); } else if ( ((N % 2) == 0)) {ans = ((N * (N - 1)) * (N - 3)); } else {ans = ((N * (N - 1)) * (N - 2)); }System.out.println(ans); }} }
2	public class Main{ static int mod = ((int)1e9 + 7); public static void main( String[] args)throws FileNotFoundException { FasterScanner s = new FasterScanner();  int test = 1; testloop:while((test-- > 0)){ int n = s.nextInt();  int left = 1;  int right = n;  int x[][] = new int[2][2];  int y[][] = new int[2][2]; while((left < right)){ int mid = ((left + right) / 2); query(1,mid,1,n); int ans = s.nextInt(); if ( (ans < 2)) {left = (mid + 1); } else {right = mid; }}x[0][0] = left; left = 1; right = n; while((left < right)){ int mid = ((left + right) / 2); query(1,mid,1,n); int ans = s.nextInt(); if ( (ans < 1)) {left = (mid + 1); } else {right = mid; }}x[0][1] = left; left = 1; right = n; while((left < right)){ int mid = (((left + right) + 1) / 2); query(mid,n,1,n); int ans = s.nextInt(); if ( (ans < 2)) {right = (mid - 1); } else {left = mid; }}x[1][0] = left; left = 1; right = n; while((left < right)){ int mid = (((left + right) + 1) / 2); query(mid,n,1,n); int ans = s.nextInt(); if ( (ans < 1)) {right = (mid - 1); } else {left = mid; }}x[1][1] = left; left = 1; right = n; while((left < right)){ int mid = ((left + right) / 2); query(1,n,1,mid); int ans = s.nextInt(); if ( (ans < 2)) {left = (mid + 1); } else {right = mid; }}y[0][0] = left; left = 1; right = n; while((left < right)){ int mid = ((left + right) / 2); query(1,n,1,mid); int ans = s.nextInt(); if ( (ans < 1)) {left = (mid + 1); } else {right = mid; }}y[0][1] = left; left = 1; right = n; while((left < right)){ int mid = (((left + right) + 1) / 2); query(1,n,mid,n); int ans = s.nextInt(); if ( (ans < 2)) {right = (mid - 1); } else {left = mid; }}y[1][0] = left; left = 1; right = n; while((left < right)){ int mid = (((left + right) + 1) / 2); query(1,n,mid,n); int ans = s.nextInt(); if ( (ans < 1)) {right = (mid - 1); } else {left = mid; }}y[1][1] = left; int x11 = 0,x12 = 0,y11 = 0,y12 = 0;  int x21 = 0,x22 = 0,y21 = 0,y22 = 0; for ( int x1 = 0;(x1 < 2);x1++) {x11 = x[1][x1]; x21 = x[1][(1 - x1)]; for ( int x2 = 0;(x2 < 2);x2++) {x12 = x[0][x2]; x22 = x[0][(1 - x2)]; if ( (x11 > x12)) continue; if ( (x21 > x22)) continue; for ( int y1 = 0;(y1 < 2);y1++) {y11 = y[1][y1]; y21 = y[1][(1 - y1)]; for ( int y2 = 0;(y2 < 2);y2++) {y12 = y[0][y2]; y22 = y[0][(1 - y2)]; if ( (y11 > y12)) continue; if ( (y21 > y22)) continue; query(x11,x12,y11,y12); int ans1 = s.nextInt(); query(x21,x22,y21,y22); int ans2 = s.nextInt(); if ( ((ans1 == 1) && (ans2 == 1))) {System.out.println(((((((((((((((("! " + x11) + " ") + y11) + " ") + x12) + " ") + y12) + " ") + x21) + " ") + y21) + " ") + x22) + " ") + y22)); System.out.flush(); break;} }}}}}} public static void query( int x1, int x2, int y1, int y2){ System.out.println(((((((("? " + x1) + " ") + y1) + " ") + x2) + " ") + y2)); System.out.flush(); } public static int max( int[] t, int a, int b){ int res = 0; for ( a += (t.length / 2),b += (t.length / 2);(a <= b);a = ((a + 1) >> 1),b = ((b - 1) >> 1)) {if ( ((a & 1) != 0)) res = Math.max(res,t[a]); if ( ((b & 1) == 0)) res = Math.max(res,t[b]); }return res;} static class FasterScanner{ private byte[] buf = new byte[1024]; private int curChar ; private int snumChars ; public int read(){ if ( (snumChars == -1)) throw (new InputMismatchException()); if ( (curChar >= snumChars)) {curChar = 0; try{snumChars = System.in.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (snumChars <= 0)) return -1; } return buf[curChar++];} 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 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);} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} private boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} } }
6	public class A{ static double[][] a ; static int N ; static double[] memo ; static double dp( int alive){ int count = Integer.bitCount(alive); if ( (count == N)) return 1; if ( (memo[alive] > -5)) return memo[alive]; double ret = 0; for ( int j = 0;(j < N);++j) if ( ((alive & (1 << j)) == 0)) ret += (die[j][(alive | (1 << j))] * dp((alive | (1 << j)))); return memo[alive] = ret;} static double[][] die ; static void f(){ die = new double[N][(1 << N)]; for ( int i = 0;(i < N);++i) for ( int j = 0;(j < (1 << N));++j) { int count = Integer.bitCount(j); if ( (count <= 1)) continue; double prop = (1.0 / ((count * (count - 1)) >> 1)); for ( int k = 0;(k < N);++k) if ( ((j & (1 << k)) != 0)) die[i][j] += (prop * a[k][i]); }} public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out); N = sc.nextInt(); a = new double[N][N]; for ( int i = 0;(i < N);++i) for ( int j = 0;(j < N);++j) a[i][j] = sc.nextDouble(); memo = new double[(1 << N)]; f(); Arrays.fill(memo,-10); for ( int i = 0;(i < (N - 1));++i) out.printf("%.8f ",dp((1 << i))); out.printf("%.8f\n",dp((1 << (N - 1)))); out.flush(); out.close(); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public double nextDouble()throws NumberFormatException,IOException { return Double.parseDouble(next());} public int nextInt()throws IOException { return Integer.parseInt(next());} public boolean ready()throws IOException { return br.ready();} } }
5	public class A{ static int[] parent ; public static int find( int x){ if ( (x == parent[x])) return x; return parent[x] = find(parent[x]);} public static void union( int x, int y){ int px = find(x);  int py = find(y); if ( (px != py)) {parent[py] = px; } } public static void main( String[] args)throws Exception { int numCnt = (int)nextLong();  long k = nextLong(); parent = new int[numCnt]; for ( int i = 0;(i < parent.length);i++) {parent[i] = i; } Long[] ar = new Long[numCnt]; for ( int i = 0;(i < numCnt);i++) {ar[i] = nextLong(); }Arrays.sort(ar); for ( int i = 0;(i < ar.length);i++) { long req = (ar[i] * k);  int l = 0,h = ar.length,mid ; while((l < h)){mid = (l + ((h - l) / 2)); if ( (ar[mid] < req)) {l = (mid + 1); } else {h = mid; }}if ( ((l < ar.length) && (ar[l] == req))) {union(i,l); } } int[] count = new int[numCnt]; for ( int i = 0;(i < parent.length);i++) {count[find(i)]++; } int res = 0; for ( int i = 0;(i < numCnt);i++) {res += (int)((count[i] + 1) / 2.0); }System.out.println(res); } static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer tokenizer = new StringTokenizer(""); static long nextLong()throws Exception { return Long.parseLong(next());} static String next()throws Exception { while(true){if ( tokenizer.hasMoreTokens()) {return tokenizer.nextToken();} String s = br.readLine(); if ( (s == null)) {return null;} tokenizer = new StringTokenizer(s); }} }
0	public class A{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); System.out.println(((2 * n) - (n / 2))); } }
3	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);  TaskG solver = new TaskG(); solver.solve(1,in,out); out.close(); } static class TaskG{ static final long MODULO = ((long)1e9 + 7); static final long BIG = (Long.MAX_VALUE - (Long.MAX_VALUE % MODULO)); static final int[] ONE = new int[]{1}; int k ; int n ; long[] globalRes ; int[] p2 ; public void solve( int testNumber, InputReader in, PrintWriter out){ n = in.nextInt(); k = in.nextInt(); globalRes = new long[(k + 1)]; p2 = new int[(n + 1)]; p2[0] = 1; for ( int i = 1;(i <= n);++i) p2[i] = (int)((2 * p2[(i - 1)]) % MODULO); Vertex[] vs = new Vertex[n]; for ( int i = 0;(i < n);++i) vs[i] = new Vertex(); for ( int i = 0;(i < (n - 1));++i) { Vertex a = vs[(in.nextInt() - 1)];  Vertex b = vs[(in.nextInt() - 1)]; a.adj.add(b); b.adj.add(a); }vs[0].dfs(null); long[][] ways = new long[(k + 1)][(k + 1)]; ways[0][0] = 1; for ( int i = 1;(i <= k);++i) {for ( int j = 1;(j <= k);++j) {ways[i][j] = ((j * (ways[(i - 1)][j] + ways[(i - 1)][(j - 1)])) % MODULO); }} long sum = 0; for ( int i = 1;(i <= k);++i) { long s = globalRes[i]; s %= MODULO; sum = ((sum + (s * ways[k][i])) % MODULO); }out.println(sum); } class Vertex{ int[] res ; int subtreeSize ; List<Vertex> adj = new ArrayList<>(); public void dfs( Vertex parent){ subtreeSize = 1; int[] prod = ONE; for ( Vertex child :adj) if ( (child != parent)) {child.dfs(this); subtreeSize += child.subtreeSize; } int mult = 2; for ( Vertex child :adj) if ( (child != parent)) { int[] c = child.res; prod = mul(prod,c); subFrom(globalRes,c,1); } addTo(globalRes,prod,mult); res = insertEdge(prod); } private int[] insertEdge( int[] a){ int len = (a.length + 1); if ( (len > k)) len = (k + 1);  int[] b = new int[len]; b[0] = (a[0] * 2); if ( (b[0] >= MODULO)) b[0] -= MODULO; for ( int i = 1;(i < len);++i) { long s = a[(i - 1)]; if ( (i < a.length)) s += a[i]; if ( (s >= MODULO)) s -= MODULO; s = (s * 2); if ( (s >= MODULO)) s -= MODULO; b[i] = (int)s; }b[1] -= 1; if ( (b[1] < 0)) b[1] += MODULO; return b;} private void addTo( long[] a, int[] b, int mult){ for ( int i = 0;(i < b.length);++i) { long s = (a[i] + (b[i] * (long)mult)); if ( (s < 0)) s -= BIG; a[i] = s; }} private void subFrom( long[] a, int[] b, int mult){ for ( int i = 0;(i < b.length);++i) { long s = (a[i] + ((MODULO - b[i]) * (long)mult)); if ( (s < 0)) s -= BIG; a[i] = s; }} private int[] mul( int[] a, int[] b){ int len = ((a.length + b.length) - 1); if ( (len > k)) len = (k + 1);  int[] c = new int[len]; for ( int i = 0;(i < len);++i) { long s = 0;  int left = Math.max(0,(i - (b.length - 1)));  int right = Math.min((a.length - 1),i); for ( int ia = left;(ia <= right);++ia) { int ib = (i - ia); s += (a[ia] * (long)b[ib]); if ( (s < 0)) s -= BIG; }c[i] = (int)(s % MODULO); }return c;} } } 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());} } }
2	public class D{ public static void main( String[] args){ Scanner cin = new Scanner(System.in);  PrintWriter cout = new PrintWriter(System.out);  long l = cin.nextLong(),r = cin.nextLong(),k = 1; if ( (l == r)) cout.println(0); else {while((((r >> k) << k) > l))k++; k--; cout.println((((r >> k) << k) ^ (((r >> k) << k) - 1))); }cout.flush(); } }
4	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(),md = sc.nextInt();  int k = ((n + 1) / 2);  int ans = 0;  int[][] dp = new int[(k + 1)][(n + 1)]; dp[0][0] = 1; for ( int h = 1;(h <= k);h++) for ( int l = h;(l <= ((n - h) + 1));l++) dp[h][l] = (int)((((dp[h][(l - 1)] * 2L) + dp[(h - 1)][(l - 1)]) * h) % md); for ( int h = 1;(h <= k);h++) ans = ((ans + dp[h][((n - h) + 1)]) % md); System.out.println(ans); } }
4	public class E2{ static ArrayList<Integer> primes ; static int[] mind ; static final int MAXA = (int)1e7; public static void main( String[] args)throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(f.readLine());  int t = Integer.parseInt(st.nextToken()); primes = new ArrayList<>(); mind = new int[(MAXA + 1)]; for ( int i = 2;(i <= MAXA);i++) {if ( (mind[i] == 0)) {primes.add(i); mind[i] = i; } for ( int x :primes) {if ( ((x > mind[i]) || ((x * i) > MAXA))) break; mind[(x * i)] = x; }} int[] count = new int[(MAXA + 1)]; for ( int on8y = 0;(on8y < t);on8y++) {st = new StringTokenizer(f.readLine()); int n = Integer.parseInt(st.nextToken());  int k = Integer.parseInt(st.nextToken());  int[] a = new int[n]; Arrays.fill(a,1); st = new StringTokenizer(f.readLine()); for ( int i = 0;(i < n);i++) { int x = Integer.parseInt(st.nextToken());  int cnt = 0;  int last = 0; while((x > 1)){ int p = mind[x]; if ( (last == p)) cnt++; else {if ( ((cnt % 2) == 1)) a[i] *= last; last = p; cnt = 1; }x /= p; }if ( ((cnt % 2) == 1)) a[i] *= last; } int[][] mnleft = new int[n][(k + 1)]; for ( int j = 0;(j < (k + 1));j++) { int l = n;  int now = 0; for ( int i = (n - 1);(i >= 0);i--) {while((((l - 1) >= 0) && ((now + ((count[a[(l - 1)]] > 0)?1:0)) <= j))){l--; now += ((count[a[l]] > 0)?1:0); count[a[l]]++; }mnleft[i][j] = l; if ( (count[a[i]] > 1)) now--; count[a[i]]--; }} int[][] dp = new int[(n + 1)][(k + 1)]; for ( int i = 0;(i < (n + 1));i++) {Arrays.fill(dp[i],((int)1e9 + 1)); }for ( int i = 0;(i < (k + 1));i++) dp[0][i] = 0; for ( int i = 1;(i <= n);i++) {for ( int j = 0;(j <= k);j++) {if ( (j > 0)) dp[i][j] = dp[i][(j - 1)]; for ( int lst = 0;(lst <= j);lst++) {dp[i][j] = Math.min(dp[i][j],(dp[mnleft[(i - 1)][lst]][(j - lst)] + 1)); }}} int ans = ((int)1e9 + 1); for ( int c :dp[n]) ans = Math.min(ans,c); System.out.println(ans); }} }
0	public class Main{ public static void main( String[] args){ InputStream intputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(intputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(in,out); out.close(); } static class TaskA{ public void solve( InputReader in, PrintWriter out){ out.println(25); } } 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();} } }
6	public class Main implements Runnable{ int n ; double[] prob ; double[][] a ; void solve()throws IOException { n = nextInt(); a = new double[n][n]; for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < n);++j) {a[i][j] = nextDouble(); }}prob = new double[(1 << n)]; Arrays.fill(prob,0.0); prob[((1 << n) - 1)] = 1.0; for ( int i = ((1 << n) - 1);(i > 1);--i) { int c = 0; for ( int bit = 0;(bit < n);++bit) {if ( (((1 << bit) & i) > 0)) {++c; } } double k = ((c * (c - 1)) / 2.0); for ( int f = 0;(f < n);++f) {if ( (((1 << f) & i) > 0)) {for ( int s = (f + 1);(s < n);++s) {if ( (((1 << s) & i) > 0)) {prob[(i ^ (1 << f))] += ((prob[i] * a[s][f]) / k); prob[(i ^ (1 << s))] += ((prob[i] * a[f][s]) / k); } }} }}for ( int i = 0;(i < n);++i) {writer.printf(Locale.US,"%.6f ",prob[(1 << i)]); }} public static void main( String[] args)throws InterruptedException { new Thread(null,new Runnable(){public void run(){ new Main().run(); } },"1",(1 << 25)).start(); } @Override public void run(){ try{ boolean fromStandart = true; reader = new BufferedReader((fromStandart?new InputStreamReader(System.in):new FileReader(INFILE))); writer = new PrintWriter(new BufferedWriter((fromStandart?new OutputStreamWriter(System.out):new FileWriter(OUTFILE)))); tokenizer = null; solve(); writer.flush(); }catch (Exception error){ error.printStackTrace(); System.exit(1); } } static final String INFILE = "input.txt"; static final String OUTFILE = "output.txt"; BufferedReader reader ; StringTokenizer tokenizer ; PrintWriter writer ; int nextInt()throws IOException { return Integer.parseInt(nextToken());} double nextDouble()throws IOException { return Double.parseDouble(nextToken());} String nextToken()throws IOException { while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(reader.readLine()); }return tokenizer.nextToken();} }
2	public class prob1177b{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long k ,c ,n ,d ; c = 1; d = 9; n = 1; k = sc.nextLong(); while((k > (c * d))){k -= (c * d); n *= 10; d *= 10; c++; }n += ((k - 1) / c); char[] num = String.valueOf(n).toCharArray(); System.out.println(num[(int)((k - 1) % c)]); } }
2	public class CFB{ static int n ; static FastScanner in ; public static void main( String[] args)throws Exception { in = new FastScanner(System.in); n = in.nextInt(); int a = query(1); if ( ((((a % 2) + 2) % 2) == 1)) {System.out.println("! -1"); return ;} if ( (a == 0)) {System.out.println("! 1"); return ;} bins(1,((n / 2) + 1),a,-a); } static void bins( int lo, int hi, int losign, int hisign){ int mid = ((lo + hi) / 2);  int k = query(mid); if ( (k == 0)) {System.out.println(("! " + mid)); System.exit(0); } if ( (((k > 0) && (losign > 0)) || ((k < 0) && (losign < 0)))) {bins(mid,hi,k,hisign); } else {bins(lo,mid,losign,k); }} static int query( int i){ System.out.println(("? " + i)); int a1 = in.nextInt(); System.out.println(("? " + (((i + (n / 2)) > n)?(i - (n / 2)):(i + (n / 2))))); int a2 = in.nextInt(); return (a1 - a2);} static 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 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();} } }
6	public class Solution implements Runnable{ public static void main( String[] args){ new Thread(new Solution()).start(); } BufferedReader in ; PrintWriter out ; StringTokenizer st ; String nextToken()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String r = in.readLine(); if ( (r == null)) return null; st = new StringTokenizer(r); }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} int count( int q, int n){ int ans = 0; for ( int i = 0;(i < n);i++) {if ( ((q % 3) != 1)) ans++; q /= 3; }return ans;} int count2( int q, int n){ int ans = 0; for ( int i = 0;(i < n);i++) {if ( ((q % 3) == 2)) ans++; q /= 3; }return ans;} int sz ; int[] decode( int q, int n){ int[] res = new int[n]; for ( int i = 0;(i < n);i++) {res[i] = (q % 3); q /= 3; }return res;} boolean[][] precalc( int n, int m){ boolean[][] res = new boolean[sz][sz]; for ( int i = 0;(i < sz);i++) { int[] ai = decode(i,n); for ( int j = 0;(j < sz);j++) { int[] aj = decode(j,n);  boolean f = true; for ( int k = 0;((k < n) && f);k++) {if ( (aj[k] == 0)) {f = false; if ( ((k > 0) && (aj[(k - 1)] == 1))) f = true; if ( ((k < (n - 1)) && (aj[(k + 1)] == 1))) f = true; if ( (ai[k] == 1)) f = true; } if ( (f && (ai[k] == 2))) f = (aj[k] == 1); }res[i][j] = f; }}return res;} void solve()throws Exception { int n = nextInt();  int m = nextInt(); if ( (n > m)) { int t = n; n = m; m = t; } sz = 1; for ( int i = 0;(i < n);i++) sz *= 3; boolean[][] a = precalc(n,m);  int[][] d = new int[(m + 1)][sz]; Arrays.fill(d[0],-1); d[0][0] = 0; for ( int i = 1;(i <= m);i++) {Arrays.fill(d[i],-1); for ( int j = 0;(j < sz);j++) {if ( (d[(i - 1)][j] != -1)) {for ( int k = 0;(k < sz);k++) {if ( a[j][k]) {d[i][k] = Math.max(d[i][k],(d[(i - 1)][j] + count(k,n))); } }} }} int ans = 0; for ( int i = 0;(i < sz);i++) if ( (count2(i,n) == 0)) ans = Math.max(ans,d[m][i]); out.println(ans); } }
3	public class Solution{ static private int[] dx = {-1,-1,-1,0,0,1,1,1}; static private int[] dy = {-1,0,1,-1,1,-1,0,1}; public static void main( String[] args){ Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));  int r = in.nextInt();  int c = in.nextInt();  boolean[][] m = new boolean[(r + 1)][(c + 1)];  boolean[][] inp = new boolean[(r + 1)][(c + 1)]; for ( int i = 0;(i < r);i++) { String s = in.next(); for ( int j = 0;(j < s.length());j++) {if ( (s.charAt(j) == '#')) {m[i][j] = true; inp[i][j] = true; } }}for ( int i = 0;(i < r);i++) {for ( int j = 0;(j < c);j++) {if ( canPress(i,j,r,c,inp)) {for ( int k = 0;(k < 8);k++) { int xi = (i + dx[k]);  int yi = (j + dy[k]); m[xi][yi] = false; }} }} boolean isLeftAny = false; for ( int i = 0;((i < r) && !isLeftAny);i++) {for ( int j = 0;((j < c) && !isLeftAny);j++) {if ( m[i][j]) {isLeftAny = true; break;} }}if ( isLeftAny) {System.out.println("NO"); } else {System.out.println("YES"); }} static private boolean canPress( int x, int y, int r, int c, boolean[][] inp){ for ( int i = 0;(i < 8);i++) { int xi = (x + dx[i]);  int yi = (y + dy[i]); if ( ((xi < 0) || (yi < 0))) {return false;} if ( ((xi >= r) || (yi >= c))) {return false;} if ( !inp[xi][yi]) {return false;} }return true;} }
2	public class digits{ public static void main( String[] args){ long k = new Scanner(System.in).nextLong();  long league = 1;  long irrelevancy = 0; while(true){irrelevancy += (league * (Math.pow(10,league) - Math.pow(10,(league - 1)))); if ( (k > irrelevancy)) league++; else break;}irrelevancy = 0; for ( long i = 1;(i < league);i++) irrelevancy += (i * (Math.pow(10,i) - Math.pow(10,(i - 1)))); long modified_k = (k - irrelevancy);  long number = (((long)Math.pow(10,(league - 1)) - 1) + (modified_k / league)); if ( ((modified_k % league) == 0)) System.out.println((number % 10)); else {number++; long position_of_digit = (long)(modified_k % league); System.out.println(Long.toString(number).charAt(((int)position_of_digit - 1))); }} }
5	public class Solution implements Runnable{ public void solve()throws Exception { int n = sc.nextInt();  int k = sc.nextInt();  TreeSet<Integer> bad = new TreeSet<>();  int a[] = new int[n]; for ( int i = 0;(i < n);i++) a[i] = sc.nextInt(); Random rnd = new Random(); for ( int i = 1;(i < n);i++) { int j = rnd.nextInt((i + 1));  int t = a[i]; a[i] = a[j]; a[j] = t; }Arrays.sort(a); int result = 0; for ( int i = 0;(i < n);i++) {if ( !bad.contains(a[i])) {result++; long next = ((long)a[i] * k); if ( (next <= 1000000000)) bad.add((int)next); } }out.println(result); } BufferedReader in ; PrintWriter out ; FastScanner sc ; static Throwable uncaught ; public static void main( String[] args)throws Throwable { Thread t = new Thread(null,new Solution(),"",(1 << 26)); t.start(); t.join(); if ( (uncaught != null)) {throw (uncaught);} } } class FastScanner{ BufferedReader reader ; StringTokenizer strTok ; public FastScanner( BufferedReader reader){ this.reader = reader; } public String nextToken()throws IOException { while(((strTok == null) || !strTok.hasMoreTokens())){strTok = new StringTokenizer(reader.readLine()); }return strTok.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
6	public class Problem{ public static void main( String[] arg){ FastScanner scan = new FastScanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = scan.nextInt();  double ncr[][] = new double[(n + 1)][(n + 1)]; ncr[1][0] = ncr[0][1] = ncr[1][1] = 1.0; for ( int i = 2;(i <= n);i++) {for ( int j = 0;(j <= i);j++) {if ( ((j == 0) || (j == i))) ncr[i][j] = 1.0; else ncr[i][j] = (ncr[(i - 1)][j] + ncr[(i - 1)][(j - 1)]); }} double a[][] = new double[(n + 1)][(n + 1)]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) a[i][j] = scan.nextDouble(); double dp[] = new double[(1 << 19)]; dp[((1 << n) - 1)] = 1.0; for ( int state = ((1 << n) - 1);(state >= 0);state--) { int len = 0; for ( int i = 0;(i < n);i++) if ( ((state & (1 << i)) > 0)) len++; for ( int i = 0;(i < n);i++) {if ( (((1 << i) & state) == 0)) continue; for ( int j = 0;(j < i);j++) {if ( (((1 << j) & state) == 0)) continue; dp[(state & (1 << i))] += ((dp[state] * a[j][i]) / ncr[len][2]); dp[(state & (1 << j))] += ((dp[state] * a[i][j]) / ncr[len][2]); }}}for ( int i = 0;(i < n);i++) System.out.print((String.format("%.6f",dp[(1 << i)]) + " ")); out.close(); } public static long gcd( long a, long b){ if ( (b == 0)) return a; if ( (a < b)) return gcd(b,a); return gcd(b,(a % b));} static class FastScanner{ BufferedReader br ; StringTokenizer st ; FastScanner( InputStream is){ try{br = new BufferedReader(new InputStreamReader(is)); }catch (Exception e){ e.printStackTrace(); } } String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ return null;} }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} double nextDouble(){ return Double.valueOf(next());} } }
4	public class Main{ static FastReader in ; static PrintWriter out ; static Random rand = new Random(); static final int oo = ((int)1e9 + 10); static final long OO = ((long)1e18 + 10); static final int MOD = ((int)1e9 + 7); static int M ; static long[] f ,fi ,two ; static long pow( long a, long b){ long res = 1; while((b != 0)){if ( ((b & 1) == 1)) res = ((res * a) % M); a = ((a * a) % M); b >>= 1; }return res;} static long C( int n, int k){ return ((((f[n] * fi[k]) % M) * fi[(n - k)]) % M);} static void prepare( int n){ f = new long[n]; f[0] = 1; for ( int i = 1;(i < n);i++) {f[i] = ((f[(i - 1)] * i) % M); }fi = new long[n]; for ( int i = 0;(i < n);i++) {fi[i] = pow(f[i],(M - 2)); }two = new long[n]; two[0] = 1; for ( int i = 1;(i < n);i++) {two[i] = ((two[(i - 1)] * 2) % M); }} static void solve(){ int n = in.nextInt(); M = in.nextInt(); prepare((n + 10)); long[][] dp = new long[(n + 1)][n]; for ( int i = 1;(i <= n);i++) {dp[i][1] = two[(i - 1)]; }for ( int i = 1;(i <= n);i++) {for ( int j = 2;(j < n);j++) {for ( int k = 1;(k <= (i - 2));k++) {if ( (k < (j - 2))) continue; int len = ((i - k) - 1); dp[i][j] = ((dp[i][j] + ((((dp[k][(j - 1)] * two[(len - 1)]) % M) * C(((k - (j - 2)) + len),len)) % M)) % M); }}} long ans = 0; for ( int j = 1;(j < n);j++) {ans = ((ans + dp[n][j]) % M); }out.println(ans); } public static void main( String[] args){ in = new FastReader(); out = new PrintWriter(System.out); int t = 1; while((t-- > 0)){solve(); }out.flush(); out.close(); } static class FastReader{ BufferedReader br ; StringTokenizer st ; FastReader(){ this(System.in); } FastReader( String file)throws FileNotFoundException{ this(new FileInputStream(file)); } FastReader( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); } int nextInt(){ return Integer.parseInt(next());} String next(){ while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(nextLine()); }return st.nextToken();} String nextLine(){ String line ; try{line = br.readLine(); }catch (IOException e){ throw (new RuntimeException(e));} return line;} } }
6	public class E{ public static void main( String[] args){ new E(new Scanner(System.in)); } int N ,M ; int[][][] memo ; int go( int i, int j, int mask){ if ( (i == N)) return go(0,(j + 1),mask); if ( (j == M)) { int mm = (mask % (1 << N)); if ( (mm != ((1 << N) - 1))) return (N * M); return 0;} if ( (memo[i][j][mask] != -1)) return memo[i][j][mask]; int nMask = mask;  int prevMask = 0; if ( (i > 0)) prevMask = (1 << (N - 1));  int nextMask = 0; if ( (i < (N - 1))) nextMask = (1 << (N + 1));  int curMask = (1 << N);  int nextRowMask = (1 << (N + N)); nMask = ((((nMask | prevMask) | nextMask) | curMask) | nextRowMask); nMask = (nMask / 2); int res = (1 + go((i + 1),j,nMask));  int pr = (mask % 2); if ( (pr == 1)) { int rr = go((i + 1),j,(mask / 2)); if ( (rr < res)) res = rr; } memo[i][j][mask] = res; return res;} public E( Scanner in){ int[] vals = new int[2]; vals[0] = in.nextInt(); vals[1] = in.nextInt(); Arrays.sort(vals); N = vals[0]; M = vals[1]; memo = new int[N][M][(1 << ((N + N) + 1))]; fill3(memo,-1); int r1 = go(0,0,((1 << N) - 1));  int res = ((N * M) - r1); System.out.printf("%d%n",res); } void fill3( int[][][] vvv, int val){ for ( int[][] vv :vvv) for ( int[] v :vv) Arrays.fill(v,val); } }
2	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);  BTheHat solver = new BTheHat(); solver.solve(1,in,out); out.close(); } static class BTheHat{ PrintWriter out ; InputReader in ; int n ; public void solve( int testNumber, InputReader in, PrintWriter out){ this.out = out; this.in = in; n = in.NextInt(); int desiredPair = -1;  int result = query(1); if ( (result != 0)) { int l = 2,r = (1 + (n / 2)); while((l < r)){ int m = ((l + r) / 2);  int mRes = query(m); if ( (mRes == 0)) {desiredPair = m; break;} else if ( (mRes == result)) {l = (m + 1); } else {r = m; }}} else {desiredPair = 1; }out.println(("! " + desiredPair)); } private int query( int i){ int iV = queryValue(i);  int iN2V = queryValue((i + (n / 2))); if ( (iV < iN2V)) {return -1;} else if ( (iV > iN2V)) {return 1;} return 0;} private int queryValue( int i){ out.println(("? " + i)); out.flush(); return in.NextInt();} } static class InputReader{ BufferedReader reader ; 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()," \t\n\r\f,"); }catch (IOException e){ throw (new RuntimeException(e));} }return tokenizer.nextToken();} public int NextInt(){ return Integer.parseInt(next());} } }
6	public class C{ static int[] dx = new int[]{0,1,0,-1,0}; static int[] dy = new int[]{0,0,-1,0,1}; static int[][] g ; static int ans ; static void fill(){ cache[1][1] = 0; cache[1][1] = 0; cache[2][1] = 1; cache[1][2] = 1; cache[2][2] = 2; cache[2][2] = 2; cache[3][1] = 2; cache[1][3] = 2; cache[3][2] = 4; cache[2][3] = 4; cache[3][3] = 6; cache[3][3] = 6; cache[4][1] = 2; cache[1][4] = 2; cache[4][2] = 5; cache[2][4] = 5; cache[4][3] = 8; cache[3][4] = 8; cache[4][4] = 12; cache[4][4] = 12; cache[5][1] = 3; cache[1][5] = 3; cache[5][2] = 7; cache[2][5] = 7; cache[5][3] = 11; cache[3][5] = 11; cache[5][4] = 14; cache[4][5] = 14; cache[5][5] = 18; cache[5][5] = 18; cache[6][1] = 4; cache[1][6] = 4; cache[6][2] = 8; cache[2][6] = 8; cache[6][3] = 13; cache[3][6] = 13; cache[6][4] = 17; cache[4][6] = 17; cache[6][5] = 22; cache[5][6] = 22; cache[6][6] = 26; cache[6][6] = 26; cache[7][1] = 4; cache[1][7] = 4; cache[7][2] = 10; cache[2][7] = 10; cache[7][3] = 15; cache[3][7] = 15; cache[7][4] = 21; cache[4][7] = 21; cache[7][5] = 26; cache[5][7] = 26; cache[8][1] = 5; cache[1][8] = 5; cache[8][2] = 11; cache[2][8] = 11; cache[8][3] = 17; cache[3][8] = 17; cache[8][4] = 24; cache[4][8] = 24; cache[8][5] = 29; cache[5][8] = 29; cache[9][1] = 6; cache[1][9] = 6; cache[9][2] = 13; cache[2][9] = 13; cache[9][3] = 20; cache[3][9] = 20; cache[9][4] = 26; cache[4][9] = 26; cache[10][1] = 6; cache[1][10] = 6; cache[10][2] = 14; cache[2][10] = 14; cache[10][3] = 22; cache[3][10] = 22; cache[10][4] = 30; cache[4][10] = 30; cache[11][1] = 7; cache[1][11] = 7; cache[11][2] = 16; cache[2][11] = 16; cache[11][3] = 24; cache[3][11] = 24; cache[12][1] = 8; cache[1][12] = 8; cache[12][2] = 17; cache[2][12] = 17; cache[12][3] = 26; cache[3][12] = 26; cache[13][1] = 8; cache[1][13] = 8; cache[13][2] = 19; cache[2][13] = 19; cache[13][3] = 29; cache[3][13] = 29; cache[14][1] = 9; cache[1][14] = 9; cache[14][2] = 20; cache[2][14] = 20; cache[15][1] = 10; cache[1][15] = 10; cache[15][2] = 22; cache[2][15] = 22; cache[16][1] = 10; cache[1][16] = 10; cache[16][2] = 23; cache[2][16] = 23; cache[17][1] = 11; cache[1][17] = 11; cache[17][2] = 25; cache[2][17] = 25; cache[18][1] = 12; cache[1][18] = 12; cache[18][2] = 26; cache[2][18] = 26; cache[19][1] = 12; cache[1][19] = 12; cache[19][2] = 28; cache[2][19] = 28; cache[20][1] = 13; cache[1][20] = 13; cache[20][2] = 29; cache[2][20] = 29; cache[21][1] = 14; cache[1][21] = 14; cache[22][1] = 14; cache[1][22] = 14; cache[23][1] = 15; cache[1][23] = 15; cache[24][1] = 16; cache[1][24] = 16; cache[25][1] = 16; cache[1][25] = 16; cache[26][1] = 17; cache[1][26] = 17; cache[27][1] = 18; cache[1][27] = 18; cache[28][1] = 18; cache[1][28] = 18; cache[29][1] = 19; cache[1][29] = 19; cache[30][1] = 20; cache[1][30] = 20; cache[31][1] = 20; cache[1][31] = 20; cache[32][1] = 21; cache[1][32] = 21; cache[33][1] = 22; cache[1][33] = 22; cache[34][1] = 22; cache[1][34] = 22; cache[35][1] = 23; cache[1][35] = 23; cache[36][1] = 24; cache[1][36] = 24; cache[37][1] = 24; cache[1][37] = 24; cache[38][1] = 25; cache[1][38] = 25; cache[39][1] = 26; cache[1][39] = 26; cache[40][1] = 26; cache[1][40] = 26; } static void go( int n, int m, long used, long left){ if ( (left == 0)) {ans = max(ans,((n * m) - Long.bitCount(used))); return ;} if ( (((n * m) - Long.bitCount(used)) <= ans)) return ; int who = Long.numberOfTrailingZeros(left); for ( int w :g[who]) { long nused = (used | (1L << w));  long nleft = left; for ( int v :g[w]) {nleft &= (1L << v); }go(n,m,nused,nleft); }} static int[][] cache ; public static void main( String[] args){ try{in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); cache = new int[41][41]; fill(); int n = nextInt();  int m = nextInt(); out.println(cache[n][m]); out.close(); }catch (Throwable e){ e.printStackTrace(); System.exit(1); } } static BufferedReader in ; static PrintWriter out ; static StringTokenizer tok ; static long launchTimer ; static boolean hasMoreTokens()throws IOException { while(((tok == null) || !tok.hasMoreTokens())){ String line = in.readLine(); if ( (line == null)) {return false;} tok = new StringTokenizer(line); }return true;} static String next()throws IOException { return (hasMoreTokens()?tok.nextToken():null);} static int nextInt()throws IOException { return Integer.parseInt(next());} }
6	public class x1209E{ public static void main( String[] hi)throws Exception { BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(infile.readLine());  int T = Integer.parseInt(st.nextToken());  StringBuilder sb = new StringBuilder(); while((T-- > 0)){st = new StringTokenizer(infile.readLine()); int N = Integer.parseInt(st.nextToken());  int M = Integer.parseInt(st.nextToken());  int[][] grid = new int[N][M]; for ( int r = 0;(r < N);r++) grid[r] = readArr(M,infile,st); ArrayList<Integer> ls = new ArrayList<Integer>(); for ( int i = 0;(i < M);i++) ls.add(i); Collections.sort(ls,(x,y)->{ int m1 = grid[0][x];  int m2 = grid[0][y]; for ( int r = 1;(r < N);r++) {m1 = max(m1,grid[r][x]); m2 = max(m2,grid[r][y]); }return (m2 - m1);}); int[][] newgrid = new int[N][M]; for ( int r = 0;(r < N);r++) for ( int c = 0;(c < M);c++) newgrid[r][c] = grid[r][ls.get(c)]; M = min(M,N); int[][] sums = new int[M][(1 << N)]; for ( int i = 1;(i < M);i++) for ( int mask = 0;(mask < (1 << N));mask++) {for ( int head = 0;(head < N);head++) { int temp = 0; for ( int b = 0;(b < N);b++) { int nb = (b + head); if ( (nb >= N)) nb -= N; if ( ((mask & (1 << nb)) > 0)) temp += newgrid[b][i]; }sums[i][mask] = max(sums[i][mask],temp); }} int[][] dp = new int[M][(1 << N)]; for ( int mask = 0;(mask < (1 << N));mask++) for ( int b = 0;(b < N);b++) if ( ((mask & (1 << b)) > 0)) dp[0][mask] += newgrid[b][0]; for ( int i = 1;(i < M);i++) for ( int mask = 0;(mask < (1 << N));mask++) for ( int pmask = mask;(pmask >= 0);pmask = ((pmask - 1) & mask)) {dp[i][mask] = max(dp[i][mask],(dp[(i - 1)][pmask] + sums[i][(mask - pmask)])); if ( (pmask == 0)) break; }sb.append((dp[(M - 1)][((1 << N) - 1)] + "\n")); }System.out.print(sb); } public static int[] readArr( int N, BufferedReader infile, StringTokenizer st)throws Exception { int[] arr = new int[N]; st = new StringTokenizer(infile.readLine()); for ( int i = 0;(i < N);i++) arr[i] = Integer.parseInt(st.nextToken()); return arr;} }
3	public class MainG{ static StdIn in = new StdIn(); static PrintWriter out = new PrintWriter(System.out); static long M = ((long)1e9 + 7); static int n ,dig ; static int[] x ; static long[] p10 ,s ; static long[][][] dp ; public static void main( String[] args){ char[] cs = in.next().toCharArray(); n = cs.length; x = new int[n]; for ( int i = 0;(i < n);++i) x[i] = (cs[i] - '0'); p10 = new long[n]; p10[0] = 1; for ( int i = 1;(i < n);++i) p10[i] = ((p10[(i - 1)] * 10) % M); s = new long[(n + 1)]; s[n] = 1; for ( int i = (n - 1);(i >= 0);--i) s[i] = ((s[(i + 1)] + (x[i] * p10[((n - 1) - i)])) % M); long ans = 0; dp = new long[2][n][(n + 1)]; for ( dig = 1;(dig <= 9);++dig) {for ( int i = 0;(i < n);++i) {Arrays.fill(dp[0][i],-1); Arrays.fill(dp[1][i],-1); }for ( int i = 1;(i <= n);++i) ans = ((ans + (p10[(i - 1)] * dp(0,0,i))) % M); }out.println(ans); out.close(); } static long dp( int less, int ignore, int need){ if ( (need == 0)) return ((less == 1)?p10[(n - ignore)]:s[ignore]); if ( (ignore == n)) return 0; if ( (dp[less][ignore][need] != -1)) return dp[less][ignore][need]; long res = 0;  int lim = ((less == 1)?9:x[ignore]); for ( int i = 0;(i <= lim);++i) res = (res + dp((less | ((i < lim)?1:0)),(ignore + 1),(need - ((i >= dig)?1:0)))); res %= M; return dp[less][ignore][need] = res;} interface Input{ public String next(); ; public int nextInt(); public long nextLong(); ; } static class StdIn implements Input{ private final int BUFFER_SIZE = (1 << 16); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ,bytesRead ; public StdIn(){ din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public StdIn( InputStream in){ try{din = new DataInputStream(in); }catch (Exception e){ throw (new RuntimeException());} buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String next(){ int c ; while((((c = read()) != -1) && (((c == ' ') || (c == '\n')) || (c == '\r')))); StringBuilder s = new StringBuilder(); while((c != -1)){if ( (((c == ' ') || (c == '\n')) || (c == '\r'))) break; s.append((char)c); c = read(); }return s.toString();} public int nextInt(){ 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(){ 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;} private void fillBuffer()throws IOException { bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) buffer[0] = -1; } private byte read(){ try{if ( (bufferPointer == bytesRead)) fillBuffer(); return buffer[bufferPointer++]; }catch (IOException e){ throw (new RuntimeException());} } public void close()throws IOException { if ( (din == null)) return ; din.close(); } } }
6	public class Main16E{ private FastScanner in ; private PrintWriter out ; public void solve()throws IOException { int n = in.nextInt();  double[][] a = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {a[i][j] = in.nextDouble(); }} int k = (1 << n);  double[] p = new double[k];  int[][] b = new int[(n + 1)][]; for ( int i = 0;(i <= n);i++) {b[i] = new int[comb(i,n)]; } int[] bl = new int[(n + 1)]; for ( int i = 0;(i < k);i++) { int c = c2(i); b[c][bl[c]] = i; bl[c]++; }p[(k - 1)] = 1; for ( int i = n;(i >= 2);i--) {for ( int j = 0;(j < b[i].length);j++) { int t = b[i][j];  double pm = 1; pm /= ((i * (i - 1)) / 2); for ( int x = 0;(x < n);x++) {for ( int y = (x + 1);(y < n);y++) {if ( (((t & (1 << x)) > 0) && ((t & (1 << y)) > 0))) {p[(t & (1 << x))] += ((p[t] * pm) * a[y][x]); p[(t & (1 << y))] += ((p[t] * pm) * a[x][y]); } }}}}for ( int i = 0;(i < n);i++) {out.print((p[(1 << i)] + " ")); }} int comb( int n, int m){ int res = 1; for ( int i = 1;(i <= n);i++) {res = (res * ((m - i) + 1)); res /= i; }return res;} int c2( int k){ int res = 0; while((k > 0)){if ( ((k % 2) == 1)) {res++; } k /= 2; }return res;} public void run(){ try{in = new FastScanner(System.in); out = new PrintWriter(System.out); solve(); out.close(); }catch (IOException e){ e.printStackTrace(); } } class FastScanner{ BufferedReader br ; StringTokenizer st ; FastScanner( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); } String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} double nextDouble(){ return Double.parseDouble(next());} } public static void main( String[] arg){ new Main16E().run(); } }
1	public class TaxiDriversAndLyft2{ public static void main( String[] args){ Scanner scanner = new Scanner(System.in);  long n = scanner.nextLong();  long m = scanner.nextLong();  long[] people = new long[(int)(n + m)];  int[] taxiDrivers = new int[(int)(n + m)]; for ( int i = 0;(i < (n + m));i++) {people[i] = scanner.nextLong(); }for ( int i = 0;(i < (n + m));i++) {taxiDrivers[i] = scanner.nextInt(); } int lastTaxiDriverIndex = -1;  long[] riderCountArray = new long[(int)m];  long[] a1 = new long[(int)n];  long[] b1 = new long[(int)m];  int j = 0,k = 0; for ( int i = 0;(i < (n + m));i++) {if ( (taxiDrivers[i] == 0)) {a1[j] = people[i]; j++; } else {b1[k] = people[i]; k++; }} int l = 0,q = 0; for ( int i = 0;(i < j);i++) {while((((l < (m - 1)) && (m > 1)) && (Math.abs((a1[i] - b1[l])) > Math.abs((a1[i] - b1[(l + 1)]))))){l++; }riderCountArray[l]++; }for ( int i = 0;(i < m);i++) {System.out.print((riderCountArray[i] + " ")); }} }
3	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);  TaskD solver = new TaskD(); solver.solve(1,in,out); out.close(); } static class TaskD{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.readInt();  int[] a = in.readIntArray(n);  int[][] sol = new int[n][n]; for ( int i = 0;(i < n);i++) {sol[0][i] = a[i]; }for ( int i = 1;(i < n);i++) {for ( int j = 0;(j < (n - i));j++) {sol[i][j] = (sol[(i - 1)][j] ^ sol[(i - 1)][(j + 1)]); }}for ( int i = 1;(i < n);i++) {for ( int j = 0;(j < (n - i));j++) {sol[i][j] = Math.max(sol[i][j],Math.max(sol[(i - 1)][j],sol[(i - 1)][(j + 1)])); }} int q = in.readInt(); for ( int i = 0;(i < q);i++) { int l = (in.readInt() - 1);  int r = (in.readInt() - 1); out.println(sol[(r - l)][l]); }} } static class InputReader{ private final InputStream stream ; private final byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read(){ try{if ( (curChar >= numChars)) {curChar = 0; numChars = stream.read(buf); if ( (numChars <= 0)) return -1; } }catch (IOException e){ throw (new RuntimeException(e));} return buf[curChar++];} public int readInt(){ return (int)readLong();} public long readLong(){ int c = read(); while(isSpaceChar(c)){c = read(); if ( (c == -1)) throw (new RuntimeException()); } boolean negative = false; if ( (c == '-')) {negative = true; 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 (negative?res:res);} public int[] readIntArray( int size){ int[] arr = new int[size]; for ( int i = 0;(i < size);i++) arr[i] = readInt(); return arr;} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
2	public class Main{ static ArrayList<BigInteger> bs = new ArrayList<>(); static void getBs( int n, BigInteger k){ BigInteger four = BigInteger.valueOf(4);  BigInteger tmp4 = BigInteger.valueOf(1);  BigInteger sum = BigInteger.ZERO; for ( int i = 1;(i <= n);i++) {sum = sum.add(tmp4); bs.add(sum); if ( (sum.compareTo(k) >= 0)) break; tmp4 = tmp4.multiply(four); }} static int ss( int n, BigInteger k){ bs = new ArrayList<>(); BigInteger two = BigInteger.valueOf(2);  BigInteger s1 ;  BigInteger ts = BigInteger.ZERO; getBs((n - 1),k); int idx = (bs.size() - 1);  BigInteger tx = BigInteger.valueOf(-1);  int ans = -1; for ( int i = 1;(i <= n);i++) {two = two.shiftLeft(1); s1 = two.add(BigInteger.valueOf((-i - 2))); if ( (idx >= 0)) {tx = tx.add(BigInteger.ONE).multiply(BigInteger.valueOf(2)).add(BigInteger.ONE); ts = ts.add(tx.multiply(bs.get(idx--))); } if ( (k.compareTo(s1) >= 0)) {if ( (k.subtract(s1).compareTo(ts) <= 0)) {ans = (n - i); break;} } }return ans;} public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int T = sc.nextInt(); while((T-- > 0)){ int n = sc.nextInt();  BigInteger k = sc.nextBigInteger();  int ans = ss(n,k); if ( (ans == -1)) {System.out.println("NO"); } else {System.out.println(("YES " + ans)); }}} }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  int r = in.nextInt();  int[] x = new int[n]; for ( int i = 0;(i < n);i++) {x[i] = in.nextInt(); } double res = 0;  double[] y = new double[n]; for ( int i = 0;(i < n);i++) { double curY = r; for ( int j = 0;(j < i);j++) { int d = Math.abs((x[i] - x[j])); if ( (d <= (2 * r))) { int a2 = (((4 * r) * r) - (d * d)); curY = Math.max(curY,(y[j] + Math.sqrt(a2))); } }y[i] = curY; out.printf("%.14f",y[i]); if ( (i < (n - 1))) {out.print(" "); } else {out.println(); }}} } static class InputReader{ final InputStream is ; final byte[] buf = new byte[1024]; int pos ; int size ; public InputReader( InputStream is){ this.is = is; } public int nextInt(){ int c = read(); while(isWhitespace(c))c = read(); int sign = 1; if ( (c == '-')) {sign = -1; c = read(); } int res = 0; do {if ( ((c < '0') || (c > '9'))) throw (new InputMismatchException()); res = (((res * 10) + c) - '0'); c = read(); }while(!isWhitespace(c));return (res * sign);} int read(){ if ( (size == -1)) throw (new InputMismatchException()); if ( (pos >= size)) {pos = 0; try{size = is.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (size <= 0)) return -1; } return (buf[pos++] & 255);} static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
2	public class B_Round_371_Div1{ public static long MOD = 1000000007; static int c = 0; public static void main( String[] args)throws FileNotFoundException { Scanner in = new Scanner();  int n = in.nextInt();  int minX = -1;  int start = 1;  int end = n; c = 0; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((("? " + mid) + " 1 ") + n) + " ") + n)); System.out.flush(); int v = in.nextInt(); if ( (v == 2)) {minX = mid; start = (mid + 1); } else {end = (mid - 1); }} int maxX = -1; start = minX; end = n; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((("? " + minX) + " 1 ") + mid) + " ") + n)); System.out.flush(); int v = in.nextInt(); if ( (v == 2)) {maxX = mid; end = (mid - 1); } else {start = (mid + 1); }} int minY = -1; start = 1; end = n; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + mid) + " ") + maxX) + " ") + n)); System.out.flush(); int v = in.nextInt(); if ( (v == 2)) {minY = mid; start = (mid + 1); } else {end = (mid - 1); }} int maxY = -1; start = minY; end = n; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + minY) + " ") + maxX) + " ") + mid)); System.out.flush(); int v = in.nextInt(); if ( (v == 2)) {maxY = mid; end = (mid - 1); } else {start = (mid + 1); }} int middleMinX = maxX; start = minX; end = maxX; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + minY) + " ") + mid) + " ") + maxY)); System.out.flush(); int v = in.nextInt(); if ( (v == 1)) {middleMinX = mid; end = (mid - 1); } else {start = (mid + 1); }} int middleMaxX = -1; start = (middleMinX + 1); end = maxX; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + mid) + " ") + minY) + " ") + maxX) + " ") + maxY)); System.out.flush(); int v = in.nextInt(); if ( (v == 1)) {middleMaxX = mid; start = (mid + 1); } else {end = (mid - 1); }}if ( (middleMaxX == -1)) { int middleMinY = -1; start = minY; end = maxY; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + minY) + " ") + maxX) + " ") + mid)); System.out.flush(); int v = in.nextInt(); if ( (v == 1)) {middleMinY = mid; end = (mid - 1); } else {start = (mid + 1); }} int middleMaxY = -1; start = (middleMinY + 1); end = maxY; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + mid) + " ") + maxX) + " ") + maxY)); System.out.flush(); int v = in.nextInt(); if ( (v == 1)) {middleMaxY = mid; start = (mid + 1); } else {end = (mid - 1); }}if ( (minX == maxX)) {System.out.println(((((((((((((((("! " + minX) + " ") + minY) + " ") + maxX) + " ") + middleMinY) + " ") + minX) + " ") + middleMaxY) + " ") + maxX) + " ") + maxY)); System.out.flush(); } else { int[] a = calX(minX,maxX,minY,middleMinY,in);  int[] b = calX(minX,maxX,middleMaxY,maxY,in); check(a); check(b); System.out.println(((((((((((((((("! " + a[0]) + " ") + minY) + " ") + a[1]) + " ") + middleMinY) + " ") + b[0]) + " ") + middleMaxY) + " ") + b[1]) + " ") + maxY)); System.out.flush(); }} else if ( (minY == maxY)) {System.out.println(((((((((((((((("! " + minX) + " ") + minY) + " ") + middleMinX) + " ") + maxY) + " ") + middleMaxX) + " ") + minY) + " ") + maxX) + " ") + maxY)); System.out.flush(); } else { int[] a = calY(minX,middleMinX,minY,maxY,in);  int[] b = calY(middleMaxX,maxX,minY,maxY,in); check(a); check(b); System.out.println(((((((((((((((("! " + minX) + " ") + a[0]) + " ") + middleMinX) + " ") + a[1]) + " ") + middleMaxX) + " ") + b[0]) + " ") + maxX) + " ") + b[1])); System.out.flush(); }} static void check( int[] v){ if ( ((v[0] == -1) || (v[1] == -1))) {throw (new NullPointerException());} } static int increaseC( int c){ if ( (c == 200)) {throw (new NullPointerException());} return (c + 1);} public static int[] calY( int minX, int maxX, int minY, int maxY, Scanner in){ c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + minY) + " ") + maxX) + " ") + (maxY - 1))); System.out.flush(); int v = in.nextInt(); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + (minY + 1)) + " ") + maxX) + " ") + maxY)); System.out.flush(); int o = in.nextInt(); if ( ((v == 1) && (o == 1))) { int a = -1;  int start = minY;  int end = maxY; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + minY) + " ") + maxX) + " ") + mid)); System.out.flush(); if ( (in.nextInt() == 1)) {a = mid; end = (mid - 1); } else {start = (mid + 1); }} int b = -1; start = minY; end = a; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + mid) + " ") + maxX) + " ") + a)); System.out.flush(); if ( (in.nextInt() == 1)) {b = mid; start = (mid + 1); } else {end = (mid - 1); }}return new int[]{b,a};} else if ( (v == 1)) { int a = -1;  int start = minY;  int end = maxY; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + minY) + " ") + maxX) + " ") + mid)); System.out.flush(); if ( (in.nextInt() == 1)) {a = mid; end = (mid - 1); } else {start = (mid + 1); }}return new int[]{minY,a};} else if ( (o == 1)) { int b = -1;  int start = minY;  int end = maxY; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + mid) + " ") + maxX) + " ") + maxY)); System.out.flush(); if ( (in.nextInt() == 1)) {b = mid; start = (mid + 1); } else {end = (mid - 1); }}return new int[]{b,maxY};} else {return new int[]{minY,maxY};}} public static int[] calX( int minX, int maxX, int minY, int maxY, Scanner in){ c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + minY) + " ") + (maxX - 1)) + " ") + maxY)); System.out.flush(); int v = in.nextInt(); c = increaseC(c); System.out.println(((((((("? " + (minX + 1)) + " ") + minY) + " ") + maxX) + " ") + maxY)); System.out.flush(); int o = in.nextInt(); if ( ((v == 1) && (o == 1))) { int a = -1;  int start = minX;  int end = maxX; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + minY) + " ") + mid) + " ") + maxY)); System.out.flush(); if ( (in.nextInt() == 1)) {a = mid; end = (mid - 1); } else {start = (mid + 1); }} int b = -1; start = minX; end = a; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + mid) + " ") + minY) + " ") + a) + " ") + maxY)); System.out.flush(); if ( (in.nextInt() == 1)) {b = mid; start = (mid + 1); } else {end = (mid - 1); }}return new int[]{b,a};} else if ( (v == 1)) { int a = -1;  int start = minX;  int end = maxX; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + minX) + " ") + minY) + " ") + mid) + " ") + maxY)); System.out.flush(); if ( (in.nextInt() == 1)) {a = mid; end = (mid - 1); } else {start = (mid + 1); }}return new int[]{minX,a};} else if ( (o == 1)) { int b = -1;  int start = minX;  int end = maxX; while((start <= end)){ int mid = ((start + end) >> 1); c = increaseC(c); System.out.println(((((((("? " + mid) + " ") + minY) + " ") + maxX) + " ") + maxY)); System.out.flush(); if ( (in.nextInt() == 1)) {b = mid; start = (mid + 1); } else {end = (mid - 1); }}return new int[]{b,maxX};} else {return new int[]{minX,maxX};}} 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, long MOD){ if ( (b == 0)) {return 1;} if ( (b == 1)) {return a;} long val = pow(a,(b / 2),MOD); 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{ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ throw (new RuntimeException());} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
0	public class A{ static void solve( InputReader in, PrintWriter out){ long n = in.nextLong(); out.print(25); } public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream); solve(in,out); out.close(); } 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 long nextLong(){ return Long.parseLong(next());} } }
4	public class GeorgeAndInterestingGraph{ public static void main( String[] args){ MyScanner sc = new MyScanner();  int N = sc.nextInt();  int M = sc.nextInt();  int[] edgeFrom = new int[M];  int[] edgeTo = new int[M]; for ( int i = 0;(i < M);i++) {edgeFrom[i] = sc.nextInt(); edgeTo[i] = sc.nextInt(); } int best = Integer.MAX_VALUE;  boolean[][] adjMat = makeAdjMat(N,edgeFrom,edgeTo); for ( int i = 0;(i < N);i++) { boolean[][] mat = copyOfArray2d(adjMat); best = Math.min(best,count(mat,M,i)); }System.out.println(best); } public static boolean[][] copyOfArray2d( boolean[][] arr){ int N = arr.length;  int M = arr[0].length;  boolean[][] copy = new boolean[N][M]; for ( int i = 0;(i < N);i++) {System.arraycopy(arr[i],0,copy[i],0,M); }return copy;} public static int count( boolean[][] mat, int M, int center){ int N = mat.length;  int cntWithI = (mat?1:0); for ( int i = 0;(i < N);i++) {if ( (i != center)) {if ( mat[i][center]) {cntWithI++; } if ( mat[center][i]) {cntWithI++; } } mat[i][center] = false; mat[center][i] = false; } int other = (M - cntWithI);  int matches = bipartiteMatching(mat); return ((((((((2 * N) - 1) - cntWithI) + other) - matches) + N) - 1) - matches);} public static boolean[][] makeAdjMat( int N, int[] edgeFrom, int[] edgeTo){ boolean[][] mat = new boolean[N][N]; for ( int i = 0;(i < edgeFrom.length);i++) { int from = (edgeFrom[i] - 1);  int to = (edgeTo[i] - 1); mat[from][to] = true; }return mat;} public static boolean fordFulkersonHelper( int[][] resid, int s, int t, int[] parent){ int V = resid.length;  boolean[] visited = new boolean[V];  LinkedList<Integer> q = new LinkedList<Integer>(); q.push(s); visited[s] = true; parent[s] = -1; while(!q.isEmpty()){ int u = q.pop(); for ( int v = 0;(v < V);v++) {if ( (!visited[v] && (resid[u][v] > 0))) {q.push(v); parent[v] = u; visited[v] = true; } }}return visited[t];} public static boolean bipartiteMatchingHelper( boolean[][] bpGraph, int u, boolean[] seen, int[] matchR){ int N = bpGraph[0].length; for ( int v = 0;(v < N);v++) {if ( (bpGraph[u][v] && !seen[v])) {seen[v] = true; if ( ((matchR[v] < 0) || bipartiteMatchingHelper(bpGraph,matchR[v],seen,matchR))) {matchR[v] = u; return true;} } }return false;} public static int bipartiteMatching( boolean[][] bpGraph, int[] matchIJ, int[] matchJI){ int ans = bipartiteMatching(bpGraph,matchJI); for ( int i = 0;(i < matchJI.length);i++) {matchIJ[i] = -1; }for ( int j = 0;(j < matchJI.length);j++) { int i = matchJI[j]; if ( (i >= 0)) {matchIJ[i] = j; } }return ans;} public static int bipartiteMatching( boolean[][] bpGraph, int[] matchJI){ int M = bpGraph.length;  int N = bpGraph[0].length; for ( int i = 0;(i < N);i++) {matchJI[i] = -1; } int ans = 0; for ( int u = 0;(u < M);u++) { boolean[] seen = new boolean[N]; if ( bipartiteMatchingHelper(bpGraph,u,seen,matchJI)) {ans++; } }return ans;} public static int bipartiteMatching( boolean[][] bpGraph){ int N = bpGraph[0].length;  int[] matchJI = new int[N]; return bipartiteMatching(bpGraph,matchJI);} public static int bipartiteMatching( int[][] intGraph){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph);} public static int bipartiteMatching( int[][] intGraph, int[] matchJI){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph,matchJI);} public static int bipartiteMatching( int[][] intGraph, int[] matchIJ, int[] matchJI){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph,matchIJ,matchJI);} public static boolean[][] intToBooleanAdjMat( int[][] mat){ int M = mat.length;  int N = mat[0].length;  boolean[][] bMat = new boolean[M][N]; for ( int i = 0;(i < M);i++) {for ( int j = 0;(j < N);j++) {bMat[i][j] = (mat[i][j] != 0); }}return bMat;} public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } int nextInt(){ return Integer.parseInt(next());} String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} } }
2	public class Main{ static BufferedReader f ; static StringTokenizer st ; public static void main( String[] args)throws Exception { f = new BufferedReader(new java.io.InputStreamReader(System.in)); long unixTime = System.currentTimeMillis();  long l = nextLong();  long r = nextLong();  String ll = Long.toBinaryString(l);  String rr = Long.toBinaryString(r); System.err.println(ll); System.err.println(rr); System.err.println(Long.parseLong(rr,2)); int len = 0; if ( (ll.length() != rr.length())) {len = Math.max(ll.length(),rr.length()); } else {for ( int i = 0;(i < ll.length());i++) {if ( (ll.charAt(i) != rr.charAt(i))) {len = (ll.length() - i); break;} }}System.err.println(len); StringBuffer s = new StringBuffer(); for ( int i = 0;(i < len);i++) {s.append(1); }if ( (len == 0)) {System.out.println(0); } else {System.out.println(Long.parseLong(s.toString(),2)); }System.exit(0); } static long nextLong()throws Exception { return Long.parseLong(next());} static String next()throws Exception { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(f.readLine()); }return st.nextToken();} }
6	public class Main{ static int N ; static int K ; static int A ; static double dl[] ; static int base[] ; static int needed ; static int b[] = new int[N]; static int l[] = new int[N]; static double best ; static void giveCandies( int i, int remaining){ if ( (remaining == 0)) {check(); return ;} if ( (i == N)) {check(); return ;} int j ;  double ns ;  double orig = dl[i]; for ( j = 0;(j <= remaining);j++) {ns = (orig + (j * 0.1)); if ( (ns <= 1.0)) {dl[i] = ns; giveCandies((i + 1),(remaining - j)); dl[i] = orig; } else {break;}}} static void check(){ int i ,j ,k ;  double res = 0.0;  int total ;  double prob ;  int max = (1 << N);  double sumg ,sumb ;  double pk ,da = (double)A; for ( k = 0;(k < max);k++) {prob = 1.0; total = 0; sumg = 0; sumb = 0; for ( i = 0;(i < N);i++) {if ( ((base[i] & k) > 0)) {prob *= dl[i]; total++; sumg += b[i]; } else {prob *= (1.0 - dl[i]); sumb += b[i]; }}if ( (total >= needed)) {res += prob; } else {pk = (da / (da + sumb)); res += (prob * pk); }}best = Math.max(best,res); } public static void main( String[] args)throws Exception { int i ,j ,k ;  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine()); N = Integer.parseInt(st.nextToken()); K = Integer.parseInt(st.nextToken()); A = Integer.parseInt(st.nextToken()); needed = ((N / 2) + 1); b = new int[N]; l = new int[N]; dl = new double[N]; for ( i = 0;(i < N);i++) {st = new StringTokenizer(br.readLine()); b[i] = Integer.parseInt(st.nextToken()); l[i] = Integer.parseInt(st.nextToken()); dl[i] = ((double)l[i] / 100.0); }base = new int[8]; base[0] = 1; for ( i = 1;(i < N);i++) {base[i] = (base[(i - 1)] * 2); }best = 0.0; giveCandies(0,K); DecimalFormat df = new DecimalFormat("0.0000000000");  String rs = df.format(best);  String mrs = ""; for ( i = 0;(i < rs.length());i++) {if ( (rs.charAt(i) == ',')) {mrs += '.'; } else {mrs += rs.charAt(i); }}System.out.println(mrs); } }
6	public class Main{ public void run(){ Locale.setDefault(Locale.US); Scanner in = new Scanner(System.in);  int n = in.nextInt();  double a[][] = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) a[i][j] = in.nextDouble(); double f[] = new double[(1 << n)]; f[((1 << n) - 1)] = 1; for ( int mask = ((1 << n) - 1);(mask > 0);mask--) { int k = Integer.bitCount(mask); if ( (k == 1)) continue; for ( int i = 0;(i < n);i++) {if ( ((mask & (1 << i)) > 0)) {for ( int j = 0;(j < n);j++) {if ( ((mask & (1 << j)) > 0)) {f[(mask & (1 << j))] += ((f[mask] * a[i][j]) / ((k * (k - 1)) / 2)); } }} }}for ( int i = 0;(i < n);i++) System.out.print((f[(1 << i)] + " ")); } public static void main( String[] args){ new Main().run(); } }
2	public class cf1177b{ public static void main( String[] args)throws IOException { long k = rl(),n = -1; for ( long l = 0,r = k;(l <= r);) { long m = (l + ((r - l) / 2)); if ( (f(m) < k)) {n = (m + 1); l = (m + 1); } else {r = (m - 1); }}k -= f((n - 1)); char[] s = Long.toString(n).toCharArray(); prln(s[((int)k - 1)]); close(); } static long f( long x){ if ( (x < 10)) {return x;} long pow10 = 1,cnt = 1; while((x >= (pow10 * 10))){pow10 *= 10; ++cnt; }return ((cnt * ((x - pow10) + 1)) + f((pow10 - 1)));} static BufferedReader __in = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter __out = new PrintWriter(new OutputStreamWriter(System.out)); static StringTokenizer input ; static Random __rand = new Random(); static final int IBIG = 1000000007; static final int IMAX = 2147483647; static final int IMIN = -2147483648; static final long LMAX = 9223372036854775807L; static final long LMIN = -9223372036854775808L; static int gcf( int a, int b){ return ((b == 0)?a:gcf(b,(a % b)));} static long gcf( long a, long b){ return ((b == 0)?a:gcf(b,(a % b)));} static int randInt( int min, int max){ return (__rand.nextInt(((max - min) + 1)) + min);} static void shuffle( int[] a){ int n = (a.length - 1); for ( int i = 0;(i < n);++i) { int ind = randInt(i,n);  int swap = a[i]; a[i] = a[ind]; a[ind] = swap; }} static void shuffle( long[] a){ int n = (a.length - 1); for ( int i = 0;(i < n);++i) { int ind = randInt(i,n);  long swap = a[i]; a[i] = a[ind]; a[ind] = swap; }} static void shuffle( double[] a){ int n = (a.length - 1); for ( int i = 0;(i < n);++i) { int ind = randInt(i,n);  double swap = a[i]; a[i] = a[ind]; a[ind] = swap; }} static List<List<Integer>> g( int n){ List<List<Integer>> g = new ArrayList<>(); for ( int i = 0;(i < n);++i) g.add(new ArrayList<>()); return g;} static List<Set<Integer>> sg( int n){ List<Set<Integer>> g = new ArrayList<>(); for ( int i = 0;(i < n);++i) g.add(new HashSet<>()); return g;} static void c( List<? extends Collection<Integer>> g, int u, int v){ g.get(u).add(v); g.get(v).add(u); } static void cto( List<? extends Collection<Integer>> g, int u, int v){ g.get(u).add(v); } static void r()throws IOException { input = new StringTokenizer(rline()); } static long rl()throws IOException { return Long.parseLong(rline());} static String rline()throws IOException { return __in.readLine();} static String n(){ return input.nextToken();} static int rni()throws IOException { r(); return ni();} static int ni(){ return Integer.parseInt(n());} static long nl(){ return Long.parseLong(n());} static double nd(){ return Double.parseDouble(n());} static void pr( int i){ __out.print(i); } static void prln( int i){ __out.println(i); } static void pr( long l){ __out.print(l); } static void prln( long l){ __out.println(l); } static void pr( double d){ __out.print(d); } static void prln( double d){ __out.println(d); } static void pr( char c){ __out.print(c); } static void prln( char c){ __out.println(c); } static void pr( char[] s){ __out.print(new String(s)); } static void prln( char[] s){ __out.println(new String(s)); } static void pr( String s){ __out.print(s); } static void prln( String s){ __out.println(s); } static void pr( Object o){ __out.print(o); } static void prln( Object o){ __out.println(o); } static void prln(){ __out.println(); } static void prln( int... a){ for ( int i = 0,len = (a.length - 1);(i < len);pr(a[i]),pr(' '),++i) ;if ( (a.length > 0)) prln(a[(a.length - 1)]); else prln(); } static void prln( long... a){ for ( int i = 0,len = (a.length - 1);(i < len);pr(a[i]),pr(' '),++i) ;if ( (a.length > 0)) prln(a[(a.length - 1)]); else prln(); } static void prln( double... a){ for ( int i = 0,len = (a.length - 1);(i < len);pr(a[i]),pr(' '),++i) ;if ( (a.length > 0)) prln(a[(a.length - 1)]); else prln(); } static <T> void prln( Collection<T> c){ int n = (c.size() - 1);  Iterator<T> iter = c.iterator(); for ( int i = 0;(i < n);pr(iter.next()),pr(' '),++i) ;if ( (n >= 0)) prln(iter.next()); else prln(); } static void flush(){ __out.flush(); } static void close(){ __out.close(); } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  Reader in = new Reader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ static private final long MOD = 1000000009; public void solve( int testNumber, Reader in, OutputWriter out){ long answer = 0;  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  long l = -1;  long r = (n + 1); while(((l + 1) < r)){ long c = ((l + r) / 2); if ( ((n < (c * k)) || (canAchieve((n - (c * k)),k) >= (m - (c * k))))) {r = c; } else l = c; } long c = r; answer = (((((IntegerUtils.power(2,(c + 1),MOD) - 2) + MOD) % MOD) * k) % MOD); n -= (k * c); m -= (k * c); answer += m; answer %= MOD; out.println(answer); } private long canAchieve( long n, long k){ return (n - (n / k));} } class Reader{ private BufferedReader reader ; private StringTokenizer tokenizer ; public Reader( BufferedReader reader){ this.reader = reader; } public Reader( InputStream stream){ this(new BufferedReader(new InputStreamReader(stream))); } public String nextString(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(readLine()); }return tokenizer.nextToken();} public int nextInt(){ return Integer.parseInt(nextString());} private String readLine(){ try{return reader.readLine(); }catch (IOException e){ throw (new RuntimeException(e));} } } class OutputWriter extends PrintWriter{ public OutputWriter( OutputStream out){ super(out); } public OutputWriter( java.io.Writer writer){ super(writer); } }
2	public class Main{ void pre()throws Exception { } void solve( int TC)throws Exception { long K = nl(); K--; int sz = 1;  long pw = 1; while((K >= pw)){ long npw = (pw * 10);  long dig = (sz * (npw - pw)); if ( (K >= dig)) {K -= dig; sz++; pw *= 10; } else break;} long num = (pw + (K / sz));  int dig = ((sz - (int)(K % sz)) - 1); while((dig-- > 0))num /= 10; pn((num % 10)); } void exit( boolean b){ if ( !b) System.exit(0); } final long IINF = (long)2e18; final int INF = ((int)1e9 + 2); DecimalFormat df = new DecimalFormat("0.00000000000"); double PI = 3.141592653589793238462643383279502884197169399,eps = 1e-8; static boolean multipleTC = false,memory = true,fileIO = false; FastReader in ; PrintWriter out ; void run()throws Exception { long ct = System.currentTimeMillis(); if ( fileIO) {in = new FastReader(""); out = new PrintWriter(""); } else {in = new FastReader(); out = new PrintWriter(System.out); } int T = (multipleTC?ni():1); pre(); for ( int t = 1;(t <= T);t++) solve(t); out.flush(); out.close(); System.err.println((System.currentTimeMillis() - ct)); } public static void main( String[] args)throws Exception { if ( memory) new Thread(null,new Runnable(){public void run(){ try{new Main().run(); }catch (Exception e){ e.printStackTrace(); } } },"1",(1 << 28)).start(); else new Main().run(); } int find( int[] set, int u){ return set[u] = ((set[u] == u)?u:find(set,set[u]));} long gcd( long a, long b){ return ((b == 0)?a:gcd(b,(a % b)));} int gcd( int a, int b){ return ((b == 0)?a:gcd(b,(a % b)));} int bit( long n){ return ((n == 0)?0:(1 + bit((n & (n - 1)))));} void pn( Object o){ out.println(o); } int ni()throws Exception { return Integer.parseInt(in.next());} long nl()throws Exception { return Long.parseLong(in.next());} class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public FastReader( String s)throws Exception{ br = new BufferedReader(new FileReader(s)); } String next()throws Exception { while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new Exception(e.toString()));} }return st.nextToken();} String nextLine()throws Exception { String str ; try{str = br.readLine(); }catch (IOException e){ throw (new Exception(e.toString()));} return str;} } }
2	public class B{ public static void main( String[] args)throws IOException { MyScanner sc = new MyScanner();  PrintWriter out = new PrintWriter(System.out);  int N = sc.nextInt(); if ( (((N / 2) % 2) == 1)) {output(-1,out); } else { int half = (N / 2);  int l = 1,r = half;  int first = query(half,out,sc);  int next = query((2 * half),out,sc); if ( (first == next)) {output(half,out); return ;} boolean less = (first < next); while(((l + 1) < r)){ int med = ((l + r) / 2); first = query(med,out,sc); next = query((med + half),out,sc); if ( (first == next)) {output(med,out); return ;} else if ( ((first < next) == less)) {r = med; } else {l = (med + 1); }}output(l,out); }} static int query( int pos, PrintWriter out, MyScanner sc){ out.println(("? " + pos)); out.flush(); return sc.nextInt();} static void output( int pos, PrintWriter out){ out.println(("! " + pos)); out.flush(); } static class MyScanner{ private BufferedReader br ; private StringTokenizer tokenizer ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return tokenizer.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
2	public class Proj implements Runnable{ BufferedReader in ; PrintWriter out ; StringTokenizer str ; public void solve()throws IOException { long l = nextLong();  long r = nextLong();  int g = 0;  long x = (l ^ r);  long i = 1; while((x >= i)){i = (i * 2); }if ( (x >= i)) {out.println(x); } else out.println((i - 1)); } public String nextToken()throws IOException { while(((str == null) || !str.hasMoreTokens())){str = new StringTokenizer(in.readLine()); }return str.nextToken();} public long nextLong()throws IOException { return Long.parseLong(nextToken());} public static void main( String[] args){ new Thread(new Proj()).start(); } }
5	public class Main{ static int T ; public static void main( String[] args){ FastScanner sc = new FastScanner(System.in); T = sc.nextInt(); PrintWriter pw = new PrintWriter(System.out); for ( int i = 0;(i < T);i++) { int n = sc.nextInt();  int[] a = sc.nextIntArray(n);  int[] ans = solve(n,a);  StringJoiner j = new StringJoiner(" "); for ( int each :ans) {j.add(String.valueOf(each)); }pw.println(j.toString()); }pw.flush(); } static int[] solve( int N, int[] A){ shuffle(A); Arrays.sort(A); int cur = A[0];  int time = 1;  double r = 0;  int prev = -1;  int a = -1;  int b = -1; for ( int i = 1;(i < N);i++) {if ( (cur == A[i])) {time++; if ( (time == 2)) {if ( (prev != -1)) { double r1 = ((double)prev / cur); if ( (r1 > r)) {r = r1; a = prev; b = cur; } } prev = cur; } if ( (time == 4)) {return new int[]{cur,cur,cur,cur};} } else {time = 1; cur = A[i]; }}return new int[]{a,a,b,b};} static void shuffle( int[] a){ Random r = ThreadLocalRandom.current(); for ( int i = (a.length - 1);(i >= 0);i--) { int j = r.nextInt((i + 1));  int t = a[i]; a[i] = a[j]; a[j] = t; }} @SuppressWarnings("unused") static class FastScanner{ private BufferedReader reader ; private StringTokenizer tokenizer ; FastScanner( InputStream in){ reader = new BufferedReader(new InputStreamReader(in)); tokenizer = null; } String next(){ if ( ((tokenizer == null) || !tokenizer.hasMoreTokens())) {try{tokenizer = new StringTokenizer(reader.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} } return tokenizer.nextToken();} long nextLong(){ return Long.parseLong(next());} int nextInt(){ return Integer.parseInt(next());} int[] nextIntArray( int n){ int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = nextInt(); return a;} int[] nextIntArray( int n, int delta){ int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = (nextInt() + delta); return a;} } static int max( int... as){ int max = Integer.MIN_VALUE; for ( int a :as) max = Math.max(a,max); return max;} static int min( int... as){ int min = Integer.MAX_VALUE; for ( int a :as) min = Math.min(a,min); return min;} }
6	public class E{ static private final int oo = 1000000000; public static void main( String[] args)throws Exception { Scanner in = new Scanner(System.in);  int n = in.nextInt();  int m = in.nextInt(); if ( (n > m)) { int t = n; n = m; m = t; } int[][] curr = new int[(1 << n)][(1 << n)]; fill(curr,oo); Arrays.fill(curr[0],0); for ( int j = 0;(j < m);j++) { int[][] next = new int[(1 << n)][(1 << n)]; fill(next,oo); for ( int c0 = 0;(c0 < (1 << n));c0++) for ( int c1 = 0;(c1 < (1 << n));c1++) if ( (curr[c0][c1] != oo)) for ( int c2 = 0;(c2 < ((j == (m - 1))?1:(1 << n)));c2++) { int all = ((1 << n) - 1);  int done = ((((all & (c1 >> 1)) | (all & (c1 << 1))) | c0) | c2); done &= (all ^ c1); next[c1][c2] = Math.min(next[c1][c2],((curr[c0][c1] + n) - Integer.bitCount(done))); } curr = next; } int res = oo; for ( int i = 0;(i < (1 << n));i++) for ( int j = 0;(j < (1 << n));j++) res = Math.min(res,curr[i][j]); System.out.println(((n * m) - res)); } static private void fill( int[][] array, int val){ for ( int[] fill :array) Arrays.fill(fill,val); } }
3	public class C{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  int r = in.nextInt();  double pos[][] = new double[n][2]; for ( int i = 0;(i < n);i++) {pos[i][0] = in.nextInt(); double y = r; for ( int j = 0;(j < i);j++) {if ( (Math.abs((pos[i][0] - pos[j][0])) <= (2 * r))) { double tempy = (pos[j][1] + Math.sqrt((Math.pow((2 * r),2) - Math.pow(Math.abs((pos[i][0] - pos[j][0])),2)))); if ( (tempy > y)) y = tempy; } }pos[i][1] = y; System.out.print((y + " ")); }} }
6	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(),m = sc.nextInt();  int g[] = new int[(1 << m)];  StringBuffer s = new StringBuffer(sc.next()); s = s.insert(0,'A'); int D = ((1 << m) - 1); for ( int i = 1;(i < n);i++) { int x = (s.charAt(i) - 'a'),y = (s.charAt((i + 1)) - 'a'); if ( (x != y)) g[((1 << x) | (1 << y))]++; }for ( int j = 0;(j < m);j++) for ( int i = 0;(i <= D);i++) if ( (((i >> j) & 1) != 0)) g[i] += g[(i ^ (1 << j))];  int f[] = new int[(1 << m)]; Arrays.fill(f,(Integer.MAX_VALUE / 2)); f[0] = 0; for ( int i = 0;(i <= D);i++) for ( int j = 0;(j < m);j++) if ( (((i >> j) & 1) == 0)) f[(i | (1 << j))] = Math.min(f[(i | (1 << j))],(((f[i] + g[D]) - g[i]) - g[(D ^ i)])); System.out.println(f[D]); } }
2	@SuppressWarnings("unchecked") public class P1177B{ public void run()throws Exception { for ( long k = (nextLong() - 1),d = 1,dc = 9,sv = 1;true;k -= dc,d++,sv *= 10,dc = ((sv * d) * 9)) {if ( (k <= dc)) {println(Long.toString((sv + (k / d))).charAt((int)(k % d))); break;} }} public static void main( String... args)throws Exception { br = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(new BufferedOutputStream(System.out)); new P1177B().run(); br.close(); pw.close(); System.err.println((("\n[Time : " + (System.currentTimeMillis() - startTime)) + " ms]")); long gct = 0,gcc = 0; for ( GarbageCollectorMXBean garbageCollectorMXBean :ManagementFactory.getGarbageCollectorMXBeans()) {gct += garbageCollectorMXBean.getCollectionTime(); gcc += garbageCollectorMXBean.getCollectionCount(); }System.err.println((((("[GC time : " + gct) + " ms, count = ") + gcc) + "]")); } static long startTime = System.currentTimeMillis(); static BufferedReader br ; static PrintWriter pw ; StringTokenizer stok ; String nextToken()throws IOException { while(((stok == null) || !stok.hasMoreTokens())){ String s = br.readLine(); if ( (s == null)) {return null;} stok = new StringTokenizer(s); }return stok.nextToken();} void print( byte b){ print(("" + b)); } void print( int i){ print(("" + i)); } void print( long l){ print(("" + l)); } void print( double d){ print(("" + d)); } void print( char c){ print(("" + c)); } void print( Object o){ if ( (o instanceof int[])) {print(Arrays.toString((int[])o)); } else if ( (o instanceof long[])) {print(Arrays.toString((long[])o)); } else if ( (o instanceof char[])) {print(Arrays.toString((char[])o)); } else if ( (o instanceof byte[])) {print(Arrays.toString((byte[])o)); } else if ( (o instanceof short[])) {print(Arrays.toString((short[])o)); } else if ( (o instanceof boolean[])) {print(Arrays.toString((boolean[])o)); } else if ( (o instanceof float[])) {print(Arrays.toString((float[])o)); } else if ( (o instanceof double[])) {print(Arrays.toString((double[])o)); } else if ( (o instanceof Object[])) {print(Arrays.toString((Object[])o)); } else {print(("" + o)); }} void print( String s){ pw.print(s); } void println(){ println(""); } void println( byte b){ println(("" + b)); } void println( int i){ println(("" + i)); } void println( long l){ println(("" + l)); } void println( double d){ println(("" + d)); } void println( char c){ println(("" + c)); } void println( Object o){ print(o); println(); } void println( String s){ pw.println(s); } int nextInt()throws IOException { return Integer.parseInt(nextToken());} long nextLong()throws IOException { return Long.parseLong(nextToken());} double nextDouble()throws IOException { return Double.parseDouble(nextToken());} String nextLine()throws IOException { return br.readLine();} void flush(){ pw.flush(); } }
6	public class Main{ static Scanner in ; static PrintWriter out ; public static void main( String[] args)throws Exception { in = new Scanner(System.in); out = new PrintWriter(System.out); int n = in.nextInt();  double[][] p = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) p[i][j] = in.nextDouble(); double[] q = new double[(1 << n)]; q[((1 << n) - 1)] = 1; for ( int mask = ((1 << n) - 1);(mask > 0);mask--) { int count = 0; for ( int t = 0;(t < n);t++) if ( (((1 << t) & mask) != 0)) count++; if ( (count <= 1)) continue; count = ((count * (count - 1)) / 2); for ( int t = 0;(t < n);t++) if ( (((1 << t) & mask) != 0)) for ( int s = 0;(s < t);s++) if ( (((1 << s) & mask) != 0)) {q[(mask - (1 << t))] += ((q[mask] / count) * p[s][t]); q[(mask - (1 << s))] += ((q[mask] / count) * p[t][s]); } }for ( int i = 0;(i < n);i++) out.print((q[(1 << i)] + " ")); out.close(); } }
6	public class taskB{ public static void main( String[] args)throws IOException { new taskB().run(); } BufferedReader reader ; StringTokenizer tokenizer ; PrintWriter writer ; static String TASK = ""; void run()throws IOException { try{reader = new BufferedReader(new InputStreamReader(System.in)); writer = new PrintWriter(System.out); tokenizer = null; solve(); reader.close(); writer.close(); }catch (Exception e){ e.printStackTrace(); System.exit(1); } } int b[] ; int l[] ; int add[] ; int n ,k ,A ; double ans = 0; void solve()throws IOException { n = nextInt(); k = nextInt(); A = nextInt(); b = new int[n]; l = new int[n]; add = new int[n]; for ( int i = 0;(i < n);++i) {b[i] = nextInt(); l[i] = nextInt(); }brute(0,k); writer.printf("%.10f",ans); } private void brute( int pos, int yet){ if ( (pos == n)) { double p[] = new double[n]; for ( int i = 0;(i < n);++i) {p[i] = ((l[i] + add[i]) / 100.0); } double r = 0; for ( int i = 0;(i < (1 << n));++i) { double pr = 1;  int sm = 0; for ( int j = 0;(j < n);++j) {if ( ((i & (1 << j)) > 0)) {pr *= p[j]; } else {pr *= (1 - p[j]); sm += b[j]; }} int c = Integer.bitCount(i); if ( (c >= ((n + 2) / 2))) {r += pr; } else {r += (pr * ((1.0 * A) / (A + sm))); }}ans = Math.max(ans,r); } else {for ( int i = 0;(i <= yet);++i) {if ( ((l[pos] + (10 * i)) > 100)) continue; add[pos] = (10 * i); brute((pos + 1),(yet - i)); }}} String nextToken()throws IOException { while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(reader.readLine()); }return tokenizer.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
3	public class C{ public static void main( String[] args){ FastScanner in = new FastScanner();  int n = in.nextInt();  double r = in.nextInt();  double x[] = new double[n]; for ( int i = 0;(i < n);i++) x[i] = in.nextDouble(); double y[] = new double[n]; y[0] = r; for ( int i = 1;(i < n);i++) { double miny = r; for ( int j = 0;(j < i);j++) { double dx = Math.abs((x[i] - x[j])); if ( (dx > (r * 2))) continue; double yy = Math.sqrt((((4 * r) * r) - (dx * dx))); miny = Math.max(miny,(yy + y[j])); }y[i] = miny; }for ( int i = 0;(i < n);i++) {System.out.print((y[i] + " ")); }} static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( String s){ try{br = new BufferedReader(new FileReader(s)); }catch (FileNotFoundException e){ 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){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(nextToken());} double nextDouble(){ return Double.parseDouble(nextToken());} } }
0	public class helloWorld{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int a = in.nextInt();  int b = in.nextInt();  int c = in.nextInt();  int n = in.nextInt();  int ans = (n - ((a + b) - c)); if ( (((((ans < 1) || (a >= n)) || (b >= n)) || (c > a)) || (c > b))) ans = -1; System.out.println(ans); in.close(); } }
0	public class A470{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int start = 4; while(true){if ( ((((start % 2) == 0) || ((start % 3) == 0)) && ((((n - start) % 2) == 0) || (((n - start) % 3) == 0)))) {System.out.println(((start + " ") + (n - start))); return ;} else start++; }} }
6	public class CF85E{ public static void main( String[] args){ reader = new BufferedReader(new InputStreamReader(System.in)); int height = nextInt(),width = nextInt(); if ( (width > height)) { int t = width; width = height; height = t; } final int INF = ((height * width) + 10);  int[][][] dp = new int[(height + 1)][(1 << width)][(1 << width)]; for ( int[][] ints :dp) {for ( int[] anInt :ints) {Arrays.fill(anInt,INF); }}dp[0][0][0] = 0; for ( int r = 0;(r < height);++r) {for ( int uncovered = 0;(uncovered < (1 << width));++uncovered) {for ( int mask = 0;(mask < (1 << width));++mask) {if ( (dp[r][uncovered][mask] == INF)) {continue;} for ( int curMask = uncovered;(curMask < (1 << width));curMask = ((curMask + 1) | uncovered)) { int curUncovered = ((1 << width) - 1); for ( int i = 0;(i < width);++i) {if ( (hasBit(mask,i) || hasBit(curMask,i))) {curUncovered &= (1 << i); } if ( ((i > 0) && hasBit(curMask,(i - 1)))) {curUncovered &= (1 << i); } if ( ((i < (width - 1)) && hasBit(curMask,(i + 1)))) {curUncovered &= (1 << i); } }dp[(r + 1)][curUncovered][curMask] = Math.min(dp[(r + 1)][curUncovered][curMask],(dp[r][uncovered][mask] + Integer.bitCount(curMask))); }}}} int res = INF; for ( int x :dp[height][0]) res = Math.min(res,x); System.out.println(((height * width) - res)); } static private boolean hasBit( int mask, int bit){ return (((mask >> bit) & 1) == 1);} public static BufferedReader reader ; public static StringTokenizer tokenizer = null; static String nextToken(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new StringTokenizer(reader.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return tokenizer.nextToken();} public static int nextInt(){ return Integer.parseInt(nextToken());} }
3	public class RGBSubstring{ public static void main( String[] args){ FastScanner scanner = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int Q = scanner.nextInt(); while((Q-- > 0)){ int N = scanner.nextInt();  int K = scanner.nextInt();  String s1 = "RGB";  String s2 = "GBR";  String s3 = "BRG";  char[] arr = scanner.next().toCharArray();  int[] cnts = new int[3]; for ( int i = 0;(i < K);i++) { int ind = (i % 3); if ( (arr[i] != s1.charAt(ind))) cnts[0]++; if ( (arr[i] != s2.charAt(ind))) cnts[1]++; if ( (arr[i] != s3.charAt(ind))) cnts[2]++; } int ans = Math.min(Math.min(cnts[0],cnts[1]),cnts[2]); for ( int i = K;(i < N);i++) { int ind = ((K - 1) % 3);  int[] nextCnts = new int[3]; nextCnts[1] = cnts[0]; nextCnts[2] = cnts[1]; nextCnts[0] = cnts[2]; if ( ('R' != arr[(i - K)])) nextCnts[1]--; if ( ('G' != arr[(i - K)])) nextCnts[2]--; if ( ('B' != arr[(i - K)])) nextCnts[0]--; if ( (arr[i] != s1.charAt(ind))) nextCnts[0]++; if ( (arr[i] != s2.charAt(ind))) nextCnts[1]++; if ( (arr[i] != s3.charAt(ind))) nextCnts[2]++; cnts = nextCnts; for ( int j = 0;(j < 3);j++) ans = Math.min(ans,cnts[j]); }out.println(ans); }out.flush(); } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( Reader in){ br = new BufferedReader(in); } public FastScanner(){ this(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
3	public class GB17C{ public static void main( String[] args)throws NumberFormatException,IOException { BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));  String[] dir = sc.readLine().split(" ");  int n = Integer.parseInt(dir[0]);  int r = Integer.parseInt(dir[1]);  String[] t = sc.readLine().split(" ");  int[] list = new int[n]; for ( int x = 0;(x < n);x++) {list[x] = Integer.parseInt(t[x]); } double[] yCoords = new double[n]; for ( int x = 0;(x < n);x++) { double stop = (double)r;  int dist = (2 * r);  int xCoordNew = list[x]; for ( int y = 0;(y < x);y++) { int xCoordOld = list[y]; if ( (Math.abs((xCoordNew - xCoordOld)) == dist)) {stop = Math.max(stop,yCoords[y]); } else if ( (Math.abs((xCoordNew - xCoordOld)) < dist)) { double extra = Math.pow(((double)(dist * dist) - (double)((xCoordNew - xCoordOld) * (xCoordNew - xCoordOld))),0.5); stop = Math.max(stop,(yCoords[y] + extra)); } }yCoords[x] = stop; System.out.print((stop + " ")); }} }
6	public class P111C{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); double EPS = 1e-9; int h ,w ; void run(){ h = sc.nextInt(); w = sc.nextInt(); solve(); } void solve(){ n = (w * h); g = new long[n]; int[] dx = {0,0,-1,1};  int[] dy = {-1,1,0,0}; for ( int y = 0;(y < h);y++) {for ( int x = 0;(x < w);x++) {for ( int k = 0;(k < 4);k++) { int x2 = (x + dx[k]);  int y2 = (y + dy[k]); if ( ((((x2 >= 0) && (x2 < w)) && (y2 >= 0)) && (y2 < h))) {g[((y * w) + x)] |= (1L << ((y2 * w) + x2)); } }}}candidate = new int[n]; xs = new Xorshift(); mds = ((1L << n) - 1); mds(0,0,0); println(((n - Long.bitCount(mds)) + "")); } int n ; long[] g ; long mds ; int[] candidate ; Xorshift xs ; void mds( long choosed, long removed, long covered){ if ( (Long.bitCount(choosed) >= Long.bitCount(mds))) return ; if ( (covered == ((1L << n) - 1))) {if ( (Long.bitCount(choosed) < Long.bitCount(mds))) mds = choosed; return ;} { long s = covered; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); s |= ((1L << i) | g[i]); }if ( (s != ((1L << n) - 1))) {return ;} } int k = -1; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); if ( (((covered >>> i) & 1) == 1)) {if ( (Long.bitCount((g[i] & ~covered)) == 0)) {mds(choosed,(removed | (1L << i)),covered); return ;} else if ( ((Long.bitCount((g[i] & ~covered)) == 1) && (((g[i] & ~covered) & ~removed) != 0))) {mds(choosed,(removed | (1L << i)),covered); return ;} } else {if ( (Long.bitCount((g[i] & ~removed)) == 0)) {mds((choosed | (1L << i)),(removed | (1L << i)),((covered | (1L << i)) | g[i])); return ;} else if ( ((Long.bitCount((g[i] & ~removed)) == 1) && (((g[i] & ~removed) | (g[i] & ~covered)) == (g[i] & ~removed)))) { int j = Long.numberOfTrailingZeros((g[i] & ~removed)); mds((choosed | (1L << j)),((removed | (1L << i)) | (1L << j)),((covered | (1L << j)) | g[j])); return ;} }if ( ((k == -1) || (Long.bitCount((g[i] & ~covered)) > Long.bitCount((g[k] & ~covered))))) k = i; }if ( (k == -1)) return ; mds((choosed | (1L << k)),(removed | (1L << k)),((covered | (1L << k)) | g[k])); mds(choosed,(removed | (1L << k)),covered); } class Xorshift{ int x ,y ,z ,w ; public Xorshift(){ x = 123456789; y = 362436069; z = 521288629; w = 88675123; } public Xorshift( int seed){ x = _(seed,0); y = _(x,1); z = _(y,2); w = _(z,3); } int _( int s, int i){ return (((1812433253 * (s ^ (s >>> 30))) + i) + 1);} public int nextInt(){ int t = (x ^ (x << 11)); x = y; y = z; z = w; return w = (((w ^ (w >>> 19)) ^ t) ^ (t >>> 8));} public int nextInt( int n){ return (int)(n * nextDouble());} public double nextDouble(){ int a = (nextInt() >>> 5),b = (nextInt() >>> 6); return (((a * 67108864.0) + b) * (1.0 / (1L << 53)));} } void println( String s){ System.out.println(s); } void print( String s){ System.out.print(s); } public static void main( String[] args){ Locale.setDefault(Locale.US); new P111C().run(); } }
1	public class X{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  String s1 = br.readLine();  String s2 = br.readLine();  int i = 0;  char c1 ,c2 ;  int cost = 0; while((i < n)){c1 = s1.charAt(i); c2 = s2.charAt(i); if ( (c1 != c2)) {if ( ((((i + 1) < n) && (s1.charAt((i + 1)) != s2.charAt((i + 1)))) && (s1.charAt(i) != s1.charAt((i + 1))))) {cost += 1; i++; } else {cost += 1; }} i++; }System.out.println(cost); } }
5	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int[] wide = new int[n],sta = new int[n];  HashMap<Integer,Integer> hm = new HashMap<Integer,Integer>(); for ( int i = 0;(i < n);i++) {wide[i] = sc.nextInt(); hm.put(wide[i],(i + 1)); }Util.sort(wide); sc.nextLine(); String s = sc.nextLine();  int tp = 0,pos = 0;  StringBuilder out = new StringBuilder(); for ( int i = 0;(i < s.length());i++) { int t ; if ( (s.charAt(i) == '0')) {t = wide[pos++]; sta[tp++] = t; } else t = sta[--tp]; out.append((hm.get(t) + " ")); }System.out.println(out.toString()); sc.close(); } }
0	public class TemplateBuf implements Runnable{ private void solve()throws Exception { long n = nextUnsignedLong(); out.println((n + (n / 2))); } BufferedReader in ; PrintWriter out ; @Override public void run(){ try{in = new BufferedReader(new InputStreamReader(System.in),INPUT_BUF_SIZE); out = new PrintWriter(new OutputStreamWriter(System.out)); solve(); out.flush(); }catch (Exception e){ e.printStackTrace(); System.exit(1); } } final int INPUT_BUF_SIZE = (1024 * 8); final int BUF_SIZE = INPUT_BUF_SIZE; char[] buf = new char[BUF_SIZE]; int ch = -1; int charRead = -1; int charPos = -1; public char nextChar()throws IOException { if ( ((charPos < 0) || (charPos >= charRead))) {charRead = in.read(buf); charPos = 0; } return buf[charPos++];} public long nextUnsignedLong()throws IOException { while((((ch = nextChar()) < '0') || (ch > '9'))); long num = (ch - '0'); while((((ch = nextChar()) >= '0') && (ch <= '9'))){num *= 10; num += (ch - '0'); }return num;} public static void main( String[] args){ new TemplateBuf().run(); } }
1	public class AnnoyingPresent{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  long n = Long.parseLong(st.nextToken()),m = Long.parseLong(st.nextToken());  long sum = 0; for ( int i = 0;(i < m);i++) { StringTokenizer st1 = new StringTokenizer(br.readLine()); sum += (n * Long.parseLong(st1.nextToken())); Long a = Long.parseLong(st1.nextToken()); if ( (a < 0)) {if ( ((n % 2) == 0)) sum += (((n * n) / 4) * a); else {sum += (((n / 2) * ((n / 2) + 1)) * a); }} else sum += (((a * n) * (n - 1)) / 2); }System.out.println(((double)sum / n)); } }
3	public class vas2{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  String st = in.next();  int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = (st.charAt(i) - 48); boolean c = false; for ( int i = 1;(!c && (i < n));i++) { int s = 0; for ( int j = 0;(j < i);j++) s += a[j]; int t = 0; for ( int j = i;(j < n);j++) {t += a[j]; if ( (t > s)) if ( ((t - a[j]) != s)) break; else t = a[j]; }if ( (t == s)) c = true; }System.out.println((c?"YES":"NO")); } }
3	public class C{ public static void main( String[] args)throws IOException { FastScanner in = new FastScanner(System.in);  PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  int n = in.nextInt();  double r = in.nextInt();  double[] x = new double[(n + 1)];  double[] y = new double[(n + 1)]; for ( int i = 1;(i <= n);i++) {x[i] = in.nextInt(); } int[] lastx = new int[1001]; for ( int i = 1;(i <= n);i++) { double s = (x[i] - r),e = (x[i] + r); for ( int j = (int)Math.max(0,s);(j <= (int)Math.min(1000,e));j++) {if ( (lastx[j] == 0)) {y[i] = Math.max(y[i],findY(x[i],x[i],(0 - r),(2 * r))); } else {y[i] = Math.max(y[i],findY(x[lastx[j]],x[i],y[lastx[j]],(2 * r))); }lastx[j] = i; }}for ( int i = 1;(i <= n);i++) {out.println(y[i]); }out.close(); } public static double findY( double x1, double x2, double y1, double d){ return Math.max((y1 + Math.sqrt(((((-1 * Math.pow(x1,2)) + ((2 * x1) * x2)) + Math.pow(d,2)) - Math.pow(x2,2)))),(y1 - Math.sqrt(((((-1 * Math.pow(x1,2)) + ((2 * x1) * x2)) + Math.pow(d,2)) - Math.pow(x2,2)))));} static 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 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();} } }
6	public class Main{ public static void main( String[] args){ new Main().run(); } FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ out.println(work()); out.flush(); } long mod = 1000000007; long gcd( long a, long b){ return ((b == 0)?a:gcd(b,(a % b)));} long work(){ int n = in.nextInt();  int m = in.nextInt();  String str = in.next();  long[] dp = new long[(1 << m)];  long[][] cnt = new long[m][m]; for ( int i = 1;(i < n);i++) { int n1 = (str.charAt((i - 1)) - 'a');  int n2 = (str.charAt(i) - 'a'); cnt[n1][n2]++; cnt[n2][n1]++; }for ( int i = 1;(i < (1 << m));i++) {dp[i] = 9999999999L; long v = 0; for ( int j = 0;(j < m);j++) {if ( ((i & (1 << j)) > 0)) {for ( int k = 0;(k < m);k++) {if ( ((i & (1 << k)) == 0)) {v += cnt[j][k]; } }} }for ( int j = 0;(j < m);j++) {if ( ((i & (1 << j)) > 0)) {dp[i] = Math.min(dp[i],(dp[(i - (1 << j))] + v)); } }}return dp[((1 << m) - 1)];} } class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ if ( ((st == null) || !st.hasMoreElements())) {try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } } return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} }
6	public class E{ static double[] dp ; static int[] oneCount ; static int end ; static int n ; static double[][] prob ; public static double solve( int mask){ if ( (mask == end)) return 1; int oneC = 0,zeroC = 0; for ( int i = 0;(i < n);i++) {if ( ((mask | (1 << i)) == mask)) oneC++; else zeroC++; } double res = 0; for ( int i = 0;(i < n);i++) {if ( ((mask | (1 << i)) != mask)) continue; for ( int j = 0;(j < n);j++) {if ( ((mask | (1 << j)) == mask)) continue; res += (((1.0 / ((oneC * (oneC + 1)) / 2)) * prob[i][j]) * solve((mask | (1 << j)))); }}return dp[mask] = res;} public static void main( String[] args){ Scanner sc = new Scanner(System.in); n = sc.nextInt(); prob = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) prob[i][j] = sc.nextDouble(); dp = new double[(1 << n)]; oneCount = new int[(1 << n)]; int c ; for ( int i = 0;(i < dp.length);i++) {c = 0; for ( int j = 0;(j < n);j++) {if ( ((i | (1 << j)) == i)) c++; }oneCount[i] = c; }end = ((1 << n) - 1); double res ,rad ;  int count ; for ( int k = end;(k > 0);k--) {if ( (k == end)) dp[k] = 1; else {res = 0; count = oneCount[k]; count = (count * (count + 1)); count >>= 1; rad = (1.0 / count); for ( int i = 0;(i < n);i++) {if ( ((k | (1 << i)) != k)) continue; for ( int j = 0;(j < n);j++) {if ( ((k | (1 << j)) == k)) continue; res += ((rad * prob[i][j]) * dp[(k | (1 << j))]); }}dp[k] = res; }}for ( int i = 0;(i < n);i++) System.out.print((dp[(1 << i)] + " ")); } }
5	public class a{ public static void main( String[] args)throws IOException { input.init(System.in); int n = input.nextInt(),k = input.nextInt();  TreeSet<Integer> ts = new TreeSet<Integer>();  int[] data = new int[n]; for ( int i = 0;(i < n);i++) {data[i] = input.nextInt(); }Arrays.sort(data); if ( ((n > 1) && (k == ((1. * data[(n - 1)]) / data[0])))) System.out.println((n - 1)); else {for ( int i = 0;(i < n);i++) {if ( ((data[i] % k) != 0)) ts.add(data[i]); else {if ( !ts.contains((data[i] / k))) ts.add(data[i]); }}System.out.println(ts.size()); }} }
3	public class ProblemD{ static int mod = (int)(1e9 + 7); static InputReader in ; static PrintWriter out ; static void solve(){ in = new InputReader(System.in); out = new PrintWriter(System.out); int n = in.nextInt();  int r = in.nextInt();  double[] x = new double[n];  double[] y = new double[n]; for ( int i = 0;(i < n);i++) { int xx = in.nextInt(); x[i] = xx; y[i] = r; for ( int j = 0;(j < i);j++) { double delx = Math.abs((x[i] - x[j])); if ( (delx <= (2 * r))) { double tmp = (((4 * r) * r) - (delx * delx)); tmp = Math.sqrt(tmp); tmp = (y[j] + tmp); y[i] = Math.max(y[i],tmp); } }out.print((y[i] + " ")); }out.close(); } public static void main( String[] args){ new Thread(null,new Runnable(){},"1",(1 << 26)).start(); } static long gcd( long x, long y){ if ( (y == 0)) return x; else return gcd(y,(x % y));} static int gcd( int x, int y){ if ( (y == 0)) return x; else return gcd(y,(x % y));} static class InputReader{ private final InputStream stream ; private final byte[] buf = new byte[8192]; private int curChar ,snumChars ; private SpaceCharFilter filter ; public InputReader( InputStream stream){ this.stream = stream; } public int snext(){ if ( (snumChars == -1)) throw (new InputMismatchException()); if ( (curChar >= snumChars)) {curChar = 0; try{snumChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (snumChars <= 0)) return -1; } return buf[curChar++];} public int nextInt(){ int c = snext(); while(isSpaceChar(c)){c = snext(); } int sgn = 1; if ( (c == '-')) {sgn = -1; c = snext(); } int res = 0; do {if ( ((c < '0') || (c > '9'))) throw (new InputMismatchException()); res *= 10; res += (c - '0'); c = snext(); }while(!isSpaceChar(c));return (res * sgn);} public long nextLong(){ int c = snext(); while(isSpaceChar(c)){c = snext(); } int sgn = 1; if ( (c == '-')) {sgn = -1; c = snext(); } long res = 0; do {if ( ((c < '0') || (c > '9'))) throw (new InputMismatchException()); res *= 10; res += (c - '0'); c = snext(); }while(!isSpaceChar(c));return (res * sgn);} public boolean isSpaceChar( int c){ if ( (filter != null)) return filter.isSpaceChar(c); return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} private boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } }
3	public class CF{ private FastScanner in ; private PrintWriter out ; final int mod = ((int)1e9 + 7); private long f( String s, int digit){ final int n = s.length();  int[][] dp = new int[2][(n + 1)]; dp[0][0] = 1; int[][] ndp = new int[2][(n + 1)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < 2);j++) {Arrays.fill(ndp[j],0); }for ( int less = 0;(less < 2);less++) {for ( int cntBigger = 0;(cntBigger <= n);cntBigger++) { int cur = dp[less][cntBigger]; if ( (cur == 0)) {continue;} int max = ((less == 1)?9:(s.charAt(i) - '0')); for ( int next = 0;(next <= max);next++) { int nextLess = (((less == 1) || (next < max))?1:0);  int nextCntBigger = (cntBigger + ((next >= digit)?1:0)); ndp[nextLess][nextCntBigger] += cur; while((ndp[nextLess][nextCntBigger] >= mod)){ndp[nextLess][nextCntBigger] -= mod; }}}} int[][] tmp = dp; dp = ndp; ndp = tmp; } long result = 0; for ( int less = 0;(less < 2);less++) { long sum = 0; for ( int cntBigger = 1;(cntBigger <= n);cntBigger++) {sum = (((sum * 10) + 1) % mod); result = ((result + (sum * dp[less][cntBigger])) % mod); }}return (result % mod);} private void solve(){ final String number = in.next();  long result = 0; for ( int digit = 1;(digit < 10);digit++) { long cur = f(number,digit); result += cur; }out.println((result % mod)); } private void runIO(){ in = new FastScanner(System.in); out = new PrintWriter(System.out); solve(); out.close(); } private class FastScanner{ BufferedReader br ; StringTokenizer st ; FastScanner( File f){ try{br = new BufferedReader(new FileReader(f)); }catch (FileNotFoundException e){ e.printStackTrace(); } } FastScanner( InputStream f){ br = new BufferedReader(new InputStreamReader(f)); } String next(){ while(((st == null) || !st.hasMoreTokens())){ String s = null; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } if ( (s == null)) return null; st = new StringTokenizer(s); }return st.nextToken();} boolean hasMoreTokens(){ while(((st == null) || !st.hasMoreTokens())){ String s = null; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } if ( (s == null)) return false; st = new StringTokenizer(s); }return true;} } public static void main( String[] args){ new CF().runIO(); } }
0	public class A{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long n = in.nextLong(); System.out.println(25); } }
2	public class P1177A{ public static void main( String[] args)throws Exception { BufferedReader r = new BufferedReader(new InputStreamReader(System.in));  long n = Long.parseLong(r.readLine()); if ( (n < 10)) {System.out.print(n); return ;} int len = 1;  long edge = 10;  long prev = 0;  long prepow = 0; while(((edge - 1) < n)){prepow = (long)Math.pow(10,len); long pow = (prepow * 10); prev = edge; edge = (edge + ((pow - prepow) * (len + 1))); len += 1; } long b = (n - prev);  long c = (b / len);  int rem = (int)(b % len);  String s = (Long.toString((prepow + c)).charAt(rem) + ""); System.out.print(s); } }
4	public class e_g14{ public static void main( String[] args)throws Exception { FastScanner in = new FastScanner(System.in);  OutputStream outputStream = System.out;  PrintWriter out = new PrintWriter(outputStream);  int T = 1;  Solver A = new Solver(in,out); for ( int aa = 0;(aa < T);aa++) {A.answer((aa + 1)); }out.close(); } static class Solver{ FastScanner in ; PrintWriter out ; int n ; long m ; long[] fact ,pow ,choose[] ,dp[] ; public Solver( FastScanner in, PrintWriter out){ this.in = in; this.out = out; } public void answer( int aa)throws Exception { n = in.nextInt(); m = in.nextLong(); fact = new long[(n + 5)]; choose = new long[(n + 5)][(n + 5)]; dp = new long[(n + 2)][(n + 2)]; pow = new long[(n + 2)]; init(); dp[0][0] = 1; for ( int i = 0;(i <= n);i++) {for ( int j = 0;(j <= i);j++) {for ( int k = 1;((i + k) <= n);k++) {dp[((i + k) + 1)][(j + k)] += (((dp[i][j] * choose[(j + k)][k]) % m) * pow[(k - 1)]); dp[((i + k) + 1)][(j + k)] %= m; }}} long ans = 0; for ( int i = 0;(i <= n);i++) {ans += dp[(n + 1)][i]; ans %= m; }out.println(ans); } public void init(){ fact[0] = 1; for ( int i = 1;(i <= (n + 4));i++) {fact[i] = ((i * fact[(i - 1)]) % m); }pow[0] = 1; for ( int i = 1;(i <= (n + 1));i++) {pow[i] = ((2 * pow[(i - 1)]) % m); }for ( int i = 0;(i <= (n + 4));i++) {for ( int j = 0;(j <= i);j++) {choose[i][j] = choose(i,j); }}} private long choose( int a, int b){ long res = ((fact[a] * inv(((fact[b] * fact[(a - b)]) % m))) % m); return res;} private long power( long x, long y){ long res = 1; while((y > 0)){if ( ((y % 2) == 1)) res = ((res * x) % m); x = ((x * x) % m); y /= 2; }return (res % m);} private long inv( long a){ return power(a,(m - 2));} } static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream stream){ br = new BufferedReader(new InputStreamReader(stream)); st = new StringTokenizer(""); } public FastScanner( String fileName)throws Exception{ br = new BufferedReader(new FileReader(new File(fileName))); st = new StringTokenizer(""); } public String next()throws Exception { while(!st.hasMoreTokens()){st = new StringTokenizer(br.readLine()); }return st.nextToken();} public int nextInt()throws Exception { return Integer.parseInt(next());} public long nextLong()throws Exception { return Long.parseLong(next());} } }
0	public class LCMChallenge{ public static void main( String[] args){ Scanner in = new Scanner(new BufferedInputStream(System.in));  long N = in.nextLong(); if ( ((N == 1) || (N == 2))) {System.out.printf("%d\n",N); return ;} if ( ((N & 1) == 1)) { long lcm = ((N * (N - 1)) * (N - 2)); System.out.printf("%d\n",lcm); } else {if ( (N == 4)) {System.out.printf("12\n"); } else { long lcm ; if ( ((N % 3) == 0)) {lcm = (((N - 1) * (N - 2)) * (N - 3)); } else {lcm = ((N * (N - 1)) * (N - 3)); }System.out.printf("%d\n",lcm); }}} }
3	public class C{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int r = sc.nextInt();  int[] arr = new int[n]; for ( int i = 0;(i < n);i++) arr[i] = sc.nextInt(); double[] ans = new double[n]; for ( int i = 0;(i < n);i++) { double max = 0; for ( int j = 0;(j < i);j++) { int difx = Math.abs((arr[i] - arr[j])); if ( (difx <= (2 * r))) {max = Math.max(max,(ans[j] + Math.sqrt((((4 * r) * r) - (difx * difx))))); } }ans[i] = max; } PrintWriter pw = new PrintWriter(System.out); for ( int i = 0;(i < n);i++) pw.print(((ans[i] + r) + " ")); pw.flush(); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public boolean ready()throws IOException { return br.ready();} } }
2	public class Main{ final int mod = 1000000007; final int maxn = -1; final double eps = 1e-9; long digits( long n){ if ( (n == 0)) return 0; int p = (int)Math.log10(n); return (((p + 1) * ((n - (long)Math.pow(10,p)) + 1)) + digits(((long)Math.pow(10,p) - 1)));} void solve(){ String s = "";  long k = nextLong();  long i = 1;  long j = k; while((i < j)){ long m = ((i + j) / 2); if ( (digits(m) < k)) {i = (m + 1); } else {j = m; }}if ( (digits(i) >= k)) --i; printf("%c\n",String.valueOf((i + 1)).charAt((int)((k - digits(i)) - 1))); } final double pi = Math.acos(-1.0); final long infl = 0x3f3f3f3f3f3f3f3fl; final int inf = 0x3f3f3f3f; final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null); PrintWriter out ; BufferedReader reader ; StringTokenizer tokens ; Main(){ long s = System.currentTimeMillis(); tokens = new StringTokenizer(""); reader = new BufferedReader(new InputStreamReader(System.in),(1 << 15)); out = new PrintWriter(System.out); Locale.setDefault(Locale.US); solve(); out.close(); debug("Time elapsed: %dms",(System.currentTimeMillis() - s)); } long nextLong(){ return Long.parseLong(next());} String next(){ readTokens(); return tokens.nextToken();} boolean readTokens(){ while(!tokens.hasMoreTokens()){try{ String line = reader.readLine(); if ( (line == null)) return false; tokens = new StringTokenizer(line); }catch (IOException e){ throw (new RuntimeException(e));} }return true;} void printf( String s, Object... o){ out.printf(s,o); } void debug( String s, Object... o){ if ( !ONLINE_JUDGE) System.err.printf((((((char)27 + "[91m") + s) + (char)27) + "[0m"),o); } public static void main( String[] args){ new Main(); } }
0	public class CF{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  int n = sc.nextInt(); pw.print((n + (n / 2))); pw.close(); sc.close(); } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastReader in = new FastReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ FastReader in ; PrintWriter out ; int n ; public void solve( int testNumber, FastReader in, PrintWriter out){ this.in = in; this.out = out; n = in.nextInt(); if ( ((n % 4) != 0)) {out.println("! -1"); return ;} int low = 0;  int high = (n >> 1); if ( (BValue(low) == 0)) {out.println(("! " + (low + 1))); return ;} int fSign = Integer.signum(BValue(low)); while(((high - low) > 1)){ int mid = ((high + low) >> 1);  int mSign = Integer.signum(BValue(mid)); if ( (mSign == 0)) {out.println(("! " + (mid + 1))); return ;} if ( (mSign == -fSign)) {high = mid; } else {low = mid; }}out.println("! -1"); } public int BValue( int index){ out.println(("? " + (index + 1))); out.flush(); int f = in.nextInt(); out.println(("? " + ((index + 1) + (n >> 1)))); out.flush(); int s = in.nextInt(); return (f - s);} } static class FastReader{ private InputStream stream ; private byte[] buf = new byte[8192]; private int curChar ; private int pnumChars ; public FastReader( InputStream stream){ this.stream = stream; } private int pread(){ if ( (pnumChars == -1)) {throw (new InputMismatchException());} if ( (curChar >= pnumChars)) {curChar = 0; try{pnumChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (pnumChars <= 0)) {return -1;} } return buf[curChar++];} public int nextInt(){ int c = pread(); while(isSpaceChar(c))c = pread(); int sgn = 1; if ( (c == '-')) {sgn = -1; c = pread(); } int res = 0; do {if ( (c == ',')) {c = pread(); } if ( ((c < '0') || (c > '9'))) {throw (new InputMismatchException());} res *= 10; res += (c - '0'); c = pread(); }while(!isSpaceChar(c));return (res * sgn);} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
0	public class again_25{ public static void main( String[] ar)throws IOException { long n ;  BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); n = Long.parseLong(br.readLine()); System.out.println("25"); } }
4	public class R227_2_D{ static ArrayList<Integer>[] graph ; static int[] right ,left ; static boolean vis[] ; public static boolean dfs( int node){ if ( vis[node]) return false; vis[node] = true; for ( int i = 0;(i < graph[node].size());i++) { int tmp = graph[node].get(i); if ( (right[tmp] == -1)) {left[node] = tmp; right[tmp] = node; return true;} }for ( int i = 0;(i < graph[node].size());i++) { int tmp = graph[node].get(i); if ( dfs(right[tmp])) {left[node] = tmp; right[tmp] = node; return true;} }return false;} public static int getMaxMatch(){ Arrays.fill(left,-1); Arrays.fill(right,-1); boolean done = false; while(!done){done = true; Arrays.fill(vis,false); for ( int i = 0;(i < graph.length);i++) {if ( ((left[i] == -1) && dfs(i))) {done = false; } }} int res = 0; for ( int i = 0;(i < left.length);i++) {res += ((left[i] != -1)?1:0); }return res;} public static void main( String[] args){ InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  int V = in.readInt();  int E = in.readInt();  Point[] edges = new Point[E]; for ( int i = 0;(i < edges.length);i++) {edges[i] = new Point((in.readInt() - 1),(in.readInt() - 1)); } int best = Integer.MAX_VALUE; for ( int k = 0;(k < V);k++) { int n = (V - 1); graph = new ArrayList[n]; left = new int[n]; vis = new boolean[n]; right = new int[n]; for ( int i = 0;(i < graph.length);i++) {graph[i] = new ArrayList<Integer>(); } int center = 0; for ( int i = 0;(i < E);i++) {if ( ((edges[i].x == k) || (edges[i].y == k))) {center++; continue;} int src = ((edges[i].x > k)?(edges[i].x - 1):edges[i].x);  int dst = ((edges[i].y > k)?(edges[i].y - 1):edges[i].y); graph[src].add(dst); } int matching = getMaxMatch();  int addToCenterEdges = (((2 * V) - 1) - center);  int removed = ((E - center) - matching);  int added = (n - matching); best = Math.min(best,((added + removed) + addToCenterEdges)); }System.out.println(best); } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1000]; private int curChar ,numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read(){ if ( (numChars == -1)) throw (new InputMismatchException()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} public 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);} 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))){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();} } }
4	public class GeorgeAndInterestingGraph{ public static void main( String[] args){ MyScanner sc = new MyScanner();  int N = sc.nextInt();  int M = sc.nextInt();  int[] edgeFrom = new int[M];  int[] edgeTo = new int[M]; for ( int i = 0;(i < M);i++) {edgeFrom[i] = sc.nextInt(); edgeTo[i] = sc.nextInt(); } int best = Integer.MAX_VALUE; for ( int i = 0;(i < N);i++) { boolean[][] mat = makeAdjMat(N,edgeFrom,edgeTo); best = Math.min(best,count(mat,M,i)); }System.out.println(best); } public static int count( boolean[][] mat, int M, int center){ int N = mat.length;  int centerCount = (mat?1:0); for ( int i = 0;(i < N);i++) {if ( (i != center)) {if ( mat[i][center]) {centerCount++; } if ( mat[center][i]) {centerCount++; } } mat[i][center] = false; mat[center][i] = false; } int other = (M - centerCount);  int matches = bipartiteMatching(mat); return ((((((((2 * N) - 1) - centerCount) + other) - matches) + N) - 1) - matches);} public static boolean[][] makeAdjMat( int N, int[] edgeFrom, int[] edgeTo){ boolean[][] mat = new boolean[N][N]; for ( int i = 0;(i < edgeFrom.length);i++) { int from = (edgeFrom[i] - 1);  int to = (edgeTo[i] - 1); mat[from][to] = true; }return mat;} public static boolean bipartiteMatchingHelper( boolean[][] bpGraph, int u, boolean[] seen, int[] matchR){ int N = bpGraph[0].length; for ( int v = 0;(v < N);v++) {if ( (bpGraph[u][v] && !seen[v])) {seen[v] = true; if ( ((matchR[v] < 0) || bipartiteMatchingHelper(bpGraph,matchR[v],seen,matchR))) {matchR[v] = u; return true;} } }return false;} public static int bipartiteMatching( boolean[][] bpGraph, int[] matchIJ, int[] matchJI){ int ans = bipartiteMatching(bpGraph,matchJI); for ( int i = 0;(i < matchJI.length);i++) {matchIJ[i] = -1; }for ( int j = 0;(j < matchJI.length);j++) { int i = matchJI[j]; if ( (i >= 0)) {matchIJ[i] = j; } }return ans;} public static int bipartiteMatching( boolean[][] bpGraph, int[] matchJI){ int M = bpGraph.length;  int N = bpGraph[0].length; for ( int i = 0;(i < N);i++) {matchJI[i] = -1; } int ans = 0; for ( int u = 0;(u < M);u++) { boolean[] seen = new boolean[N]; if ( bipartiteMatchingHelper(bpGraph,u,seen,matchJI)) {ans++; } }return ans;} public static int bipartiteMatching( boolean[][] bpGraph){ int N = bpGraph[0].length;  int[] matchJI = new int[N]; return bipartiteMatching(bpGraph,matchJI);} public static int bipartiteMatching( int[][] intGraph){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph);} public static int bipartiteMatching( int[][] intGraph, int[] matchJI){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph,matchJI);} public static int bipartiteMatching( int[][] intGraph, int[] matchIJ, int[] matchJI){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph,matchIJ,matchJI);} public static boolean[][] intToBooleanAdjMat( int[][] mat){ int M = mat.length;  int N = mat[0].length;  boolean[][] bMat = new boolean[M][N]; for ( int i = 0;(i < M);i++) {for ( int j = 0;(j < N);j++) {bMat[i][j] = (mat[i][j] != 0); }}return bMat;} public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } int nextInt(){ return Integer.parseInt(next());} String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} } }
2	public class Main{ public static void main( String[] args){ new Main().run(); } FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ int q = in.nextInt(); for ( int i = 0;(i < q);i++) {work(); }out.flush(); } long mod = 1000000007; long gcd( long a, long b){ return ((a == 0)?b:((b > a)?gcd((b % a),a):gcd(b,a)));} void work(){ long n = in.nextLong();  long k = in.nextLong(); if ( (k == 0)) {out.println((("YES" + " ") + n)); } long a = 0,b = 0,c = 1,d = 1; while(((--n >= 0) && (a <= k))){b += c; c *= 4; a += d; d = ((d * 2) + 1); long t = count((c - d),n); if ( ((a <= k) && (b >= (k - t)))) {out.println((("YES" + " ") + n)); return ;} }out.println("NO"); } private long count( long l, long n){ if ( (n == 0)) return 0; n--; long ret = l; for ( int i = 1;(i <= n);i++) { long t = ret; ret *= 4; if ( ((ret / 4) != t)) return Long.MAX_VALUE; }return ret;} } class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ if ( ((st == null) || !st.hasMoreElements())) {try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } } return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} }
6	public class E16{ static StreamTokenizer in ; static PrintWriter out ; static int nextInt()throws IOException { in.nextToken(); return (int)in.nval;} static double nextDouble()throws IOException { in.nextToken(); return in.nval;} public static void main( String[] args)throws IOException { in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); n = nextInt(); t = (1 << n); m = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) m[i][j] = nextDouble(); memo = new double[t]; Arrays.fill(memo,Double.POSITIVE_INFINITY); for ( int i = 0;(i < n);i++) out.print((String.format(Locale.US,"%.6f",solve((1 << i))) + " ")); out.println(); out.flush(); } static int n ,t ; static double[][] m ; static double[] memo ; static double solve( int mask){ if ( (memo[mask] != Double.POSITIVE_INFINITY)) return memo[mask]; if ( (mask == (t - 1))) return memo[mask] = 1; int k = Integer.bitCount(mask); k = (((k + 1) * k) / 2); double res = 0; for ( int i = 0;(i < n);i++) if ( ((mask & (1 << i)) != 0)) for ( int j = 0;(j < n);j++) if ( ((mask & (1 << j)) == 0)) res += (m[i][j] * solve((mask | (1 << j))));  return memo[mask] = (res / k);} }
2	public class A{ InputStream is ; PrintWriter out ; String INPUT = ""; public static long pow( long a, long n, long mod){ long ret = 1;  int x = (63 - Long.numberOfLeadingZeros(n)); for ( ;(x >= 0);x--) {ret = ((ret * ret) % mod); if ( ((n << (63 - x)) < 0)) ret = ((ret * a) % mod); }return ret;} void solve(){ int n = ni(),m = ni(),K = ni(); if ( (m <= (((n / K) * (K - 1)) + (n % K)))) {out.println(m); } else { int mod = 1000000009;  int f = (m - (((n / K) * (K - 1)) + (n % K))); out.println((((((pow(2,(f + 1),mod) + mod) - 2) * K) + (m - (f * K))) % mod)); }} 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 A().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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
1	public class Main{ static Graph graph[] ; public static void dfs( int index){ Graph z = graph[index]; z.vis = 1; Graph v ; for ( int i = 0;(i < z.adj.size());i++) {v = z.adj.get(i); if ( (v.vis == 0)) {v.dist = (z.dist + 1); v.parent = z.val; dfs(v.val); } }} static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } public static void main( String[] args){ FastReader sc = new FastReader();  int n = sc.nextInt();  Pair arr[] = new Pair[n];  Pair pref[] = new Pair[n];  Pair suff[] = new Pair[n]; for ( int i = 0;(i < n);i++) { long u = sc.nextLong();  long v = sc.nextLong(); arr[i] = new Pair(u,v); pref[i] = new Pair(0,0); suff[i] = new Pair(0,0); }pref[0].x = arr[0].x; pref[0].y = arr[0].y; for ( int i = 1;(i < n);i++) {pref[i].x = (long)Math.max(pref[(i - 1)].x,arr[i].x); pref[i].y = (long)Math.min(pref[(i - 1)].y,arr[i].y); }suff[(n - 1)].x = arr[(n - 1)].x; suff[(n - 1)].y = arr[(n - 1)].y; for ( int i = (n - 2);(i >= 0);i--) {suff[i].x = (long)Math.max(suff[(i + 1)].x,arr[i].x); suff[i].y = (long)Math.min(suff[(i + 1)].y,arr[i].y); } long max = Long.MIN_VALUE;  long ans = 0; for ( int i = 0;(i < n);i++) { long val = Long.MAX_VALUE;  long val1 = Long.MAX_VALUE; if ( ((i != 0) && (i != (n - 1)))) {val = ((long)Math.min(pref[(i - 1)].y,suff[(i + 1)].y) - (long)Math.max(pref[(i - 1)].x,suff[(i + 1)].x)); } else if ( (i != (n - 1))) {val = (suff[(i + 1)].y - suff[(i + 1)].x); } else val = (pref[(i - 1)].y - pref[(i - 1)].x); ans = val; if ( (ans < 0)) ans = 0; max = (long)Math.max(ans,max); }System.out.println(max); } } class Pair{ long x ,y ; Pair( long x, long y){ this.x = x; this.y = y; } }
2	public class OlyaAndMagicalSquare{ public static void solveCase( FastIO io){ int N = io.nextInt();  long K = io.nextLong();  CountMap cm = new CountMap(); cm.increment(N,BigInteger.ONE); long rem = K;  int moves = 1;  int sqSize = N; while((sqSize > 0)){ long need = ((1L << moves) - 1);  BigInteger biNeed = BigInteger.valueOf(need); cm.decrement(sqSize,biNeed); if ( (need > rem)) {break;} cm.increment((sqSize - 1),biNeed.multiply(BigInteger.valueOf(4))); rem -= need; ++moves; --sqSize; } BigInteger biRem = BigInteger.valueOf(rem); for ( int i = N;(i > 0);--i) { BigInteger have = cm.getCount(i); if ( (have.compareTo(biRem) >= 0)) {biRem = BigInteger.ZERO; break;} biRem = biRem.subtract(have); cm.decrement(i,have); cm.increment((i - 1),have.multiply(BigInteger.valueOf(4))); }if ( biRem.equals(BigInteger.ZERO)) {io.printf("YES %d\n",sqSize); } else {io.println("NO"); }} static private class CountMap extends HashMap<Integer,BigInteger>{ public void increment( int k, BigInteger v){ put(k,getCount(k).add(v)); } public void decrement( int k, BigInteger v){ BigInteger next = getCount(k).subtract(v); if ( next.equals(BigInteger.ZERO)) {remove(k); } else {put(k,next); }} public BigInteger getCount( int k){ return getOrDefault(k,BigInteger.ZERO);} } public static void solve( FastIO io){ int T = io.nextInt(); for ( int t = 0;(t < T);++t) {solveCase(io); }} public static class FastIO{ private InputStream reader ; private PrintWriter writer ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public FastIO( InputStream r, OutputStream w){ reader = r; writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(w))); } public int read(){ if ( (numChars == -1)) throw (new InputMismatchException()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = reader.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} public String nextString(){ 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 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 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 int[] nextIntArray( int n){ return nextIntArray(n,0);} public int[] nextIntArray( int n, int off){ int[] arr = new int[(n + off)]; for ( int i = 0;(i < n);i++) {arr[(i + off)] = nextInt(); }return arr;} public long[] nextLongArray( int n){ return nextLongArray(n,0);} public long[] nextLongArray( int n, int off){ long[] arr = new long[(n + off)]; for ( int i = 0;(i < n);i++) {arr[(i + off)] = nextLong(); }return arr;} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} private boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }} public void println( Object... objects){ print(objects); writer.println(); } public void printArray( int[] arr){ for ( int i = 0;(i < arr.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(arr[i]); }} public void printArray( long[] arr){ for ( int i = 0;(i < arr.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(arr[i]); }} public void printf( String format, Object... args){ print(String.format(format,args)); } public void flush(){ writer.flush(); } } public static void main( String[] args){ FastIO io = new FastIO(System.in,System.out); solve(io); io.flush(); } }
2	public class A{ private long pow( long num, long pow, long mod){ if ( (pow <= 0)) {return 1;} if ( ((pow & 1) != 0)) {return ((num * pow(num,(pow - 1),mod)) % mod);} else { long tmp = (pow(num,(pow >> 1),mod) % mod); return ((tmp * tmp) % mod);}} public void run(){ long MOD = 1000000009;  long n = nextInt();  long m = nextInt();  long k = nextInt();  long critical = (n / k); if ( ((n - critical) >= m)) {out.println(m); } else { long doubles = (m - (n - critical));  long ans = (((pow(2,(doubles + 1),MOD) - 2) + MOD) % MOD); ans = ((ans * k) % MOD); ans = ((ans + (m - (doubles * k))) % MOD); out.println(ans); }out.flush(); } static private BufferedReader br = null; static private StringTokenizer stk = null; static private PrintWriter out = null; public static void main( String[] args)throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); new A().run(); } private void loadLine(){ try{stk = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } } private int nextInt(){ while(((stk == null) || !stk.hasMoreElements()))loadLine(); return Integer.parseInt(stk.nextToken());} }
3	public class MainG{ static StdIn in = new StdIn(); static PrintWriter out = new PrintWriter(System.out); static long M = ((long)1e9 + 7); static int n ,dig ; static int[] x ; static long[] p10 ,s ; static long[][][] dp ; public static void main( String[] args){ char[] cs = in.next().toCharArray(); n = cs.length; x = new int[n]; for ( int i = 0;(i < n);++i) x[i] = (cs[i] - '0'); p10 = new long[n]; p10[0] = 1; for ( int i = 1;(i < n);++i) p10[i] = ((p10[(i - 1)] * 10) % M); s = new long[(n + 1)]; s[n] = 1; for ( int i = (n - 1);(i >= 0);--i) s[i] = ((s[(i + 1)] + (x[i] * p10[((n - 1) - i)])) % M); long ans = 0; dp = new long[2][n][(n + 1)]; for ( dig = 1;(dig <= 9);++dig) {for ( int i = 0;(i < n);++i) {Arrays.fill(dp[0][i],-1); Arrays.fill(dp[1][i],-1); }for ( int i = 1;(i <= n);++i) ans = ((ans + (p10[(i - 1)] * dp(0,0,i))) % M); }out.println(ans); out.close(); } static long dp( int less, int ignore, int need){ if ( (need == 0)) return ((less == 1)?p10[(n - ignore)]:s[ignore]); if ( (ignore == n)) return 0; if ( (dp[less][ignore][need] != -1)) return dp[less][ignore][need]; long res = 0;  int lim = ((less == 1)?9:x[ignore]); for ( int i = 0;(i <= lim);++i) res = ((res + dp((less | ((i < lim)?1:0)),(ignore + 1),(need - ((i >= dig)?1:0)))) % M); return dp[less][ignore][need] = res;} interface Input{ public String next(); ; public int nextInt(); public long nextLong(); ; } static class StdIn implements Input{ private final int BUFFER_SIZE = (1 << 16); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ,bytesRead ; public StdIn(){ din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public StdIn( InputStream in){ try{din = new DataInputStream(in); }catch (Exception e){ throw (new RuntimeException());} buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String next(){ int c ; while((((c = read()) != -1) && (((c == ' ') || (c == '\n')) || (c == '\r')))); StringBuilder s = new StringBuilder(); while((c != -1)){if ( (((c == ' ') || (c == '\n')) || (c == '\r'))) break; s.append((char)c); c = read(); }return s.toString();} public int nextInt(){ 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(){ 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;} private void fillBuffer()throws IOException { bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) buffer[0] = -1; } private byte read(){ try{if ( (bufferPointer == bytesRead)) fillBuffer(); return buffer[bufferPointer++]; }catch (IOException e){ throw (new RuntimeException());} } public void close()throws IOException { if ( (din == null)) return ; din.close(); } } }
4	public class Main{ static long MOD = 1_000_000_007L; static long inv2 = ((MOD + 1) / 2); static int[][] dir = new int[][]{{1,0},{0,1},{-1,0},{0,-1}}; static long lMax = 0x3f3f3f3f3f3f3f3fL; static int iMax = 0x3f3f3f3f; static HashMap<Long,Long> memo = new HashMap(); static MyScanner sc = new MyScanner(); static int nn = 300000; static long[] pow2 ; static long[] fac ; static long[] pow ; static long[] inv ; static long[] facInv ; static int[] base ; static int[] numOfDiffDiv ; static int[] numOfDiv ; static ArrayList<Integer> primes ; static int ptr = 0; static boolean[] isPrime ; public static PrintWriter out ; public static void main( String[] args){ out = new PrintWriter(new BufferedOutputStream(System.out)); int t = 1,tt = 0; for ( int i = 1;(i < 40000);i++) squares.add((i * i)); while((tt++ < t)){ boolean res = solve(); }out.close(); } static HashSet<Integer> squares = new HashSet(); static boolean solve(){ long res = 0;  int n = sc.ni();  long m = sc.nl();  long[][][] dp = new long[2][(n + 3)][(n + 3)];  long[][][] dp2 = new long[2][(n + 3)][(n + 3)]; dp[0][2][1] = dp[1][2][2] = dp2[0][1][1] = 1L; for ( int i = 3;(i <= n);i++) { long[][] bef = dp[0];  long[][] aft = dp[1];  long[][] nbef = new long[(n + 3)][(n + 3)];  long[][] naft = new long[(n + 3)][(n + 3)]; for ( int len = 1;(len <= i);len++) {for ( int ind = 1;(ind <= len);ind++) {nbef[(len + 1)][1] += bef[len][ind]; nbef[(len + 1)][(ind + 1)] -= bef[len][ind]; naft[(len + 1)][(ind + 1)] += bef[len][ind]; naft[(len + 1)][(ind + 1)] += aft[len][ind]; nbef[(len + 1)][1] += (dp2[0][len][ind] + dp2[1][len][ind]); }}for ( int len = 1;(len <= i);len++) {for ( int ind = 1;(ind <= len);ind++) {nbef[len][ind] = (((nbef[len][ind] + nbef[len][(ind - 1)]) + (10000000L * m)) % m); naft[len][ind] = (((naft[len][ind] + naft[len][(ind - 1)]) + (10000000L * m)) % m); }}dp2 = dp; dp = new long[][][]{nbef,naft}; }for ( long[] row :dp[0]) for ( long i :row) res += i; for ( long[] row :dp[1]) for ( long i :row) res += i; out.println((res % m)); return false;} public static int[][] packU( int n, int[] from, int[] to){ return packU(n,from,to,from.length);} public static int[][] packU( int n, int[] from, int[] to, int sup){ int[][] g = new int[n][];  int[] p = new int[n]; for ( int i = 0;(i < sup);i++) p[from[i]]++; for ( int i = 0;(i < sup);i++) p[to[i]]++; for ( int i = 0;(i < n);i++) g[i] = new int[p[i]]; for ( int i = 0;(i < sup);i++) {g[from[i]][--p[from[i]]] = to[i]; g[to[i]][--p[to[i]]] = from[i]; }return g;} public static int lowerBound( int[] a, int v){ return lowerBound(a,0,a.length,v);} public static int lowerBound( int[] a, int l, int r, int v){ if ( (((l > r) || (l < 0)) || (r > a.length))) throw (new IllegalArgumentException()); int low = (l - 1),high = r; while(((high - low) > 1)){ int h = ((high + low) >>> 1); if ( (a[h] >= v)) {high = h; } else {low = h; }}return high;} public static long quickPOW( long n, long m){ long ans = 1l; while((m > 0)){if ( ((m % 2) == 1)) ans = ((ans * n) % MOD); n = ((n * n) % MOD); m >>= 1; }return ans;} public static long quickPOW( long n, long m, long mod){ long ans = 1l; while((m > 0)){if ( ((m % 2) == 1)) ans = ((ans * n) % mod); n = ((n * n) % mod); m >>= 1; }return ans;} public static int gcd( int a, int b){ if ( ((a % b) == 0)) return b; return gcd(b,(a % b));} public static long gcd( long a, long b){ if ( ((a % b) == 0)) return b; return gcd(b,(a % b));} static class RandomWrapper{ private Random random ; public static final RandomWrapper INSTANCE = new RandomWrapper(new Random()); public RandomWrapper(){ this(new Random()); } public RandomWrapper( Random random){ this.random = random; } public int nextInt( int l, int r){ return (random.nextInt(((r - l) + 1)) + l);} } public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int ni(){ return Integer.parseInt(next());} long nl(){ return Long.parseLong(next());} } }
3	public class Main{ public static void main( String[] args)throws Exception { new Main().go(); } PrintWriter out ; Reader in ; BufferedReader br ; Main()throws IOException{ try{in = new Reader("input.txt"); out = new PrintWriter(new BufferedWriter(new FileWriter("output.txt"))); }catch (Exception e){ in = new Reader(); out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); } } void go()throws Exception { int t = 1; while((t > 0)){solve(); t--; }out.flush(); out.close(); } int inf = 2000000000; int mod = 1000000007; double eps = 0.000000001; int n ; int m ; ArrayList<Pair>[] g ; String s ; int[][] a ; void solve()throws IOException { int n = in.nextInt();  int m = in.nextInt(); a = new int[n][m]; for ( int i = 0;(i < n);i++) { String s = in.nextLine(); for ( int j = 0;(j < m);j++) {a[i][j] = s.charAt(j); }} int[][] f = new int[n][m]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < m);j++) f[i][j] = inf; for ( int i = 0;(i < n);i++) { int cnt = 0; for ( int j = 0;(j < m);j++) {if ( (a[i][j] == '*')) {f[i][j] = Math.min(f[i][j],cnt); cnt++; } else {cnt = 0; }}}for ( int i = 0;(i < n);i++) { int cnt = 0; for ( int j = (m - 1);(j >= 0);j--) {if ( (a[i][j] == '*')) {f[i][j] = Math.min(f[i][j],cnt); cnt++; } else {cnt = 0; }}}for ( int j = 0;(j < m);j++) { int cnt = 0; for ( int i = 0;(i < n);i++) {if ( (a[i][j] == '*')) {f[i][j] = Math.min(f[i][j],cnt); cnt++; } else {cnt = 0; }}}for ( int j = 0;(j < m);j++) { int cnt = 0; for ( int i = (n - 1);(i >= 0);i--) {if ( (a[i][j] == '*')) {f[i][j] = Math.min(f[i][j],cnt); cnt++; } else {cnt = 0; }}} ArrayList<Item> ans = new ArrayList<>(); for ( int i = 0;(i < n);i++) for ( int j = 0;(j < m);j++) {if ( ((a[i][j] == '*') && (f[i][j] > 0))) ans.add(new Item((i + 1),(j + 1),f[i][j])); } boolean[][] used = new boolean[n][m]; for ( int i = 0;(i < n);i++) { int cnt = 0; for ( int j = 0;(j < m);j++) {if ( ((a[i][j] == '*') && (f[i][j] > 0))) {cnt = Math.max(cnt,(f[i][j] + 1)); } if ( (cnt > 0)) used[i][j] = true; cnt--; }cnt = 0; for ( int j = (m - 1);(j >= 0);j--) {if ( ((a[i][j] == '*') && (f[i][j] > 0))) {cnt = Math.max(cnt,(f[i][j] + 1)); } if ( (cnt > 0)) used[i][j] = true; cnt--; }}for ( int j = 0;(j < m);j++) { int cnt = 0; for ( int i = 0;(i < n);i++) {if ( ((a[i][j] == '*') && (f[i][j] > 0))) {cnt = Math.max(cnt,(f[i][j] + 1)); } if ( (cnt > 0)) used[i][j] = true; cnt--; }cnt = 0; for ( int i = (n - 1);(i >= 0);i--) {if ( ((a[i][j] == '*') && (f[i][j] > 0))) {cnt = Math.max(cnt,(f[i][j] + 1)); } if ( (cnt > 0)) used[i][j] = true; cnt--; }}for ( int i = 0;(i < n);i++) for ( int j = 0;(j < m);j++) if ( ((a[i][j] == '*') && !used[i][j])) {out.println(-1); return ;} out.println(ans.size()); for ( Item i :ans) out.println(((((i.a + " ") + i.b) + " ") + i.c)); } class Item{ int a ; int b ; int c ; Item( int a, int b, int c){ this.a = a; this.b = b; this.c = c; } } class Reader{ BufferedReader br ; StringTokenizer tok ; Reader( String file)throws IOException{ br = new BufferedReader(new FileReader(file)); } Reader()throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); } String next()throws IOException { while(((tok == null) || !tok.hasMoreElements()))tok = new StringTokenizer(br.readLine()); return tok.nextToken();} int nextInt()throws NumberFormatException,IOException { return Integer.valueOf(next());} String nextLine()throws IOException { return br.readLine();} } }
2	public class Test4{ PrintWriter pw = new PrintWriter(System.out); InputStream is = System.in; Random rnd = new Random(); int a ; void run(){ a = ni(); for ( int q = 0;(q < a);q++) { long nj = ni(),kj = nl();  BigInteger n = BigInteger.valueOf(nj),k = BigInteger.valueOf(kj); if ( ((nj < 40) && (k.compareTo(BigInteger.valueOf(2).pow((2 * (int)nj)).divide(BigInteger.valueOf(3))) > 0))) {System.out.println("NO"); continue;} if ( (nj >= 40)) {System.out.println(("YES " + (nj - 1))); continue;} long log = nj;  BigInteger maxop = BigInteger.valueOf(2).pow((2 * (int)nj)).divide(BigInteger.valueOf(3)),pth = BigInteger.ONE; for ( BigInteger c = BigInteger.ONE;(log > 0);log--,c = c.multiply(BigInteger.valueOf(2)).add(BigInteger.ONE)) {if ( (k.compareTo(c) < 0)) break; pth = c.multiply(BigInteger.valueOf(2)).add(BigInteger.ONE); k = k.subtract(c); maxop = maxop.subtract(c); }maxop = maxop.subtract(pth.multiply(BigInteger.valueOf(2).pow((2 * (int)log)).divide(BigInteger.valueOf(3)))); if ( (k.compareTo(maxop) <= 0)) System.out.println(("YES " + log)); else System.out.println("NO"); }pw.flush(); } public static void main( String[] args){ new Test4().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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(); }} }
3	public class Main{ public static void main( String[] args)throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  BufferedWriter out = new BufferedWriter(new OutputStreamWriter(System.out));  String[] line = in.readLine().split(" ");  int n = Integer.parseInt(line[0]);  int r = Integer.parseInt(line[1]); line = in.readLine().split(" "); int[] x = new int[(n + 1)];  double[] y = new double[(n + 1)]; for ( int i = 1;(i <= n);++i) {x[i] = Integer.parseInt(line[(i - 1)]); double maxy = -1.0; for ( int j = 1;(j < i);++j) { double x2 = x[i];  double x1 = x[j];  double y1 = y[j];  double a = 1;  double b = (-2 * y1);  double c = (((((x1 * x1) + (x2 * x2)) - ((2 * x1) * x2)) + (y1 * y1)) - ((4.0 * r) * r));  double D = ((b * b) - ((4 * a) * c)); if ( (D >= 0)) { double y2 = ((-b + Math.sqrt(D)) / (2 * a)); maxy = Math.max(maxy,y2); } }if ( (maxy < 0)) {maxy = r; } y[i] = maxy; if ( (i > 1)) {System.out.print(" "); } System.out.printf("%.13f",y[i]); }System.out.println(); } }
6	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{ int n ; long neededSum ; long[] sums ; Map<Long,Integer> where ; public void solve( int testNumber, FastScanner in, PrintWriter out){ n = in.nextInt(); int[][] a = new int[n][]; neededSum = 0; sums = new long[n]; for ( int i = 0;(i < n);i++) { int k = in.nextInt(); a[i] = new int[k]; for ( int j = 0;(j < k);j++) {a[i][j] = in.nextInt(); neededSum += a[i][j]; sums[i] += a[i][j]; }}if ( ((neededSum % n) != 0)) {out.println("No"); return ;} neededSum /= n; where = new HashMap<>(); for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < a[i].length);j++) {where.put((long)a[i][j],i); }} Entry[][] cycleSol = new Entry[(1 << n)][];  List<Entry> sol = new ArrayList<>(); for ( int i = 0;(i < n);i++) {for ( int x :a[i]) {search(i,i,x,x,0,0,sol,cycleSol); }} boolean[] can = new boolean[(1 << n)];  int[] via = new int[(1 << n)]; can[0] = true; for ( int mask = 0;(mask < (1 << n));mask++) {for ( int submask = mask;(submask > 0);submask = ((submask - 1) & mask)) {if ( ((cycleSol[submask] != null) && can[(mask ^ submask)])) {can[mask] = true; via[mask] = submask; } }}if ( !can[((1 << n) - 1)]) {out.println("No"); return ;} int[][] ans = new int[n][2]; for ( int mask = ((1 << n) - 1);(mask > 0);) { int sm = via[mask]; mask ^= sm; for ( Entry e :cycleSol[sm]) {ans[e.from][0] = e.what; ans[e.from][1] = (e.to + 1); }}out.println("Yes"); for ( int i = 0;(i < n);i++) {out.println(((ans[i][0] + " ") + ans[i][1])); }} private void search( int start, int cur, long fromStart, long fromCur, int hasIn, int hasOut, List<Entry> sol, Entry[][] cycleSol){ for ( int i = start;(i < n);i++) {if ( ((hasIn & (1 << i)) > 0)) {continue;} if ( ((hasOut & (1 << cur)) > 0)) {continue;} long fromI = ((sums[i] + fromCur) - neededSum);  Integer w = where.get(fromI); if ( ((w == null) || (w != i))) {continue;} sol.add(new Entry(cur,i,(int)fromCur)); int nHasIn = (hasIn | (1 << i));  int nHasOut = (hasOut | (1 << cur)); if ( ((i == start) && (fromI == fromStart))) {cycleSol[nHasOut] = sol.toArray(new Entry[0]); } search(start,i,fromStart,fromI,nHasIn,nHasOut,sol,cycleSol); sol.remove((sol.size() - 1)); }} class Entry{ int from ; int to ; int what ; Entry( int from, int to, int what){ this.from = from; this.to = to; this.what = what; } } } static class FastScanner{ private BufferedReader in ; private StringTokenizer st ; public FastScanner( InputStream stream){ in = new BufferedReader(new InputStreamReader(stream)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{ String rl = in.readLine(); if ( (rl == null)) {return null;} st = new StringTokenizer(rl); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
3	public class G{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ char[] s = ns().toCharArray();  int mod = 1000000007;  int m = 702;  long[] bases = new long[(m + 1)]; bases[0] = 1; for ( int i = 1;(i <= m);i++) bases[i] = ((bases[(i - 1)] * 10) % mod); long ans = 0; for ( int d = 9;(d >= 1);d--) { int n = s.length;  long[] sum = new long[m];  long[] num = new long[m];  long esum = 0;  int ebase = 0; for ( int i = 0;(i < n);i++) { long[] nsum = new long[m];  long[] nnum = new long[m]; for ( int j = 0;(j < m);j++) {for ( int k = 0;(k <= 9);k++) {if ( ((k > d) && ((j + 1) < m))) {nsum[(j + 1)] += (sum[j] * 10); nsum[(j + 1)] %= mod; nnum[(j + 1)] += num[j]; if ( (nnum[(j + 1)] >= mod)) nnum[(j + 1)] -= mod; } if ( (k == d)) {nsum[j] += ((sum[j] * 10) + (num[j] * bases[j])); nsum[j] %= mod; nnum[j] += num[j]; if ( (nnum[j] >= mod)) nnum[j] -= mod; } if ( (k < d)) {nsum[j] += sum[j]; if ( (nsum[j] >= mod)) nsum[j] -= mod; nnum[j] += num[j]; if ( (nnum[j] >= mod)) nnum[j] -= mod; } }}for ( int k = 0;(k < (s[i] - '0'));k++) {if ( (k > d)) {nsum[(ebase + 1)] += (esum * 10); nsum[(ebase + 1)] %= mod; nnum[(ebase + 1)] += 1; if ( (nnum[(ebase + 1)] >= mod)) nnum[(ebase + 1)] -= mod; } if ( (k == d)) {nsum[ebase] += ((esum * 10) + bases[ebase]); nsum[ebase] %= mod; nnum[ebase] += 1; if ( (nnum[ebase] >= mod)) nnum[ebase] -= mod; } if ( (k < d)) {nsum[ebase] += esum; if ( (nsum[ebase] >= mod)) nsum[ebase] -= mod; nnum[ebase] += 1; if ( (nnum[ebase] >= mod)) nnum[ebase] -= mod; } }if ( ((s[i] - '0') > d)) {esum = (esum * 10); esum %= mod; ebase++; } else if ( ((s[i] - '0') == d)) {esum = ((esum * 10) + bases[ebase]); esum %= mod; } sum = nsum; num = nnum; } long all = esum; for ( int j = 0;(j < m);j++) {all += sum[j]; }ans += ((all % mod) * d); }out.println((ans % mod)); } 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 G().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
2	public class B1177{ public static void main( String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  Long n = Long.parseLong(br.readLine());  long[] p = new long[15];  int i ; p[0] = 1; for ( i = 1;(i < 15);p[i] = (p[(i - 1)] * 10),i++) ;for ( i = 1;(((i * p[(i - 1)]) * 9L) < n);n -= ((i * p[(i - 1)]) * 9L),i++) ;n--; int v = (int)(n % i); n /= i; n += p[(i - 1)]; String s = n.toString(); System.out.println(s.charAt(v)); } }
4	public class D{ BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); PrintWriter writer = new PrintWriter(System.out); StringTokenizer stringTokenizer ; String next()throws IOException { while(((stringTokenizer == null) || !stringTokenizer.hasMoreTokens())){stringTokenizer = new StringTokenizer(reader.readLine()); }return stringTokenizer.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} final int MOD = (((1000 * 1000) * 1000) + 7); @SuppressWarnings void solve()throws IOException { final int n = nextInt();  int m = nextInt();  int[] from = new int[m];  int[] to = new int[m]; for ( int i = 0;(i < m);i++) {from[i] = nextInt(); to[i] = nextInt(); } int ans = solve(n,m,from,to); writer.println(ans); writer.close(); } private int solve(final int n, int m, int[] from, int[] to){ final List<List<Integer>> g = new ArrayList<>(); for ( int i = 0;(i <= n);i++) {g.add(new ArrayList<Integer>()); } int[] c = new int[(n + 1)];  int[] loop = new int[(n + 1)]; for ( int i = 0;(i < m);i++) { int u = from[i];  int v = to[i]; g.get(u).add(v); c[u]++; c[v]++; if ( (u == v)) {loop[u]++; } } class Utils{ int[] prev = new int[(n + 1)]; int[] used = new int[(n + 1)]; int mark ; int forbidden ; int maxMatch(){ maxMatch = 0; for ( int i = 1;(i <= n);i++) {mark = i; if ( findPath(i)) {maxMatch++; } }return maxMatch;} boolean findPath( int u){ if ( (u == forbidden)) {return false;} used[u] = mark; for ( int v :g.get(u)) {if ( (v == forbidden)) {continue;} if ( ((prev[v] == 0) || ((used[prev[v]] != mark) && findPath(prev[v])))) {prev[v] = u; return true;} }return false;} int maxMatch = 0; } int ans = Integer.MAX_VALUE; for ( int i = 1;(i <= n);i++) { Utils utils = new Utils(); utils.forbidden = i; utils.maxMatch(); ans = Math.min(ans,((((((2 * n) - 1) - c[i]) + loop[i]) + (((m - c[i]) + loop[i]) - utils.maxMatch)) + ((n - 1) - utils.maxMatch))); }return ans;} public static void main( String[] args)throws IOException { new D().solve(); } }
0	public class ProblemA_72{ final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null); BufferedReader in ; PrintWriter out ; StringTokenizer tok = new StringTokenizer(""); void init()throws FileNotFoundException { 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());} public static void main( String[] args){ new ProblemA_72().run(); } 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); } } void solve()throws IOException { int n = readInt(); out.print((n + (n / 2))); } }
2	public class ProblemC{ public static final String FILE_IN = "std.in"; public static final String FILE_OUT = "std.out"; static private boolean debugMode = true; static private final long MOD = (((1000 * 1000) * 1000) + 9); public static void main( String[] args)throws IOException { final Scanner reader = new Scanner(new InputStreamReader((debugMode?System.in:new FileInputStream(FILE_IN)))); final PrintWriter writer = new PrintWriter((debugMode?System.out:new FileOutputStream(FILE_OUT))); solveTheProblem(reader,writer); reader.close(); writer.close(); } static private void solveTheProblem(final Scanner reader,final PrintWriter writer){ final long n = reader.nextLong(); final long m = reader.nextLong(); final long k = reader.nextLong(); if ( ((n - (n / k)) >= m)) {writer.println(m); return ;} else { long sum = 1;  long maxK = ((m - n) + (n / k)); sum = fastPow(2,maxK); sum = (2 * (sum - 1)); sum = (sum % MOD); sum *= k; sum += (m - (maxK * k)); writer.println((sum % MOD)); }} static private long fastPow(final int exp,final long deg){ if ( (deg == 0)) {return 1;} else if ( (deg == 1)) {return exp;} else if ( ((deg % 2) == 0)) { long temp = fastPow(exp,(deg / 2)); temp = ((temp * temp) % MOD); return temp;} else { long temp = fastPow(exp,(deg / 2)); temp = ((temp * temp) % MOD); return ((temp * exp) % MOD);}} }
6	public class Main{ static int n ,exp ; static double arr[][] ,dp[] ,dies[][] ; public static void main( String[] args)throws NumberFormatException,IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); n = new Integer(br.readLine()); arr = new double[n][n]; StringTokenizer st ; for ( int i = 0;(i < n);i++) {st = new StringTokenizer(br.readLine()); for ( int j = 0;(j < n);j++) {arr[i][j] = Double.parseDouble(st.nextToken()); }}exp = (1 << n); dp = new double[exp]; dies = new double[n][exp]; for ( int all = 0;(all < exp);all++) {dp[all] = -1; int countAlive = 0; for ( int i = 0;(i < n);i++) {if ( ((all & (1 << i)) != 0)) countAlive++; }if ( (countAlive < 2)) continue; double x = (1.0 / ((countAlive * (countAlive - 1)) / 2.0)); for ( int i = 0;(i < n);i++) {dies[i][all] = 0; int mask = (1 << i); if ( ((mask & all) > 0)) {for ( int j = 0;(j < n);j++) { int mask2 = (1 << j); if ( ((mask2 & all) > 0)) dies[i][all] += arr[j][i]; }dies[i][all] *= x; } }}for ( int myFish = 0;(myFish < n);myFish++) {if ( (myFish > 0)) System.out.printf(" "); System.out.printf("%.6f",ff((1 << myFish))); }System.out.println(); } static double ff( int state){ if ( (state == (exp - 1))) return 1; if ( (dp[state] != -1)) return dp[state]; double ans = 0; for ( int i = 0;(i < n);i++) { int mask = (1 << i); if ( ((mask & state) == 0)) {ans += (dies[i][(state + mask)] * ff((state + mask))); } }return dp[state] = ans;} }
3	public class GB_A{ FastScanner in ; PrintWriter out ; public static void main( String[] arg){ new GB_A().run(); } public void solve()throws IOException { int n = in.nextInt();  int r = in.nextInt();  int[] a = new int[n];  double[] ans = new double[n]; a[0] = in.nextInt(); ans[0] = r; for ( int i = 1;(i < n);i++) {a[i] = in.nextInt(); double max = r; for ( int j = (i - 1);(j >= 0);j--) {if ( (Math.abs((a[i] - a[j])) <= (2 * r))) { double d = (Math.sqrt((((4 * r) * r) - ((a[i] - a[j]) * (a[i] - a[j])))) + ans[j]); max = Math.max(max,d); } }ans[i] = max; }for ( int i = 0;(i < n);i++) {out.println(ans[i]); }} public void run(){ try{in = new FastScanner(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); solve(); out.close(); }catch (IOException e){ e.printStackTrace(); } } class FastScanner{ BufferedReader br ; StringTokenizer st ; FastScanner( BufferedReader bufferedReader){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
4	public class G{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskE solver = new TaskE(); solver.solve(1,in,out); out.flush(); out.close(); } static class TaskE{ class MinCostMaxFlow{ ArrayList<Edge> al[] ; Edge ja[][] ; int d[] ; int N ,S ,T ,maxFlow ; int minCost ; final int gmax = (Integer.MAX_VALUE / 100); int edges = 0; class Edge{ int u ,flow ,rid ,cost ; Edge( int a, int b, int c, int d){ u = a; flow = b; cost = c; rid = d; } } void addEdge( int u, int v, int flow, int cost){ int lu = al[u].size(),lv = al[v].size(); al[u].add(new Edge(v,flow,cost,lv)); al[v].add(new Edge(u,0,-cost,lu)); } void convertToArray(){ ja = new Edge[N][]; for ( int i = 0;(i < N);i++) { int sz = al[i].size(); ja[i] = new Edge[sz]; for ( int j = 0;(j < sz);j++) {ja[i][j] = al[i].get(j); }al[i].clear(); }} MinCostMaxFlow( int n, int source, int sink){ N = n; S = source; T = sink; maxFlow = 0; minCost = 0; al = new ArrayList[N]; d = new int[N]; for ( int i = 0;(i < N);i++) {al[i] = new ArrayList<>(); }} int node[] ; int visit[] ; int prv[] ,prve[] ; int dist[] ; boolean simple(){ node = new int[N]; visit = new int[N]; prv = new int[N]; prve = new int[N]; dist = new int[N]; Arrays.fill(dist,gmax); node[0] = S; dist[0] = 0; int front = 1,back = 0; while((front != back)){ int u = node[back++];  int distu = dist[u]; if ( (back == N)) back = 0; visit[u] = 2; for ( int i = 0;(i < ja[u].length);i++) { Edge e = ja[u][i]; if ( (e.flow == 0)) continue; int cdist = (distu + e.cost); if ( (cdist < dist[e.u])) {if ( (visit[e.u] == 0)) {node[front] = e.u; if ( (++front == N)) front = 0; } else if ( (visit[e.u] == 2)) {if ( (--back == -1)) back += N; node[back] = e.u; } visit[e.u] = 1; prve[e.u] = i; prv[e.u] = u; dist[e.u] = cdist; } }}return (visit[T] != 0);} class pair{ int F ; int S ; pair( int a, int b){ F = a; S = b; } } boolean dijkstra(){ visit = new int[N]; prv = new int[N]; prve = new int[N]; dist = new int[N]; Arrays.fill(dist,gmax); PriorityQueue<pair> pq = new PriorityQueue<>((A,B)->Double.compare(A.S,B.S)); pq.add(new pair(S,0)); dist[0] = 0; o:while(!pq.isEmpty()){ pair p = pq.poll(); while((dist[p.F] < p.S)){if ( pq.isEmpty()) break; p = pq.poll(); }visit[p.F] = 2; for ( int i = 0;(i < ja[p.F].length);i++) { Edge e = ja[p.F][i]; if ( (e.flow == 0)) continue; int cdist = (p.S + ((e.cost + d[p.F]) - d[e.u])); if ( (cdist < dist[e.u])) {if ( (visit[e.u] == 2)) return false; pq.add(new pair(e.u,cdist)); dist[e.u] = cdist; prv[e.u] = p.F; prve[e.u] = i; visit[e.u] = 1; } }}return (visit[T] != 0);} int augment(){ int p = T;  int min = gmax; while((p != 0)){ int pp = prv[p],pe = prve[p];  int val = ja[pp][pe].flow; min = Math.min(min,val); p = pp; }p = T; while((p != 0)){ int pp = prv[p],pe = prve[p]; ja[pp][pe].flow -= min; ja[p][ja[pp][pe].rid].flow += min; p = pp; }maxFlow += min; return min;} void updPotential(){ for ( int i = 0;(i < N);i++) {if ( (visit[i] != 0)) {d[i] += (dist[i] - dist[S]); } }} boolean calWithPotential(){ while(dijkstra()){ int min = ((dist[T] + d[T]) - d[S]); minCost += (min * augment()); updPotential(); }return true;} } int n ,m ,k ,c ,d ,a[] ,f[] ; public void solve( int testNumber, InputReader in, PrintWriter out){ n = in.nextInt(); m = in.nextInt(); k = in.nextInt(); c = in.nextInt(); d = in.nextInt(); int maxl = (n + k),T = ((n * maxl) + 1);  MinCostMaxFlow ans = new MinCostMaxFlow((T + 1),0,T); a = new int[(k + 1)]; f = new int[(n + 1)]; for ( int i = 1;(i <= k);i++) {a[i] = in.nextInt(); f[a[i]]++; }for ( int i = 1;(i <= n);i++) {if ( (f[i] == 0)) continue; ans.addEdge(0,i,f[i],0); }for ( int i = 2;(i <= n);i++) {for ( int l = 0;(l < (maxl - 1));l++) {ans.addEdge(((l * n) + i),(((l + 1) * n) + i),k,c); }}for ( int i = 1;(i <= m);i++) { int a = in.nextInt(),b = in.nextInt(); for ( int l = 0;(l < (maxl - 1));l++) {for ( int p = 1;(p <= k);p++) {if ( (a != 1)) ans.addEdge(((n * l) + a),((n * (l + 1)) + b),1,((d * ((2 * p) - 1)) + c)); if ( (b != 1)) ans.addEdge(((n * l) + b),((n * (l + 1)) + a),1,((d * ((2 * p) - 1)) + c)); }}}for ( int l = 1;(l < maxl);l++) {ans.addEdge(((l * n) + 1),T,k,0); }ans.convertToArray(); ans.calWithPotential(); if ( (ans.maxFlow != k)) {out.println("BUG"); } else {out.println((int)ans.minCost); }} } static class InputReader{ BufferedReader br ; StringTokenizer st ; public InputReader( InputStream stream){ br = new BufferedReader(new InputStreamReader(stream)); st = null; } String next(){ while(((st == null) || !st.hasMoreTokens())){ String s = null; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } if ( (s == null)) return null; st = new StringTokenizer(s); }return st.nextToken();} boolean hasMoreTokens(){ while(((st == null) || !st.hasMoreTokens())){ String s = null; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } if ( (s == null)) return false; st = new StringTokenizer(s); }return true;} public int nextInt(){ return Integer.parseInt(next());} } }
0	public class Challenge{ public static void main( String[] args)throws java.lang.Exception { InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(in,out); out.close(); } } class TaskA{ public void solve( InputReader in, PrintWriter out){ int n = in.nextInt(); if ( (n == 1)) {out.println("1"); } else if ( (n == 2)) {out.println("2"); } else if ( (n == 3)) {out.println("6"); } else if ( ((n % 2) > 0)) {out.println((((1L * n) * (n - 1)) * (n - 2))); } else if ( ((n % 3) == 0)) {out.println((((1L * (n - 1)) * (n - 2)) * (n - 3))); } else {out.println((((1L * n) * (n - 1)) * (n - 3))); }} } 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());} }
3	public class Solution{ static MyScanner sc ; static private PrintWriter out ; static long M2 = (1_000_000_000L + 7); public static void main( String[] s)throws Exception { StringBuilder stringBuilder = new StringBuilder(); if ( (stringBuilder.length() == 0)) {sc = new MyScanner(System.in); } else {sc = new MyScanner(new BufferedReader(new StringReader(stringBuilder.toString()))); }out = new PrintWriter(new OutputStreamWriter(System.out)); initData(); solve(); out.flush(); } static private void initData(){ } static private void solve()throws IOException { int n = sc.nextInt();  int q = sc.nextInt();  int[] vv = sc.na(n);  double[] ans = new double[n]; for ( int i = 0;(i < n);i++) {ans[i] = q; for ( int s = 0;(s < i);s++) {if ( (Math.abs((vv[i] - vv[s])) > (q * 2))) continue; double diff = (((4 * q) * q) - (Math.abs((vv[i] - vv[s])) * Math.abs((vv[i] - vv[s])))); diff = Math.sqrt(diff); ans[i] = Math.max(ans[i],(diff + ans[s])); }out.print((ans[i] + " ")); }} static private long gcd( long l, long l1){ if ( (l > l1)) return gcd(l1,l); if ( (l == 0)) return l1; return gcd((l1 % l),l);} static private long pow( long a, long b, long m){ if ( (b == 0)) return 1; if ( (b == 1)) return a; long pp = pow(a,(b / 2),m); pp *= pp; pp %= m; return ((pp * (((b % 2) == 0)?1:a)) % m);} static class MyScanner{ BufferedReader br ; StringTokenizer st ; MyScanner( BufferedReader br){ this.br = br; } public MyScanner( InputStream in){ this(new BufferedReader(new InputStreamReader(in))); } void findToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }} String next(){ findToken(); return st.nextToken();} int[] na( int n){ int[] k = new int[n]; for ( int i = 0;(i < n);i++) {k[i] = sc.fi(); }return k;} int nextInt(){ return Integer.parseInt(next());} int fi(){ String t = next();  int cur = 0;  boolean n = (t.charAt(0) == '-'); for ( int a = (n?1:0);(a < t.length());a++) {cur = (((cur * 10) + t.charAt(a)) - '0'); }return (n?-cur:cur);} long nextLong(){ return Long.parseLong(next());} } }
0	public class MainA{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int count = 0; count = (n / 2); count = (count + (n - (n / 2))); n = (n - (n / 2)); count = (count + n); System.out.println(count); } }
2	public class Berland{ public static void main( String[] args)throws NumberFormatException,IOException { new Berland().run(); } public void run()throws NumberFormatException,IOException { BufferedReader file = new BufferedReader(new InputStreamReader(System.in));  long N = Long.parseLong(file.readLine());  long[] cutoff = new long[13]; cutoff[0] = 0; for ( int i = 1;(i <= 12);i++) {cutoff[i] = (cutoff[(i - 1)] + ((long)(9 * Math.pow(10,(i - 1))) * i)); } int dig = -1; for ( int i = 0;(i < 12);i++) {if ( (cutoff[i] >= N)) {dig = i; break;} } long sub = ((N - cutoff[(dig - 1)]) - 1);  long num = (sub / dig);  long number = ((long)Math.pow(10,(dig - 1)) + num);  int pos = (int)(sub % dig); System.out.println((number + "")); } }
4	public class Main{ static final int primeCount = 452; static final int[] prime = new int[primeCount]; static void build_prime(){ boolean[] notPrime = new boolean[3200]; for ( int i = 2;(i < 3200);i++) {if ( notPrime[i]) continue; for ( int j = (i * i);(j < 3200);j += i) {notPrime[j] = true; }} int count = 0; for ( int i = 2;(i < 3200);i++) {if ( notPrime[i]) continue; prime[count++] = i; }} static private void run( Reader in, PrintWriter out)throws IOException { int n = in.nextInt();  int m = in.nextInt();  int[] a = new int[n]; for ( int i = 0;(i < n);i++) {a[i] = getReal(in.nextInt()); } int[] pre = new int[n]; for ( int i = 0;(i < n);i++) pre[i] = -1; TreeMap<Integer,Integer> exist = new TreeMap<>(); for ( int i = 0;(i < n);i++) { Integer result = exist.get(a[i]); if ( (result != null)) {pre[i] = result; } exist.put(a[i],i); } int[][] left = new int[(m + 1)][n]; for ( int i = 0;(i <= m);i++) { int start = 0;  PriorityQueue<Integer> inSame = new PriorityQueue<>(); for ( int j = 0;(j < n);j++) {if ( (pre[j] >= start)) {inSame.add(pre[j]); if ( (inSame.size() > i)) {start = (inSame.poll() + 1); } } left[i][j] = start; }} int[][] dp = new int[n][(m + 1)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= m);j++) {dp[i][j] = Integer.MAX_VALUE; }for ( int j = 0;(j <= m);j++) {for ( int k = 0;(k <= j);k++) {if ( (left[k][i] == 0)) {dp[i][j] = 1; } else {dp[i][j] = Math.min(dp[i][j],(dp[(left[k][i] - 1)][(j - k)] + 1)); }}}}out.println(dp[(n - 1)][m]); } static int getReal( int x){ int result = 1; for ( int i = 0;(i < primeCount);i++) {if ( ((x % prime[i]) == 0)) { int count = 0; while(((x % prime[i]) == 0)){count++; x /= prime[i]; }if ( ((count % 2) == 1)) {result *= prime[i]; } } }result *= x; return result;} public static void main( String[] args)throws IOException { Reader in = new Reader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); build_prime(); int t = in.nextInt(); for ( int i = 0;(i < t);i++) {run(in,out); }out.flush(); in.close(); out.close(); } static class Reader{ BufferedReader reader ; StringTokenizer st ; Reader( InputStreamReader stream){ reader = new BufferedReader(stream,32768); st = null; } void close()throws IOException { reader.close(); } String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(reader.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
6	public class Fish extends Thread{ public Fish(){ this.input = new BufferedReader(new InputStreamReader(System.in)); this.output = new PrintWriter(System.out); this.setPriority(Thread.MAX_PRIORITY); } static int getOnes( int mask){ int result = 0; while((mask != 0)){mask &= (mask - 1); ++result; }return result;} private void solve()throws Throwable { int n = nextInt();  double[][] a = new double[n][n];  double[] dp = new double[(1 << n)]; for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < n);++j) {a[i][j] = nextDouble(); }} int limit = ((1 << n) - 1); dp[limit] = 1.0; for ( int mask = limit;(mask > 0);--mask) { int cardinality = getOnes(mask);  int probability = ((cardinality * (cardinality - 1)) / 2); for ( int first = 0;(first < n);++first) {if ( ((mask & powers[first]) != 0)) {for ( int second = (first + 1);(second < n);++second) {if ( ((mask & powers[second]) != 0)) {dp[(mask - powers[first])] += ((dp[mask] * a[second][first]) / probability); dp[(mask - powers[second])] += ((dp[mask] * a[first][second]) / probability); } }} }}for ( int i = 0;(i < n);++i) {output.printf("%.10f ",dp[powers[i]]); }} public static void main( String[] args){ new Fish().start(); } private String nextToken()throws IOException { while(((tokens == null) || !tokens.hasMoreTokens())){tokens = new StringTokenizer(input.readLine()); }return tokens.nextToken();} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} private double nextDouble()throws IOException { return Double.parseDouble(nextToken());} static int powers[] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144}; private BufferedReader input ; private PrintWriter output ; private StringTokenizer tokens = null; }
6	public class A{ public static int n ; public static double[] masks ; public static double[][] matrix ; public static void main( String[] args){ Scanner scan = new Scanner(System.in); n = scan.nextInt(); matrix = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) matrix[i][j] = scan.nextDouble(); masks = new double[(1 << n)]; masks[((1 << n) - 1)] = 1; for ( int i = 0;((1 << i) < (1 << n));i++) fillDP((1 << i)); for ( int i = 0;((1 << i) < (1 << n));i++) System.out.printf("%.6f ",masks[(1 << i)]); } public static double fillDP( int mask){ int bitCount = Integer.bitCount(mask); if ( (masks[mask] != 0)) return masks[mask]; double matchProba = (2.0 / ((double)bitCount * (double)(bitCount + 1)));  double totalProba = 0; for ( int i = 0;(i < n);i++) { int iPower = (1 << i); if ( ((mask & iPower) != iPower)) continue; for ( int j = 0;(j < n);j++) { int jPower = (1 << j); if ( (((mask & jPower) == jPower) || (i == j))) continue; totalProba += ((matchProba * matrix[i][j]) * fillDP((mask | jPower))); }}return masks[mask] = totalProba;} }
6	public class Main{ static final boolean debug = false; static final String fileName = ""; static final boolean useFiles = false; public static void main( String[] args)throws FileNotFoundException { long start ; if ( debug) start = System.nanoTime();  InputStream inputStream ;  OutputStream outputStream ; if ( useFiles) {inputStream = new FileInputStream((fileName + ".in")); outputStream = new FileOutputStream((fileName + ".out")); } else {inputStream = System.in; outputStream = System.out; } InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  Task solver = new Task(in,out); solver.solve(); if ( debug) out.println(((System.nanoTime() - start) / 1e+9)); out.close(); } } 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 double nextDouble(){ return Double.parseDouble(next());} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} } class Task{ boolean get( int mask, int i){ return ((mask & (1 << i)) > 0);} int zero( int mask, int i){ return (mask & (1 << i));} public void solve(){ int n = in.nextInt();  double[][] a = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) a[i][j] = in.nextDouble(); } double[] d = new double[(1 << n)]; d[((1 << n) - 1)] = 1; for ( int mask = ((1 << n) - 1);(mask >= 0);mask--) { int bits = Integer.bitCount(mask);  double transfer = (1.0 / ((bits * (bits - 1)) / 2)); for ( int i = 0;(i < n);i++) {if ( get(mask,i)) {for ( int j = (i + 1);(j < n);j++) {if ( get(mask,j)) {d[zero(mask,j)] += ((a[i][j] * transfer) * d[mask]); d[zero(mask,i)] += ((a[j][i] * transfer) * d[mask]); } }} }}for ( int i = 0;(i < n);i++) out.print((d[(1 << i)] + " ")); } private InputReader in ; private PrintWriter out ; Task( InputReader in, PrintWriter out){ this.in = in; this.out = out; } }
0	public class Solution implements Runnable{ public static void main( String[] args){ new Thread(new Solution()).start(); } private void solve()throws Exception { int n = nextInt(); pw.print((n + (n / 2))); } private BufferedReader br ; private PrintWriter pw ; private StringTokenizer tok ; private String next()throws Exception { while(((tok == null) || !tok.hasMoreElements()))tok = new StringTokenizer(br.readLine()); return tok.nextToken();} private int nextInt()throws Exception { return Integer.parseInt(next());} }
2	public class ProblemD{ InputReader in ; PrintWriter out ; void solve(){ long l = in.nextLong();  long r = in.nextLong();  long ans = 0;  boolean add = false; for ( int k = 62;(k >= 0);k--) { long cb = (1L << k); if ( ((l & cb) != (r & cb))) add = true; if ( add) ans += (1L << k); }out.println(ans); } ProblemD(){ boolean oj = (System.getProperty("ONLINE_JUDGE") != null); try{if ( oj) {in = new InputReader(System.in); out = new PrintWriter(System.out); } else { Writer w = new FileWriter("output.txt"); in = new InputReader(new FileReader("input.txt")); out = new PrintWriter(w); } }catch (Exception e){ throw (new RuntimeException(e));} solve(); out.close(); } public static void main( String[] args){ new ProblemD(); } } class InputReader{ private BufferedReader reader ; private StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public InputReader( FileReader fr){ reader = new BufferedReader(fr); 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 long nextLong(){ return Long.parseLong(next());} }
2	public class pr169D implements Runnable{ BufferedReader in ; PrintWriter out ; StringTokenizer str ; public void solve()throws IOException { long l = nextLong();  long r = nextLong();  long x = (l ^ r);  long i = 1; while((x >= i))i *= 2; out.println(((x > i)?x:(i - 1))); } public String nextToken()throws IOException { while(((str == null) || !str.hasMoreTokens())){str = new StringTokenizer(in.readLine()); }return str.nextToken();} public long nextLong()throws IOException { return Long.parseLong(nextToken());} public static void main( String[] args){ new Thread(new pr169D()).start(); } }
3	public class Main{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(),r = in.nextInt();  double[] x = new double[n]; for ( int i = 0;(i < n);i++) x[i] = in.nextInt(); double[] y = new double[n]; for ( int i = 0;(i < n);i++) {y[i] = r; for ( int j = 0;(j < i);j++) {if ( (Math.abs((x[j] - x[i])) <= (2 * r))) {y[i] = Math.max(y[i],(y[j] + Math.sqrt((((4 * r) * r) - ((x[i] - x[j]) * (x[i] - x[j])))))); } }}for ( int i = 0;(i < n);i++) System.out.print((y[i] + " ")); } }
0	public class main{ public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static PrintWriter pw = new PrintWriter(System.out); public static String line ; public static StringTokenizer st ; public static ArrayList<ArrayList<Integer>> adjList ; public static void main( String[] args)throws Exception { String s = br.readLine(); pw.print(25); pw.print("\n"); pw.close(); br.close(); } }
4	public class CF387D{ static class A{ ArrayList<Integer> list = new ArrayList<>(); int u ,v ,d ; } static final int INF = Integer.MAX_VALUE; static boolean bfs( A[] aa, int n){ ArrayDeque<Integer> q = new ArrayDeque<>(); for ( int u = 1;(u <= n);u++) if ( (aa[u].v > 0)) aa[u].d = INF; else {aa[u].d = 0; q.addLast(u); }aa[0].d = INF; while(!q.isEmpty()){ int u = q.removeFirst(); for ( int v :aa[u].list) { int w = aa[v].u; if ( (aa[w].d == INF)) {aa[w].d = (aa[u].d + 1); if ( (w == 0)) return true; q.addLast(w); } }}return false;} static boolean dfs( A[] aa, int n, int u){ if ( (u == 0)) return true; for ( int v :aa[u].list) { int w = aa[v].u; if ( ((aa[w].d == (aa[u].d + 1)) && dfs(aa,n,w))) {aa[u].v = v; aa[v].u = u; return true;} }aa[u].d = INF; return false;} static int matchings( A[] aa, int n){ int cnt = 0; while(bfs(aa,n))for ( int u = 1;(u <= n);u++) if ( ((aa[u].v == 0) && dfs(aa,n,u))) cnt++; return cnt;} public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int m = Integer.parseInt(st.nextToken());  int[] eu = new int[m];  int[] ev = new int[m]; for ( int j = 0;(j < m);j++) {st = new StringTokenizer(br.readLine()); eu[j] = Integer.parseInt(st.nextToken()); ev[j] = Integer.parseInt(st.nextToken()); } A[] aa = new A[(n + 1)];  int min = (m + (n * 3)); for ( int ctr = 1;(ctr <= n);ctr++) { boolean loop = false;  boolean[] ci = new boolean[(n + 1)];  boolean[] co = new boolean[(n + 1)]; for ( int i = 0;(i <= n);i++) aa[i] = new A(); int m_ = 0; for ( int j = 0;(j < m);j++) { int u = eu[j];  int v = ev[j]; if ( ((u == ctr) && (v == ctr))) loop = true; else if ( ((u == ctr) && (v != ctr))) ci[v] = true; else if ( ((u != ctr) && (v == ctr))) co[u] = true; else {aa[u].list.add(v); m_++; }} int cnt = (loop?0:1); for ( int i = 1;(i <= n);i++) if ( (i != ctr)) {if ( !ci[i]) cnt++; if ( !co[i]) cnt++; } int m2 = matchings(aa,n); cnt += ((m_ - m2) + ((n - 1) - m2)); if ( (min > cnt)) min = cnt; }System.out.println(min); } }
1	public class A1{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  long size = scan.nextLong();  int numberOfSpecial = scan.nextInt();  long pageSize = scan.nextLong();  long[] specialItemsArray = new long[numberOfSpecial]; for ( int i = 0;(i < numberOfSpecial);i++) {specialItemsArray[i] = scan.nextLong(); } int totalRemoved = 0;  int step = 0;  long currentPageIndex = BigDecimal.valueOf(specialItemsArray[0]).divide(BigDecimal.valueOf(pageSize),2,RoundingMode.UP).setScale(0,RoundingMode.CEILING).longValue();  int specialItemArrayIndex = 1; while((specialItemArrayIndex < numberOfSpecial)){ long pageIndex = BigDecimal.valueOf((specialItemsArray[specialItemArrayIndex] - totalRemoved)).divide(BigDecimal.valueOf(pageSize),2,RoundingMode.UP).setScale(0,RoundingMode.CEILING).longValue(); if ( (currentPageIndex != pageIndex)) {step++; totalRemoved = specialItemArrayIndex; currentPageIndex = BigDecimal.valueOf((specialItemsArray[specialItemArrayIndex] - totalRemoved)).divide(BigDecimal.valueOf(pageSize),2,RoundingMode.UP).setScale(0,RoundingMode.CEILING).longValue(); } specialItemArrayIndex++; }System.out.println((step + 1)); } }
2	@SuppressWarnings("unchecked") public class P1177B{ public void run()throws Exception { for ( long k = (nextLong() - 1),d = 1,dc = 9,sv = 1;true;k -= dc,d++,sv *= 10,dc = (((sv * 10) - sv) * d)) {if ( (k <= dc)) {println(Long.toString((sv + (k / d))).charAt((int)(k % d))); break;} }} public static void main( String... args)throws Exception { br = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(new BufferedOutputStream(System.out)); new P1177B().run(); br.close(); pw.close(); System.err.println((("\n[Time : " + (System.currentTimeMillis() - startTime)) + " ms]")); long gct = 0,gcc = 0; for ( GarbageCollectorMXBean garbageCollectorMXBean :ManagementFactory.getGarbageCollectorMXBeans()) {gct += garbageCollectorMXBean.getCollectionTime(); gcc += garbageCollectorMXBean.getCollectionCount(); }System.err.println((((("[GC time : " + gct) + " ms, count = ") + gcc) + "]")); } static long startTime = System.currentTimeMillis(); static BufferedReader br ; static PrintWriter pw ; StringTokenizer stok ; String nextToken()throws IOException { while(((stok == null) || !stok.hasMoreTokens())){ String s = br.readLine(); if ( (s == null)) {return null;} stok = new StringTokenizer(s); }return stok.nextToken();} void print( byte b){ print(("" + b)); } void print( int i){ print(("" + i)); } void print( long l){ print(("" + l)); } void print( double d){ print(("" + d)); } void print( char c){ print(("" + c)); } void print( Object o){ if ( (o instanceof int[])) {print(Arrays.toString((int[])o)); } else if ( (o instanceof long[])) {print(Arrays.toString((long[])o)); } else if ( (o instanceof char[])) {print(Arrays.toString((char[])o)); } else if ( (o instanceof byte[])) {print(Arrays.toString((byte[])o)); } else if ( (o instanceof short[])) {print(Arrays.toString((short[])o)); } else if ( (o instanceof boolean[])) {print(Arrays.toString((boolean[])o)); } else if ( (o instanceof float[])) {print(Arrays.toString((float[])o)); } else if ( (o instanceof double[])) {print(Arrays.toString((double[])o)); } else if ( (o instanceof Object[])) {print(Arrays.toString((Object[])o)); } else {print(("" + o)); }} void print( String s){ pw.print(s); } void println(){ println(""); } void println( byte b){ println(("" + b)); } void println( int i){ println(("" + i)); } void println( long l){ println(("" + l)); } void println( double d){ println(("" + d)); } void println( char c){ println(("" + c)); } void println( Object o){ print(o); println(); } void println( String s){ pw.println(s); } int nextInt()throws IOException { return Integer.parseInt(nextToken());} long nextLong()throws IOException { return Long.parseLong(nextToken());} double nextDouble()throws IOException { return Double.parseDouble(nextToken());} String nextLine()throws IOException { return br.readLine();} void flush(){ pw.flush(); } }
5	public class Main2{ private FastScanner scanner = new FastScanner(); public static void main( String[] args){ new Main2().solve(); } private void solve(){ int n = scanner.nextInt();  int a[][] = new int[n][3]; for ( int i = 0;(i < n);i++) {a[i][0] = scanner.nextInt(); a[i][1] = scanner.nextInt(); a[i][2] = i; } int l = -1,r = -1; Arrays.sort(a,(o1,o2)->{if ( (o1[0] != o2[0])) {return (o1[0] - o2[0]);} else {return (o2[1] - o1[1]);}}); int maxr = -1,maxi = -1; for ( int i = 0;(i < n);i++) {if ( (a[i][1] <= maxr)) {l = (a[i][2] + 1); r = (maxi + 1); break;} if ( (a[i][1] > maxr)) {maxi = a[i][2]; maxr = a[i][1]; } }System.out.println(((l + " ") + r)); } class FastScanner{ BufferedReader reader ; StringTokenizer tokenizer ; FastScanner(){ reader = new BufferedReader(new InputStreamReader(System.in),32768); tokenizer = null; } String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new StringTokenizer(reader.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return tokenizer.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
6	public class Main implements Runnable{ private int n ; private int nn ; private double[][] a ; private double[] dp ; private void solve()throws Throwable { n = nextInt(); nn = (1 << n); a = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {a[i][j] = nextDouble(); }}dp = new double[nn]; Arrays.fill(dp,-1.0); dp[(nn - 1)] = 1.0; for ( int j = 0;(j < n);j++) {pw.format(Locale.US,"%.7f ",Dp((1 << j))); }} private double Dp( int i){ if ( (dp[i] >= 0.0)) return dp[i]; double ans = 0;  int count = Integer.bitCount(i); for ( int j = 0;(j < n);j++) { int jj = (1 << j); if ( ((jj & i) == 0)) { double p = Dp((jj | i));  double pPair = (2.0 / (double)((count + 1) * count));  double s = 0; for ( int l = 0;(l < n);l++) { int ll = (1 << l); if ( ((ll & i) != 0)) {s += a[l][j]; } }ans += ((p * pPair) * s); } }dp[i] = ans; return dp[i];} PrintWriter pw ; BufferedReader in ; StringTokenizer st ; void initStreams()throws FileNotFoundException { in = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(System.out); } String nextString()throws IOException { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(in.readLine()); }return st.nextToken();} int nextInt()throws NumberFormatException,IOException { return Integer.parseInt(nextString());} double nextDouble()throws NumberFormatException,IOException { return Double.parseDouble(nextString());} static Throwable sError ; public static void main( String[] args)throws Throwable { Thread t = new Thread(new Main()); t.start(); t.join(); if ( (sError != null)) {throw (sError);} } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastReader in = new FastReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ FastReader in ; PrintWriter out ; int n ; public void solve( int testNumber, FastReader in, PrintWriter out){ this.in = in; this.out = out; n = in.nextInt(); if ( ((n % 4) != 0)) {out.println("! -1"); return ;} int low = 0;  int high = (n >> 1);  int fSign = Integer.signum(BValue(low)); if ( (fSign == 0)) {out.println(("! " + (low + 1))); return ;} while(((high - low) > 1)){ int mid = ((high + low) >> 1);  int mSign = Integer.signum(BValue(mid)); if ( (mSign == 0)) {out.println(("! " + (mid + 1))); return ;} if ( (mSign == -fSign)) {high = mid; } else {low = mid; }}out.println("! -1"); } public int BValue( int index){ out.println(("? " + (index + 1))); out.flush(); int f = in.nextInt(); out.println(("? " + ((index + 1) + (n >> 1)))); out.flush(); int s = in.nextInt(); return (f - s);} } static class FastReader{ private InputStream stream ; private byte[] buf = new byte[8192]; private int curChar ; private int pnumChars ; public FastReader( InputStream stream){ this.stream = stream; } private int pread(){ if ( (pnumChars == -1)) {throw (new InputMismatchException());} if ( (curChar >= pnumChars)) {curChar = 0; try{pnumChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (pnumChars <= 0)) {return -1;} } return buf[curChar++];} public int nextInt(){ int c = pread(); while(isSpaceChar(c))c = pread(); int sgn = 1; if ( (c == '-')) {sgn = -1; c = pread(); } int res = 0; do {if ( (c == ',')) {c = pread(); } if ( ((c < '0') || (c > '9'))) {throw (new InputMismatchException());} res *= 10; res += (c - '0'); c = pread(); }while(!isSpaceChar(c));return (res * sgn);} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
5	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int m = sc.nextInt();  int a[] = new int[n];  int b[] = new int[n]; for ( int i = 0;(i < n);i++) a[i] = sc.nextInt(); for ( int i = 0;(i < n);i++) b[i] = sc.nextInt(); int c[] = new int[(2 * n)]; c[0] = a[0]; for ( int i = 1;(i < n);i++) {c[(i * 2)] = a[i]; c[((i * 2) - 1)] = b[i]; if ( ((a[i] == 1) || (b[i] == 1))) {System.out.print(-1); System.exit(0); } }c[((2 * n) - 1)] = b[0]; if ( ((a[0] == 1) || (b[0] == 1))) {System.out.print(-1); System.exit(0); } System.out.println(bin_search(c,m)); } static private double bin_search( int[] c, int m){ double start = 0;  double end = Integer.MAX_VALUE;  double mid ; while(((start + 0.0000001) < end)){mid = ((start + end) / 2); if ( test(mid,m,c)) end = mid; else start = mid; }return end;} static private boolean test( double fuel, int m, int[] c){ for ( int i = 0;(i < c.length);i++) {fuel -= ((m + fuel) / c[i]); if ( (fuel < 0)) {return false;} }return true;} }
3	public class Newbie{ static InputReader sc = new InputReader(System.in); static PrintWriter out = new PrintWriter(System.out); public static void main( String[] args){ solver s = new solver();  int t = 1; while((t > 0)){s.solve(); t--; }out.close(); } static class InputReader{ public BufferedReader br ; public StringTokenizer token ; public InputReader( InputStream stream){ br = new BufferedReader(new InputStreamReader(stream),32768); token = null; } public String next(){ while(((token == null) || !token.hasMoreTokens())){try{token = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return token.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } static long m = ((long)1e9 + 7); static class solver{ void solve(){ int n = sc.nextInt();  int ans = 0;  int a[] = new int[(2 * n)]; for ( int i = 0;(i < (2 * n));i++) {a[i] = sc.nextInt(); }for ( int i = 0;(i < (2 * n));i++) {if ( (a[i] > 0)) { int j = 0; for ( j = (i + 1);(a[i] != a[j]);j++) {if ( (a[j] > 0)) ans++; }a[j] = 0; } }System.out.println(ans); } } }
0	public class Recovery{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  int N = scan.nextInt(); if ( ((N % 2) == 0)) {System.out.println(((4 + " ") + (N - 4))); } else System.out.println(((9 + " ") + (N - 9))); scan.close(); } }
0	public class Prob235A{ public static void main( String[] Args){ Scanner scan = new Scanner(System.in);  int x = scan.nextInt(); if ( (x < 3)) {if ( (x == 1)) System.out.println(1); else System.out.println(2); } else { long answer = x; if ( ((x % 2) == 1)) {answer *= (x - 1); answer *= (x - 2); } else if ( ((x % 3) != 0)) {answer *= (x - 1); answer *= (x - 3); } else {answer = (x - 1); answer *= (x - 2); answer *= (x - 3); }System.out.println(answer); }} }
2	public class x1080D{ public static void main( String[] hi)throws Exception { long[] dp = new long[32]; for ( int i = 1;(i <= 31);i++) dp[i] = (1 + (4 * dp[(i - 1)])); BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(infile.readLine());  int T = Integer.parseInt(st.nextToken());  StringBuilder sb = new StringBuilder(); matcha:while((T-- > 0)){st = new StringTokenizer(infile.readLine()); int N = Integer.parseInt(st.nextToken());  long K = Long.parseLong(st.nextToken()); if ( ((N >= 32) || (K == 1))) sb.append((("YES " + (N - 1)) + "\n")); else if ( (dp[N] == K)) sb.append("YES 0\n"); else if ( (dp[N] < K)) sb.append("NO\n"); else { long total = 3L;  long length = 2; for ( int res = (N - 1);(res >= 0);res--) { long min = (1 + (3 * dp[((N - 1) - res)]));  long max = (min + dp[(N - 1)]);  long cansplit = ((total - (2 * length)) + 1); max += (dp[res] * cansplit); if ( ((min <= K) && (K <= max))) {sb.append((("YES " + res) + "\n")); continue matcha;} length <<= 1; total *= 4; }sb.append("NO\n"); }}System.out.print(sb); } }
6	public class Fish extends Thread{ public Fish(){ this.input = new BufferedReader(new InputStreamReader(System.in)); this.output = new PrintWriter(System.out); this.setPriority(Thread.MAX_PRIORITY); } static int getOnes( int mask){ int result = 0; while((mask != 0)){mask &= (mask - 1); ++result; }return result;} private void solve()throws Throwable { int n = nextInt();  double[][] a = new double[n][n];  double[] dp = new double[(1 << n)]; for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < n);++j) {a[i][j] = nextDouble(); }} int limit = ((1 << n) - 1); dp[limit] = 1.0; for ( int mask = limit;(mask > 0);--mask) { int cardinality = getOnes(mask); if ( (cardinality < 2)) {continue;} int probability = ((cardinality * (cardinality - 1)) / 2); for ( int first = 0;(first < n);++first) {if ( ((mask & powers[first]) != 0)) {for ( int second = (first + 1);(second < n);++second) {if ( ((mask & powers[second]) != 0)) {dp[(mask ^ powers[first])] += ((dp[mask] * a[second][first]) / probability); dp[(mask ^ powers[second])] += ((dp[mask] * a[first][second]) / probability); } }} }}for ( int i = 0;(i < n);++i) {output.printf("%.10f ",dp[powers[i]]); }} public static void main( String[] args){ new Fish().start(); } private String nextToken()throws IOException { while(((tokens == null) || !tokens.hasMoreTokens())){tokens = new StringTokenizer(input.readLine()); }return tokens.nextToken();} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} private double nextDouble()throws IOException { return Double.parseDouble(nextToken());} static final int powers[] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144}; private BufferedReader input ; private PrintWriter output ; private StringTokenizer tokens = null; }
2	public class DigitSeq{ static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} long nextLong(){ return Long.parseLong(next());} } public static void main( String[] args){ FastReader sc = new FastReader();  OutputStream outputstream = System.out;  PrintWriter out = new PrintWriter(outputstream);  long n = sc.nextLong();  long[] arr = new long[14]; for ( int i = 1;(i <= 13);i++) {arr[i] = ((long)Math.pow(10,i) - (long)Math.pow(10,(i - 1))); } long total = 0; for ( int i = 1;(i <= 13);i++) {if ( ((total + ((long)i * arr[i])) >= n)) { long ans = (n - total);  long rest = ans; if ( ((ans % i) != 0)) {ans /= i; ans++; } else {ans /= i; }ans += ((long)Math.pow(10,(i - 1)) - 1); String str = Long.toString(ans);  int ind = (((rest % i) == 0)?(i - 1):((int)(rest % i) - 1)); out.println(str.charAt(ind)); break;} total = (total + ((long)i * arr[i])); }out.close(); } }
2	public class Quiz{ public static int mod = 1000000009; public static void main( String[] args)throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(f.readLine());  long n = Long.parseLong(st.nextToken());  long m = Long.parseLong(st.nextToken());  long k = Long.parseLong(st.nextToken());  long d = (n - m); n -= (d * k); if ( (n <= 0)) {System.out.println(m); return ;} long sum = ((n % k) + (d * (k - 1))); sum += ((2 * k) * (pow(2,(n / k)) - 1)); sum %= mod; System.out.println(sum); } public static long pow( long a, long n){ if ( (n == 0)) return 1; long pow = pow(a,(n / 2)); pow = ((pow * pow) % mod); if ( ((n % 2) == 1)) pow = ((pow * a) % mod); return pow;} }
6	public class CF85C{ public static void main( String[] args){ reader = new BufferedReader(new InputStreamReader(System.in)); int height = nextInt(),width = nextInt(); if ( (width > height)) { int t = width; width = height; height = t; } final int INF = ((height * width) + 10); final int ALL_BITS = ((1 << width) - 1);  int[][][] dp = new int[(height + 1)][(1 << width)][(1 << width)]; for ( int[][] ints :dp) {for ( int[] anInt :ints) {Arrays.fill(anInt,INF); }}dp[0][0][0] = 0; for ( int r = 0;(r < height);++r) {for ( int uncovered = 0;(uncovered < (1 << width));++uncovered) {for ( int mask = 0;(mask < (1 << width));++mask) {if ( (dp[r][uncovered][mask] == INF)) {continue;} for ( int curMask = uncovered;(curMask < (1 << width));curMask = ((curMask + 1) | uncovered)) { int curCovered = (mask | curMask); curCovered |= (curMask >> 1); curCovered |= (ALL_BITS & (curMask << 1)); int curUncovered = (ALL_BITS ^ curCovered); dp[(r + 1)][curUncovered][curMask] = Math.min(dp[(r + 1)][curUncovered][curMask],(dp[r][uncovered][mask] + Integer.bitCount(curMask))); }}}} int res = INF; for ( int x :dp[height][0]) res = Math.min(res,x); System.out.println(((height * width) - res)); } public static BufferedReader reader ; public static StringTokenizer tokenizer = null; static String nextToken(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new StringTokenizer(reader.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return tokenizer.nextToken();} public static int nextInt(){ return Integer.parseInt(nextToken());} }
2	public class A{ public static void main( String[] args)throws Exception { int n = nextInt();  int m = nextInt();  int k = nextInt();  int wa = (n - m); if ( ((n / k) <= wa)) {System.out.println(m); } else { int notFull = wa;  int full = ((n / k) - wa);  long res = 1;  int power = (full + 1);  int mod = 1000000009;  long powTwo = 2; while((power > 0)){if ( ((power & 1) == 1)) {res = ((res * powTwo) % mod); } power >>= 1; powTwo = ((powTwo * powTwo) % mod); }res = (((((res - 2) + mod) % mod) * k) % mod); res = ((((res + (notFull * (k - 1))) % mod) + (n % k)) % mod); System.out.println(res); }} static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer tokenizer = new StringTokenizer(""); static int nextInt()throws Exception { return Integer.parseInt(next());} static String next()throws Exception { while(true){if ( tokenizer.hasMoreTokens()) {return tokenizer.nextToken();} String s = br.readLine(); if ( (s == null)) {return null;} tokenizer = new StringTokenizer(s); }} }
0	public class A235{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long n = sc.nextInt(); if ( (n == 1)) {System.out.println(1); return ;} else if ( (n == 2)) {System.out.println(2); return ;} else if ( (n == 3)) {System.out.println(6); return ;} if ( ((n % 2) == 0)) {if ( ((n % 3) == 0)) System.out.println((((n - 1) * (n - 2)) * (n - 3))); else System.out.println((((n - 1) * n) * (n - 3))); } else {System.out.println(((n * (n - 1)) * (n - 2))); }} }
6	public class BetaRound16_E implements Runnable{ BufferedReader in ; PrintWriter out ; StringTokenizer tok = new StringTokenizer(""); public static void main( String[] args){ new Thread(null,new BetaRound16_E(),"",(256 * (1L << 20))).start(); } String readString()throws IOException { while(!tok.hasMoreTokens()){tok = new StringTokenizer(in.readLine()); }return tok.nextToken();} int readInt()throws IOException { return Integer.parseInt(readString());} double readDouble()throws IOException { return Double.parseDouble(readString());} double[] p ; int n ; double[][] a ; void solve()throws IOException { n = readInt(); a = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {a[i][j] = readDouble(); }}p = new double[(1 << n)]; Arrays.fill(p,-1); p[((1 << n) - 1)] = 1; for ( int i = 0;(i < n);i++) {out.printf("%.12f ",p((1 << i))); }} double p( int mask){ if ( (p[mask] != -1)) return p[mask]; double ans = 0; for ( int eaten = 0;(eaten < n);eaten++) { int prev = (mask | (1 << eaten)); if ( (prev != mask)) {for ( int eats = 0;(eats < n);eats++) {if ( ((mask & (1 << eats)) != 0)) {ans += (a[eats][eaten] * p(prev)); } }} } int bc = Integer.bitCount(mask);  int norm = ((bc * (bc + 1)) / 2); return p[mask] = (ans / norm);} }
2	public class A{ void solve(){ long k = readLong();  long x = 9;  long y = 1; while((k > (x * y))){k -= (x * y); x *= 10; y++; } long w = ((k / y) + (((k % y) == 0)?0:1));  long e = ((((k % y) - (1 % y)) + y) % y);  long num = (((x / 9) + w) - 1);  String s = Long.toString(num); out.print((s.charAt((int)e) - '0')); } public static void main( String[] args){ new A().run(); } void run(){ init(); solve(); out.close(); } BufferedReader in ; PrintWriter out ; StringTokenizer tok = new StringTokenizer(""); void init(){ in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); } String readLine(){ try{return in.readLine(); }catch (Exception ex){ throw (new RuntimeException(ex));} } String readString(){ while(!tok.hasMoreTokens()){ String nextLine = readLine(); if ( (nextLine == null)) return null; tok = new StringTokenizer(nextLine); }return tok.nextToken();} long readLong(){ return Long.parseLong(readString());} }
0	public class Lcm{ public static void main( String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter pw = new PrintWriter(System.out);  long n = Long.parseLong(br.readLine()); if ( (n <= 2)) pw.println(n); else {if ( ((n % 6) == 0)) {pw.println((((n - 1) * (n - 2)) * (n - 3))); } else if ( ((n % 2) == 0)) {pw.println(((n * (n - 1)) * (n - 3))); } else {pw.println(((n * (n - 1)) * (n - 2))); }}pw.flush(); } }
0	public class Main{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long n = in.nextLong(); if ( ((n == 1) || (n == 2))) {System.out.println(n); } else if ( ((n % 2) == 0)) {if ( ((n % 3) == 0)) System.out.println((((n - 1) * (n - 2)) * (n - 3))); else System.out.println(((n * (n - 1)) * (n - 3))); } else {System.out.println(((n * (n - 1)) * (n - 2))); }} }
4	public class Compute{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  long M = sc.nextInt();  long fact[] = new long[(n + 1)];  long inv[] = new long[(n + 1)];  long ifact[] = new long[(n + 1)];  long dp[][] = new long[(n + 1)][(n + 1)]; fact[1] = 1; ifact[1] = 1; ifact[0] = 1; inv[1] = 1; dp[1][1] = 1; for ( int i = 2;(i <= n);i++) {fact[i] = ((i * fact[(i - 1)]) % M); inv[i] = ((inv[(int)(M % i)] * (M - (M / i))) % M); dp[i][i] = ((dp[(i - 1)][(i - 1)] * 2) % M); ifact[i] = ((ifact[(i - 1)] * inv[i]) % M); }for ( int i = 3;(i <= n);i++) {for ( int j = ((i / 2) + 1);(j <= (i - 1));j++) {for ( int k = 2;((k <= (i - 1)) && (((j - k) + 1) > ((i - k) / 2)));k++) {dp[i][j] = ((dp[i][j] + ((((((((dp[(k - 1)][(k - 1)] * dp[(i - k)][((j - k) + 1)]) % M) * fact[j]) % M) * ifact[(k - 1)]) % M) * ifact[((j - k) + 1)]) % M)) % M); }}} long sum = 0; for ( int i = ((n / 2) + 1);(i <= n);i++) sum = ((sum + dp[n][i]) % M); System.out.println((sum % M)); } }
2	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);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ int n ; int sepX ; int sepY ; int x1 ; int y1 ; int x2 ; int y2 ; FastScanner in ; PrintWriter out ; public void solve( int testNumber, FastScanner in, PrintWriter out){ this.in = in; this.out = out; n = in.nextInt(); int x11 ,x12 ,y11 ,y12 ;  int x21 ,x22 ,y21 ,y22 ; findSeparatingX(); findSeparatingY(); if ( (sepX >= 0)) {locate(0,0,sepX,n); x11 = x1; y11 = y1; x12 = x2; y12 = y2; locate(sepX,0,n,n); x21 = x1; y21 = y1; x22 = x2; y22 = y2; } else {locate(0,0,n,sepY); x11 = x1; y11 = y1; x12 = x2; y12 = y2; locate(0,sepY,n,n); x21 = x1; y21 = y1; x22 = x2; y22 = y2; }++x11; ++x21; ++y11; ++y21; out.println(((((((((((((((("! " + x11) + " ") + y11) + " ") + x12) + " ") + y12) + " ") + +x21) + " ") + y21) + " ") + x22) + " ") + y22)); out.flush(); } void locate( int x1, int y1, int x2, int y2){ for ( int step = 15;(step >= 0);step--) { int h = (1 << step); if ( (query((x1 + h),y1,x2,y2) > 0)) {x1 += h; } if ( (query(x1,y1,(x2 - h),y2) > 0)) {x2 -= h; } if ( (query(x1,(y1 + h),x2,y2) > 0)) {y1 += h; } if ( (query(x1,y1,x2,(y2 - h)) > 0)) {y2 -= h; } }this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } private void findSeparatingX(){ int l = 0;  int r = n; while(((r - l) > 1)){ int m = ((l + r) / 2); if ( (query(0,0,m,n) == 0)) {l = m; } else {r = m; }}sepX = -1; if ( ((query(0,0,r,n) == 1) && (query(r,0,n,n) == 1))) {sepX = r; } } private void findSeparatingY(){ int l = 0;  int r = n; while(((r - l) > 1)){ int m = ((l + r) / 2); if ( (query(0,0,n,m) == 0)) {l = m; } else {r = m; }}sepY = -1; if ( ((query(0,0,n,r) == 1) && (query(0,r,n,n) == 1))) {sepY = r; } } int query( int x1, int y1, int x2, int y2){ if ( ((x1 >= x2) || (y1 >= y2))) {return 0;} ++x1; ++y1; out.println(((((((("? " + x1) + " ") + y1) + " ") + x2) + " ") + y2)); out.flush(); return in.nextInt();} } static class FastScanner{ private BufferedReader in ; private StringTokenizer st ; public FastScanner( InputStream stream){ in = new BufferedReader(new InputStreamReader(stream)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{ String rl = in.readLine(); if ( (rl == null)) {return null;} st = new StringTokenizer(rl); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
3	public class Main{ static double[] res ; static double r ; static double solve( int xMe, int xHim, int idxHim){ if ( (Math.abs((xMe - xHim)) > (2 * r))) return r; double hisY = res[idxHim];  double lo = hisY,hi = (hisY + (2 * r)),best = hi; for ( int cnt = 0;(cnt <= 50);cnt++) { double myY = (lo)((hi - lo) / 2); if ( notIntersect(xMe,myY,xHim,hisY)) {best = Math.min(best,myY); hi = Math.max(lo,myY); } else lo = Math.min(hi,myY); }return best;} static boolean notIntersect( double x1, double y1, double x2, double y2){ return ((((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2))) >= (((2 * r) * 2) * r));} public static void main( String[] args)throws Exception { Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt(); res = new double[n]; r = sc.nextInt(); int[] x = new int[n]; for ( int i = 0;(i < n);i++) x[i] = sc.nextInt(); for ( int i = 0;(i < n);i++) { double max = r; for ( int j = 0;(j < i);j++) {max = Math.max(max,solve(x[i],x[j],j)); }if ( (i > 0)) out.print(" "); res[i] = max; out.printf("%.10f",max); }out.println(); out.flush(); out.close(); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public Scanner( FileReader s)throws FileNotFoundException{ br = new BufferedReader(s); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public boolean ready()throws IOException { return br.ready();} } }
2	public class Solution implements Runnable{ boolean hasBit( long n, int pos){ return ((n & (1L << pos)) != 0);} public void solve()throws Exception { long l = sc.nextLong(),r = sc.nextLong();  int bit = 62; while(((bit >= 0) && (hasBit(l,bit) == hasBit(r,bit)))){bit--; }out.println(((1L << (bit + 1)) - 1)); } static Throwable uncaught ; BufferedReader in ; FastScanner sc ; PrintWriter out ; public static void main( String[] args)throws Throwable { Thread thread = new Thread(null,new Solution(),"",(1 << 26)); thread.start(); thread.join(); if ( (Solution.uncaught != null)) {throw (Solution.uncaught);} } } class FastScanner{ BufferedReader in ; StringTokenizer st ; public FastScanner( BufferedReader in){ this.in = in; } public String nextToken()throws Exception { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(in.readLine()); }return st.nextToken();} public long nextLong()throws Exception { return Long.parseLong(nextToken());} }
3	public class USACO{ public static void main( String[] args)throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(reader.readLine()," ");  int n = Integer.parseInt(st.nextToken());  int r = Integer.parseInt(st.nextToken());  StringTokenizer st2 = new StringTokenizer(reader.readLine()," ");  double[][] coord = new double[n][2]; for ( int i = 0;(i < n);i++) {coord[i][0] = Integer.parseInt(st2.nextToken()); double y = r; for ( int j = 0;(j < i);j++) {if ( ((coord[j][0] <= (coord[i][0] + (2 * r))) && (coord[j][0] >= (coord[i][0] - (2 * r))))) {if ( ((coord[j][1] + Math.sqrt((((4 * r) * r) - ((coord[i][0] - coord[j][0]) * (coord[i][0] - coord[j][0]))))) > y)) {y = (coord[j][1] + Math.sqrt((((4 * r) * r) - ((coord[i][0] - coord[j][0]) * (coord[i][0] - coord[j][0]))))); } } }coord[i][1] = y; }for ( int i = 0;(i < n);i++) {System.out.print(coord[i][1]); if ( (i < (n - 1))) {System.out.print(" "); } else {System.out.print("\n"); }}reader.close(); } }
6	public class a implements Runnable{ public static void main( String[] args){ new Thread(null,new a(),"process",(1 << 26)).start(); } static class Task{ static final int inf = Integer.MAX_VALUE; public void solve( int testNumber, FastReader sc, PrintWriter pw){ int n = sc.nextInt();  int[][] arr = new int[n][];  long sums[] = new long[n];  HashMap<Integer,Integer> map1 = new HashMap<>();  HashMap<Integer,Integer> map2 = new HashMap<>();  ArrayList<Integer> arrs = new ArrayList<Integer>(); arrs.add(0); int incc = 1;  long sum = 0; for ( int i = 0;(i < n);i++) { int k = sc.nextInt(); arr[i] = new int[k]; for ( int j = 0;(j < k);j++) {sum += arr[i][j] = sc.nextInt(); sums[i] += arr[i][j]; map1.put(arr[i][j],incc++); map2.put(arr[i][j],i); arrs.add(arr[i][j]); }}if ( ((sum % n) != 0)) {pw.println("No"); return ;} cycle[] masktocyc = new cycle[(1 << n)];  long goal = (sum / n);  ArrayList<cycle> cycs = new ArrayList<cycle>();  int[] graph = new int[incc]; for ( int i = 1;(i < incc);i++) { cycle c = new cycle();  int curr = i;  int val = arrs.get(i);  int ind = map2.get(val); if ( (graph[i] != 0)) continue; do { long ch = ((goal - sums[ind]) + val); if ( (((ch > inf) || (ch < -inf)) || !map1.containsKey((int)ch))) {continue l;} val = (int)ch; graph[curr] = map1.get(val); curr = map1.get(val); c.add(ind,val); ind = map2.get(val); }while((graph[curr] == 0));for ( tup x :c.arr) {if ( (((sums[x.a] - arrs.get(curr)) + x.b) == goal)) break; c.mask -= (1 << x.a); x.a = -inf; x.b = -inf; } int[] freq = new int[15]; for ( tup x :c.arr) {if ( (x.a >= 0)) {freq[x.a]++; if ( (freq[x.a] > 1)) continue l; } }cycs.add(c); masktocyc[c.mask] = c; } ArrayList<cycle>[] dp = new ArrayList[(1 << n)]; for ( int m = 0;(m < (1 << n));m++) {dp[m] = new ArrayList<cycle>(); if ( (masktocyc[m] != null)) {dp[m].add(masktocyc[m]); continue;} for ( int s = m;(s > 0);s = ((s - 1) & m)) {if ( ((dp[s].size() > 0) && (dp[(m ^ s)].size() > 0))) {dp[m].addAll(dp[s]); dp[m].addAll(dp[(m ^ s)]); break;} }}if ( (dp[((1 << n) - 1)].size() > 0)) {pw.println("Yes"); int[] ans1 = new int[n];  int[] ans2 = new int[n]; for ( cycle x :dp[((1 << n) - 1)]) {for ( tup y :x.arr) {if ( (y.b != -inf)) {ans1[map2.get(y.b)] = (y.a + 1); ans2[map2.get(y.b)] = y.b; } }}for ( int i = 0;(i < n);i++) {pw.printf("%d %d%n",ans2[i],ans1[i]); }} else pw.println("No"); } static class cycle{ ArrayList<tup> arr = new ArrayList<>(); int mask = 0; public cycle(){ } void add( int ind, int val){ arr.add(new tup(ind,val)); mask += (1 << ind); } } } static void sort( int[] x){ shuffle(x); Arrays.sort(x); } static void sort( long[] x){ shuffle(x); Arrays.sort(x); } static class tup implements Comparable<tup>{ int a ,b ; tup( int a, int b){ this.a = a; this.b = b; } } static void shuffle( int[] a){ Random get = new Random(); for ( int i = 0;(i < a.length);i++) { int r = get.nextInt((i + 1));  int temp = a[i]; a[i] = a[r]; a[r] = temp; }} static void shuffle( long[] a){ Random get = new Random(); for ( int i = 0;(i < a.length);i++) { int r = get.nextInt((i + 1));  long temp = a[i]; a[i] = a[r]; a[r] = temp; }} static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public FastReader( String s)throws FileNotFoundException{ br = new BufferedReader(new FileReader(new File(s))); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
2	public class code{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int ok ,ok2 ;  int va ,vb ; va = 0; vb = 0; out.println(((("? " + va) + " ") + vb)); out.flush(); ok = sc.nextInt(); for ( int i = 29;(i >= 0);i--) {if ( (ok == 0)) {va += (1 << i); out.println(((("? " + va) + " ") + vb)); out.flush(); ok2 = sc.nextInt(); if ( (ok2 == 1)) {va -= (1 << i); } else {vb += (1 << i); }} else {va += (1 << i); vb += (1 << i); out.println(((("? " + va) + " ") + vb)); out.flush(); ok2 = sc.nextInt(); if ( (ok == ok2)) {vb -= (1 << i); out.println(((("? " + va) + " ") + vb)); out.flush(); ok2 = sc.nextInt(); if ( (ok2 == 1)) {va -= (1 << i); } else {vb += (1 << i); }} else {if ( (ok == 1)) {vb -= (1 << i); out.println(((("? " + va) + " ") + vb)); out.flush(); ok = sc.nextInt(); } else {va -= (1 << i); out.println(((("? " + va) + " ") + vb)); out.flush(); ok = sc.nextInt(); }}}}out.println(((("! " + va) + " ") + vb)); out.flush(); } }
2	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);  D solver = new D(); solver.solve(1,in,out); out.close(); } static class D{ public void solve( int testNumber, FastScanner in, PrintWriter out){ int T = in.ni(); for ( int t = 0;(t < T);t++) { long n = in.nl(),k = in.nl(); if ( ((n == 2) && (k == 3))) {out.println("NO"); continue;} boolean possible = false;  long size = n;  long rem = k; for ( int i = 0;(((i <= 31) && (size > 0)) && (rem > 0));i++) { long splits = (1L << (i * 2)); rem -= splits; size--; }if ( (rem > 0)) {out.println("NO"); continue;} long path = 1;  long i = 0; size = n; long ans = 0; while(((path <= k) && (size > 0))){k -= path; path = ((1L << (i + 2)) - 1); size--; i++; }out.println(("YES " + size)); }} } static class FastScanner{ private BufferedReader in ; private StringTokenizer st ; public FastScanner( InputStream stream){ in = new BufferedReader(new InputStreamReader(stream)); } public String ns(){ while(((st == null) || !st.hasMoreTokens())){try{ String rl = in.readLine(); if ( (rl == null)) {return null;} st = new StringTokenizer(rl); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int ni(){ return Integer.parseInt(ns());} public long nl(){ return Long.parseLong(ns());} } }
4	public class Etruco2{ static String[] vals = {"%S3L{PYzV1%SGI'>$/4Gam=^#ODu|`Q!Bys%Mw|?fA*0ti{r69RB1N`{B>YC;.:XEmm3t-i^N","#Y73mVxQ&J`inFO4.v<j?yg{4~O=p=t$'#UHQizDnbsn,+JyuS~@WKw0p*Gy%V:#sa5,L|9RX{","f0J*n]5ZaRg:d-;{f!Y47]i_'u'cTz*=K$b#=}w[U]3*f+$|4ePs'K?]p8~0loSL$h_+T^{+ik","@r),FzP0XP>vU2<s9GIJ;0K0e)b_Hwyaw2}n0-%|lUlV(kWB<nx7@M[30yXxR(n:5@CEc[~,B^o","0<2C[Fz1*3iganAet-6RW8/X&nnSUf`Tu5-$~<5}F~$e_n5j9jD^Kk)_Xh=)WG@{4:XC;V4a|X]*","(_gw]4[ktYOZ},E?GXG5h{UF<Fx1O$0YNdA0+5)7#j%f)=Ui|3p^tt:SV(N^mbR9.+!s4fy<.?WQ.","%-i=_PJtuHA63yU,f)Gh@#Z*;FIWjaXwKS*bq=EOMA9yc>OD+}xg{z`X.~atEmXp9Z~*u]I3_7IxDZ","#N,-ehU0na1kWpn=P9ZK{TRs/&@KgxaK4h+V/ea!9Y3QYy9ZL}n&pn>G+'I+]ekWM$(g'8ym$Mj+,?V","coyL[=Xb>wzL0z?{kW5GQjeWPCy6YU<B/?paWq?^7__LMh<{ZJ+8!o7I.=<2b)j-)f!Cwk7!Ojrs[Zs","A+If^46|x9Wfiv3OlqZAUE[u(p2nLL/x$!LmSrR4Do9+4oYG:0P-!#>g9'|axl=i;q`E:ja?MDOB<Gyk","1$8eKLgE'nM]8^vi,NCMzBN{a<@{.}Yibo/OLo*`;G%v}'Lh~oGudWag6ECf{cpc<%]2ciRk*]k|/>y?V",")>A7nmMgLYs=3#7`G%X{Kr~U%||frj>qN)}H^GawXTT}/=bFAGD+u1?YNT_2Ht~w[m8?LLh=YBS!6(nYD:","%W;~8W^>]K2kwP_JIVOGo.l5<Z0zR51sXzT'sS)-@WFA6I1Q*{$SR0UT1x}[!]|^JT.N>;yA`kfH`f>E.`6","#iCwqRtf[6J>97)oD,nb>z+}nIJ=?2h40Mhp=)E'Bm|<?v1e<H68>yG'sA0#eN>Ft4N<Qt}eXeLHI|A7BmOV","sYg3/'{oSnr!c#bd??s'UM==k<CN-|!,}c8Vb[&?tR}]?N38+U-w=$yYb_3?k*RDR1=.q]xSz2Lz(&53-xGF","J<2wR!6o@K;#ftMP&,Gl;<VmX#2TNi]l_ZP]1Y$,bqcrIl_2KlqcXh46&fB&5{h/+[~5lLK8C*Ypm$UxRW4-N","6:X}!AJ[uGdSD@Bbe7#$g]u{ByvOp[nkDIG*Ln1@d:`OnhYjr#c]4qa4>hatq4l_EoFb}6FtSOQfu3j$>o$98J",",:=#^-<(+n*e[l7/{uM<_x)#7GNxXsA*v@5~9+*;=l%XX[65ms-a3rQE({l3Y#L'>1[lHW*9/;8w^x96dK8d|H*","'7C8`Ku%e]3X@+oX0(O/)~Up%;eaEA_q0kVkr>BtTCV{$~:ff]['Oy4lW[F&#5Epcri#A$q7qk3x(I[)Iu`+qjc2","$a|sCP(`q)r!w>3jHD7~;@Y%U_BTgu%!<]/Qs}siNKUHJ`^mEFMI!6<o.la&tEkP%V^q#RZb2S4,izBiS_l.Yh2y{","#ESSy)K!I_r#D'5qJ)s]SnZ8c:~PE4*;#A$[AeE9A8,{2._6YY;=~iOJ=33d8Hw)5vXp%g=WqVl+yy,VmtM,2ao4=N","e<)oJ1mnPoS!A$'Y}`AZVCZUQ0Ky)'^jQZB{eVCW~xb4f_*_Lo$>.Cj_X+%~h2UsWSQbRj4XoL'#yW?IGXbd[!3U|6","D`L&4'8NHO(dVv{+<uYwH5t#c?4YOB.5@z%:p>`HG#]pe,!!F.~|CZ$Qh]<J%_ON:6GMr|5b<w~)?1]6H%QT:hfMYAN","48eMirgOAMc0``u#]nz{aP5u:cM>>5B%J|+w}8}(y_Uv_VFq]rCYB1wpD[{U}={#=S+SJQmQ@~1zY~idvR]4rKz#L3L{","+`-#D+O:7z=[7GBB)R=eQ:5OZa'bc_[D+NFe=P3cdM3QKJVv*?x;RlNZixw?{qd#@8D>CoZzsJEqnGL!Xd3RoZ,qBv!4k","'/q7_eOF].wH,o}YDkMDO^#+TvDqr*Q4.~%*h6DH=0TCpE*m3T++kJK(JQlIwA~+r/c{N0,QD;1DDX(<OZivC3Y>J5Uyfo","$i+*e>tWyzs,GKQ>IP/+re2YX[.uY[jzUE$$o3KmUIDxlxy}ZdhF(wBOTip8DjA,cwHU&:qHwKta#[,SJ#oYa$BjEd<Fe]*","#O*r,8u<Bz3Vs&Jdq1d2AIxB3}skyib'GPee/r0tw^7AaxMJUncL$:O-C?#`!j:sw!s3rlz:mtk$|rN{Ma`!jezRkTgI>n9.","mH`mtJAcH6.~?en.+&TlY/[Wye#N<]Ei$ErRJJpnprYU1]lK{)rXjST-bu[KYUZw'1f<lYS({<1+Sz,T3~sB/);u$eO=PMmZ","J^-Oc/l}!vGny~6jX-@G>;ot_||1)VA<AH4Sx'fRx?%:^tq-#+,99k0LY~S4u^>Wn>(ai?;7'C|f=5-*X%G<R6i7r}gr#nq/V","8@>trXHR!F2,jQ<C4lqC5wlS)}t8@+,Ha]YnP1ACVvyJrDz[t6T9?n69yZk#&+p6;&kLk#Bwb:cA-|TKzXq0Tk{J3gTt*!(rRs",".AGXO=~svf*-P1ad/!n]Jc^EPtwzaC!6kKUUz*0TTW%qkFX`bO=/pH.QU!A|C,r-03O/_/@l*bKJZqO3HW7M*i;?h8;Fg`cS0Lk","(r9y<CJ.RO,zE$/)g%8/Lrp?VQ4+-wr4D?5IpIWtzbNqQG3UL!/L,#N:h7RJYVAXK,6LT2ZSx,J5mEDS5Es&}Y3aSMh`hLeO0/[V","%p%8Rcx~SIuxqTE=n?~W?J-$36syElGT#mdT~oi7bRh,X5Y;'iSv]VQ#R^os:M~B:daTv/#{|,.3mo/.xKESf^3FtfI#95yn9{;}:","$0XUj],Dq.GU.t].u7/,H2CQ_`#=tV?sV'q%#/Nx9E)Qgalh]t(Dx}f0FNT(VW;V2pK7!P?Ov]j1kz])U-l%SjP<Q}C?}eW6t:c?t6","#6CSvs;f%`_m<op_8dmjpm3wze?_~SUiAOHD@CEXM,vU}i+|V7zk{uw_uyynMDL>0b[9)}Wk-bC.J<SyR+?(zHXd9c{Bx]bA/uDrK|V","byn4b~4K[/q[ZNRj){-dXsS~xlky#0,DdUaO<t5JD;33h1B+<17-{#m)LY:8$(y3!HwqUuygn-[x(k%Hmis9T|E;b{P5iXxw}u&MD[F","FX|Q06PFPwj.#(LJ=`zx[*J2H?3~7vR:nL9)%!n|)x#KbXFkh{G'zb|#}0F.fZO}aV)7OGtt!^9}KBe[$N)d2@ZnYZnNx@s%W[DQr79N","7(&-S]Jg#y1n-{jgr%y57TT`Fsppqgs|2Pk7Enqw^[4N%~:{vlU1[z%,!_-RPASA8~$rq$jMG6,V[(+wGiX(A|2AT)M8Tx%X>}3,+kQyJ",".3rtg&n9N_e.5[77e*ftW;C1O;U%Qf,}8>.0q~hd!{IHpG~(.O9NdCq`VeKx@H$9(&zgo[{KSq5J-@/$Tq<7eV;6(WMbEkOq[!`nPBB/(*",")+(4Xy##P^T-5H~m|Xp'{=+G_`7;s9u.SvcNw_xaI'&R)m;`$(8PX8xZ>*@2>xfJR<g]PeA8fk.,H+WoxSrJ$dMqs2nc)4x(T3jeQ<[^~c2","&0<|E2l(VeGZt+;mpfAe/w(fyb#U,)i>{Q`s11FEBLydh,'Jz<a,_Lhd7pFC2(Xz(.b5-Yz}::NV/`Mm$;iZR4=}!ph:3+awm>mf&'%6KkX{","$K$o}U#q@7(@BTdC.?bOK'KbtD4!bv49z}W=SX/2|G}.g1zn9-1wwY!CV<h2i!ve2ifU;Y}30mtC)Ks~JrllIN_L0q$lEiv3<^HS<d/U*RBvN","#K3b}I$Zz}:>?3e>H4B|fEdd7Qf+_&*J<!HxkBjF=1W-YO*sxeKKt'<Sq}|C>:?O(AFgaID%'M![`@F&S0Wh]o_{/Rm4{Iz9w=6+'FZ8+By0x6","r:W%R2Z}E)rayr$Gb]UCZFBVy-V7|mEr/3cur6A*;A~Lw2WYGd;@10.H>*.i;J=]6.(=~%JoHc1TBa2!6#[q&TdsqepNhlz#`{iO_</yT,QJ%N","QIe,.{^Zi@pR~m4z`j#7)UUIKL&j|2656o<u+o)Iun/cgnSDn(Er*CU'Ix'oMqVLf#Q3px=i^Xe5IX>p.(RylcT?u2b<@dxI7CalOz%bt;ZO$@{",">S=~&b_O'HOj#A_%6}b!f&:J%)M>5+u1SDSR32En077OL`F#VRFoVroWa59I002YC@?]1LY(jhoD4S*R;}<*,Sw2mT*7'f6B?'^c*e)#c-)arm]k","39yr+-}9xZ[IL`G-,~bcWQ$e<$~*!dZE#tMe[OZ-dpH$GXdT,qJ:NvaAi5+<VP3PGos<bgu7s>;%-k4a,=w0,6.WL08y1x)1F;]ITwV5UtL^m&_no",",O[]LZ531#KNR1W/Dp*p#xX:mf$]Dx{jXE=GW#C7$!mlZO80(W-nJBnpDzuq`'bh'ci>$23`M=wagB024KJB/zC$6GeoiF'_oeyMEh+eI0&8TjgT]*","(H?He]J)!SWDW1'$5mj#LMOQ`>A(<!JWh/sqBVqh5`3Sn=~Q2Xd60ga6X8rmbsFN6$8;*KT$wtn?BI/GgH`Y;G-C<b(y{`/'g5W_R8%N7g$U2'{}>~.","%yke'YZk3,v$aBhJ2v;^uu$ttS1Mop#,iA^_9]WHWvy7^Y,3_7^Qm{y~axM&s!e(Go'VS.4Bk9v[B:cFQ)O75HC5qY|:pH5lgyoRD.MTg3AcVQ~@A}8Z","$J-~[Tc.xDAf+=IC91X/q9f881;?NR;9mE/RDn*%Ik,y9??^&bxA)xr/F,Va_'6eNq4i`kUsKl!|B=I#$}Mhk86(3HU&0dt{GTVR[&Ud|y:'jK&p']h|V","#Q3OW&>Jm<pdtfR;qu!:ux&*t+u[Y%1Pt>!PSbJku'7'li(^>eL_l.Ykf$SSv:q-j95w@3v[iec>;CDP=eL]#~R9<pnl+=46=$c,aB|NCp,3z]V8Z2MtJs","ytm.~`FCg@m(=F@@U{J0VYStErIP?I-H-a6s$.$#K{3B:tEBJzy|FEaCF&`2HrZ(Y&37=(^}eE+_AQn:/*$%:+ML,g',1k~^dfBSUBskMeZ~x2(Q6>Pq}k","XQseb,o}gb]X/'2P%Q$%@Km16RjWt#91?0][T%}q==jMrJGCPP6y?{!OJ:AQ_2dfnHE*Ys+8aS(+D`s&'@A*)E<hlY>v{N@GM!U$jyRr%Q';X^;@gJ#2&xV","DELtxBvP@0IqcRU%L-`xQ4no:.|f,NTu1xr`wDGEIVm-q@,G8|1Wst3v)9Dxdc77a1mM6&PgJKY9B~rMVkIoWIG'N>Mrl9YNg)o3)P}mUt^)8-cb$xI_;oX:","7lAu)]H&x-r)=mE]6P2B&Ifm(9F9!zNjJd&TN,b}mE;BPwb/*Im&&^pdI%@,U&8ZA24^Us]WYEc[dS[<87^^~/+Nm;?jMe|TU[mP#N,_D}h%-CQxL86/HF-+6","/t_'OVLqoVtJlGd%mSg;o^7S(~wf9+>I'INo<[BqyTn]v<PaeLj~eQ~}~X32b7ZTcAMzHu)6jtT2H?@M95(C1:?aNhYMKC(kvP=Z^~+6P@|viR#utIW/iI!3KV","*u-akgNqo>b6tkqN5DJSt9NoLl<?DE>+T4N-|<(&kFCv$Q%-fo9dC*4U!gnv<w,Xc4bXAhBV|Jm,Z]J0pMlXBy=*nbA_Pjbr#O;$%dfzGRd}KeJQo/RZNogHMpF","'eP7fDQH-H#!j|h>)IoEF6-WZC]lIVJ/@|?/s9&sqd)p^~ugx~zDDH`&P7ch~iZ-jKp5aGQo-v1@I0ugW3LsiA%U:CP`UP@jc>*E30?~zglP0lXb@p(<c$ePRwEN","%cQ]O`I?Z^[TbsO6:jNKN`y7o[~KhRv~iu=cY;NVxR*ZQxNrIpfSqw7K{#{{4dOtIsKF-':@tqyVW[{x9t4U}[e1-0XXTABM^.J,{Tc{(wr3Uj@+O7`rznkDp>s]J","$G?d*@BxvQ>{2NdbzHeR[LIa-7Q`Puj(Ht)5f+GP7]1AoL[>IIW(>*_Z2`H2Pq:pj2JQ^t|tr|;d5:JS/cG37|x(tV~iHgDQN-3-tyAc{hf#kdsD=lbd`v{64$E2e*","#VUQemGH]0leFuV^:<V`hp?J7x?aenY:C^^R:27~{+4jYd+A4{txe>S*/pWVcA~Kjo<HDh=.Mqo`PR,/t1yx&5px3636chFvn1$PAdbtca1B=7:64O5`)Y9`q)hc1c2","#$t@73::fTYCj%S]lKo/sIlI=zunsA#8Y5]YEEo6-Bq_u>F-NdUoPs-L'uH@/u++l[,a&e`PX|1u<TjyASURuXJFL'wxzLw<BTzE>*_JmA@$LcB,j:g<d3y`0R*r'!8{","aWSp_j@Tzm%?v;)3UoRbqZr;p?D:^wBRjKN@S;`AB|b,1B;(HORok;Tc1W!0qAF%Uq3f@,!+zaG*?GaT*'k@QN3K|S.N$s?<Uw-J+ukf~H#FgGFU`RNx`ZWq(,9=kQQN","KMrVDEkM16AuyoI;P*ZJBrv;!,rR/iDn7LxrWtsMh|I.#'x1]/]02wG2I^X3$WOMk0A?DkDk7Ta$FXEt]!hm&UK-RLlB$xpxW][P7=wuoM(e^M]ZerZ<Ey}eoNjw9pdt6","=[3C~w/f.74V:6:vze7B-.zl4Mw#~{HFD?;@hicn$B@AU'>e|01JEdcS^bZS,M}DH[=Fc9G5&r7czx%499'f&s9uf4X*%Ei1`=&gz`MEBv6TchYh=G:{7^+(K3V-`*r:fN","4NI+1'KkL4u,#{IDd(8p+|$@Q>sGQ;'T[>:skE#M4G7B^kOGP&~L5W)`DhVup.E!M46H{gMN+]THBE/1&.j>)x_a[0S:Cov+^]u&Sz/44.dqrhwnJlxxpLge!w{3%Ha!%4{",".I9PeehvXspF[F$??y]9*V0Da/~9kfR-%sg_NA#]Xxk~gJ(2JFVOd(F:H)G,LTuD]nY7weQX%'`M]sn{Q1abJ,J_KV{w?/.!I6SBb3I==k(pzLJ(0o$Ih35I)JJh(jdwLS(k","*F=.dZ6XliY}&(4]/>7en<4)&}1)Yk2%tdSgZOi7M`g|D-eWdts32qTEnwEciT[1[mixh814UhZVbCc/eyiMlf<P:`hMxf~`wP><%l*pFpj3A,Uz{}zR]9/pWZq_'|{+lsPvo","'c0|-O$kHD9._=4.EXU3rQN?)jM!C$%])y?0&TQLnGChYe1n(txC1vYA2L'z2Fx(#p2ONeuWeUR]N?uoLNKG_kk7DA:<v9Y#4[|a]h?eXDk1#TTWnDq+EI8WfPdGsF+woh+(]*","%tHm:f~UE8a({i;ikm_%*IZyoVGIlQl6)E'S|E7,mO|Sy|g~&sXWSc3^atX-c_@2,g?h9w%Xax21gl4m}3k?ZXn;JVDh'H6A~D[Oc}S0wcI9X[xxR!IVyA/+CX;rwO/Q<F2m(f.","$_r)|9(3McJ-d$423`!PiVacGmd-|wL|2TRIOvq&4>j$6PM!{pWp530Vk/pj9K#-J+MUCyGf%s|*:`fL)XzifrJ6A!Lur(>mBOhH_yW0A0WW'gC|iX;s]hv9u[{hfLp]9S|PoJaZ","#oR;uMX=U1vgn%6nTONc7HP;wsY5|sj'm>zI|ff>V&U@ZW(S)S^%~51fbNUoSCQCMm73(MwEA{>5&,!L[:i%HT6Yjoac;Dx%K<=2{K`)xm/0:9:p9$]FeZ,M2^0bE|B'>3JX5hplV","#:R)W$kuhEe3d_wB{!Y9%-/nZF$yNyk]o71|Uk1(2`Qfm8>g6Y7Wfzz0)-G8Vh%tqC$#mvyeE]-kr/W]ugLvm-y&HUtC^&71L+JG!!Z>U,}5qllO4?9`qnvKB+JHaCS!16I}8k5bBs","sy38-RZ3/aMN`V6#v#QS]a5vnCRk%SMYn)8W!]gau]4egu3aCsW2T0c`J;`o<|v<<VC8`@!SIi,x'4lTcdbh?$-=-2EBPl2hcU>{+:m{Z%mFZbNyC'ePuR(@lE2DLSXeSTeSaa^QPk","ZMhWciybNhr1kRtD|1_b<8Ax6tqq84EVb)wS%t-W^~psSX.G,jCrYO7wj~DwYFZAqLeR(53?h+g`INo7Gm$lCWz,209vpKRHUK:i/FY_aOWDl.gt3|wCSl5XWO0Fvh1o#?TvCp`4_7V","IWy*`0ug(-b!Hu}e4v-W+y358)Kvnq#M_E)o3P=w{,-ta^8NI7sALy>QPAq>r!<3xS#it4'Zi(.eo_~UqS)z=}FKPQ9{d.~P^K*~K`fb<FlZo_<F8Vs<iA.&q=e_I,lq&DP_1iSco94:","=s@WG606c{xgI~7*0!PO~*Opu4^+m>eGcD_^'/tf_Jr%QCIH>WOKnaw`pXz&xMbI(=+b,nt+qJr*+-TjK`Z,sURM]TL>d|[H[#(G`zF,:okg}c^(&aI0N%Z.`Sg!OI(X'kgH&K4MhLR?6","5dc/|C@JoStGxr~,2i;p@;M.cezli},k%lPJ^o_A)^e}+p*e{(3k^*[[ZrGU]JU^Ag?ReXF_@$=6rUGrP#qR[q0^,Gp5$9IqT&n29ic`r?==r@^whM:ipsm2%[=s`A)^+K/Z4i0Z[Kj!xV","0!RU141:2FQ7b-=QkN5lDbJJQq|S.[?N*0)h6S(/MqbBopgx,%e[!,YDzlC&{HLU',BFiP:8*!Q~qb8T!Gm[]Lt}f}Mru&:w5-16h#kvG.s|N.H)'&hYW)Zr%ZSypdd;.?S[ewN7CUJ|7'F","+~Oy!c<ye{%@^P`HAFbH?yd.U_QPeZ-Un=#L>wU_PlYHx4I-O4aTY.z%cbL~#g3Wfxkx2.,J(d({fC&|~>Gqdnk+G{XFMIQY1Z1XAZ,qASVDt9j/zS7L~6F/jkb_QL<}3oQEI|!1s3,+]9QN",")1'xJf[WHGn}?ovZ(M[s;tx[3Gk$rRWA4bx+Yw]Xr>?n9.mssuU^/bwCos?]N?v9,@xow'95f>y9=t!V,S(G<3Gnq7BYHJ);&[R33!;lE+cPcR%jurr*LJi]m4av[qqKQjA|}#g,|MyfNA?@J","'0MeY|zpcPO]+C}p[ScFIWpJ}'laL>}CR9LuWPtFfm;<bxFzP-K`h&HVtJ5M1wJgox/ehMdTdhv^gye}4A4_}vr6W7V?N&/C}duZI'Xz`HnaK=b.SfNWd'k/nYwtX-4`p(*BNE4`_K@)bbz*D*","%f)ZWb4.HR#3AQ!}3/aNEJweg0ZI~D$6B}q1S6pL7RMc[?wc}Ks:=%PCcQVVlwXTW4/,6@DP?uX-y`DM0]F|)#Npx$HY2@@A@b~_ExX,8HiX=@,Ykg9aU`K~R>hg,+[}h>O(6r!!l2<HdY:Y=c2","$d0Q?B+wWpn8pVU}Un4f[-JzQN?zhJtzI^V[%X#7>EIJ4C6#nb:.:Go2=j+UH[$r=~|Mq#x8c%Sz;Fg&E$`FwHdbnSUp1:IjEIGv[v1Mw+lg<aIzH@atHjwT=qI39mm*+!djVLZR?9{i9t7D@nu{","#|f?>D1?`|Df:<~jRYwxGXRF|~}O=^(.6)(Ge'@U,83J^xFhoN&6(.O3710XFRLB_o7`g7!7?#UYi>Tl292a9-R:U&jIJ[cI%.F7'D;Q)|XV/]J~X&!vZ$}%T[_pPCBXu;'*BmD&t0:DB_Fd@!a-N","#K-M@%$Z`Cb@'K>+z~C&~+]I;Y<~,DV)#k#pvMluvyl1Uq#E|(zgPb$_NaB8*.z^,uf~6goZrJdB9ZT5SvTG~SL#MJ^BV:Ua;(mf=!5/N4]-T:|O5-eqUKP5@([-QHtM/_M(_,+}jzwE,d8<xvc6p6","#'y8SS*f5SdrItW5ZAgEzM|htCuqTLG`5S?LGyJfQ0Ez6^dkIm?<AN.13h%{}::'N731(S=2q/TOC2C?1U#g!IFIvE|F'<Q'FnvH2FTcmoBZZLlWWQG~y>/>S{:@;Rbp>b9ejm8?1-{DoJL8@Yt-+IN","kC$'rcIg|P!GdR(kY2w_W*A*K9F[M]vO3&t=}I%mf08|r|@{<5]fy2xRwQJVe+*b}L0:AWdvVtR?Vi}AifSK%7b<,|n_sQXFAu_A6b:/.''?D@V#BkMM,@N&;ODqLq1XP?I}'J{T[r`D3'pezl7^6({","Wb?|O-W}`m2#~)URv`a&j4~npK{Beqg]+!g*`pL!XCV_IDa&IxAoB&LQt;]#>wwen?HS)%rSJbR'GJ!&Hvp;G-b8,n'izx__|1a+pU@+k`~/rzMI'SoURS[:`_ezt!mm)$]]34F4!!KkfdMIC]/F=1Pk","J!CDyVG#XcOnkE;-c<RE'[%&,M!m${C='`!Y$R1Q[hA%D/34uyM<X#QRV3W=<]p_+y9N`(<EH:*hQnj58gQ|R31b`^,w]?a_Gq=q'_wmDx2EuNX1UhQX`}OG+JP~+$pmqM+G1MN{rq}6T=_1Qe3q$AN~o","?xq)>v8vOf@l`9oGm*)uWG05rKQyNqQji/a`1acf4AL?hJ*q?]v97!~5?^.XsI0m:oD770_IUuMe/{iXVLl#S#X_H+:<PB@&Qx(B,-{)>QY*9xY{Is2hS)!lcjsc.l?$l?/h78KuW}8'H!8|b`r#5wT<]*","8O6O6|`gzc7![)&miUYasq@:fY,}e+MC#o~~.[gf0aU5P/Wq`(m6L-Kz|N5D(:dinev11:TF'c5FHAS!m!QKwo4$i`4%u]bj`6>^$jw*v%#2*QBKI$bk*W?|^_m*enz|wsoOi%j>?&PB(Tk.!UP@^bL:*M.","2|<^@&/r.y`4N%ph?-'xXSf`-k>fnliC80KQO44BS~<xS^5s(8a$U2`c@o23mR(948HI6_Y:CrpIy4-{o)5Ux}V~rmNjvEf~ymKd`@t!{j$-*z&n[yIjQO]qD$U0'lZ2W3%sLMMrT-KLlk+&yE7_F~;|nr,Z",".qxph,NAEG,gz7x#,gR8y}^?vd{'1pzmJ]^nC@vss,h!e'de6B3t4vY)^42jSD}ey.N|Gb,Y-f]jEfyCOE)Q/m.Y22WOp;H~YQ|<JfZ),%MT56&jdAI#72K?+9=.Yn|x/U0YtPoOfY=tcA5fYkfkMgY_#G+[V","+j|Fu,mnMb[[_I7{AP%`L!@GB->vOZFa{3PT{+&nZ;{Gd`CqZr?hW1%ZR3WqcpBQ2ayi}RE+>:&pLP5:rp]Qt+eZN[)tNwG.tAIztFPvVz]K~$@UB.o,6[iXpmKX2#)[+}0>:=H.al{0h1nA&|3w,4z#[PH;:s",")MQ6zmK`vZeC{H2Istj')PMbKVYeF<eM.o),T6DO<!&Rk=vGIuPYCTMY>czUhIjh?C;tiQugSI6|r's}rGh{H/(Y'a!a%9lU.n_:}Vf6ro}[;X0XOXrsl__lP1?lMroE|xEG0I:~UmEK+Q?vqsvKro7FpQdE.$k","'fC;a;Ted#3(|RP[*S{K^RtLZeavB#xHv<|{RQpa|/%b|_tY?>Q;UtC4,4hO,u9gZ+@sd83Odl[=em=7-^H%*HCE<eat.]&wmMbV{)y@-9<%[Xm-8Z=Hy2|2<x57P,/;o8hZZH;m4pmO$M!1M~4?.xfK]DP#'zSV","&H16w,mmofX[4yXDF.}Na@CH@^jFf,K}>M#OV>+R%0dS1M|`Q<yqyun1|8?Sr#xBau(!bR)MKQ,P>>xKRCI/Bxl2H4P#y0gD+}R:r+UeI$|[s6lHJ5>;oA~_=IX*#/U_t5tC?}%vd&R#g_fOENC_d{8:B?%AX^Sm:","%H*Hw<Ia]{(CEN=TN%QfM?0^,L2@,wOG*82YV=;@_iZ?p]DnnO_l>fa*}/3^h?G.XH+d'Q<z4@6{x`Y={B=H?e-OthzW$!&UZI{2Un[sW'Iz*X^Eg`F=3YU%T9SIc8D-jiCOnjd]49t6)CI{/*i;W[@`:s(}ydvSS6","$^s.%XfK,2Us*n]WU'k9Y>9Ti?20]8RxV2EX'=SXH:,X@;e|.Sb;.7R7wCrll+HHJ|O>jw:!P5[i?v'w~{:MycsG{*[}8JgOsqC%SL0t[HM}i41=Jf}')SGy@tfqofVg:6&Q|w,#b&/H'/.gM3>HqO:Aqi&$W|U1wGV","$(,3<E-seNZ&V1R_W=Spc4Br?Rg4?~dFw$an{FvyZMra{{gqA9+.X|vAGE<<L##Eo!CMQ~!e?e,,h3=K?<wT)|e+z:%2.k@VLav8M|,N@)/ROo']/KQ1P:X|H%Po<NFFj-+%U729dyXh,-~=2~fTYI3|AB~u_PcH-];F","#Zl-GtX['ct@ch9KkiOLP]77.6VNelm_SNNJdW.dFGXRP%<TwO#K98r$NfUG*#-L({8o%>XZF}J|D?E0DEL@v83NC.L!wex96!O|5QQ_*e7RG=j-Sj'o>2*{HV<)GOwH487evAZNk=r-T1y.=m,&Vi.(knw@I$;T,58^N","#:wmn8J6`[w<COAVr/!`3[G5V}yy;>2<UfHofYl%Uhh;t&1M<H$Y7q(hJNy68M=yQESKE)T19)Z;oRk9WWNe4{]G1J<_oCXnTy`%GEly&XLiN[K`H<r^Z:9s>Bei|x({E(Aoo5T{_BYg%2Edli_86seC(U~'B+>1]FYq$J","#!8/U;c]1nFCeP9%:a!g0~F%q3lXy#KH[k@uUwmEAGJt,wmWt8L{MMQ7Sr6'S!+L<z=tFrp^:'(^49)2fXPqLWd#<tHob8o^:|o9i]HcFT^;,8tDi#ES>'='m~au8*d?Dsmn>#WSWrgYm<5~x:g=(!gS%3/{L<~EgF!1s$*","l'7.(t`M4Y7Tk7XzHdB&z`(SJ>m?-f(bJ3{6uUJbV4+;qxH#UAT^aB|4zph0r(2z52!]Vrcx*h3!Z_<rw@bUdg6]B?6M;XK2-I4#_H$8s0Gjo@2GGER/F7/o9]Y?]rb@50|~5UVv_o(y9GjTwNs]nvw4wFBw0,{Gz7N|Ec2","]*=2VfKD12h27;a()?>O9fOx5@[2,TyP$:Xbhxtx]9}xp,-;&yi/Fo|0eMDY-50VUl)QoLe9=N0ed/1!<Q>Qoa5yto%M@Z,HIoStM+YJw;?vva-.}tFowDB#Wr/t14u4'nx%h6b1]XMVEMJEamjX;v=/<Km3>$S~N[5h)9T{","PD(W!DH&6nUOB'l@y{vk3w^|[rZt.RGB+rS=m~CrP[XY#LewEHqr{I.3km60z=fFEG31N:tlvhC(A4gEa;.*grU~zK6AuPX31.+0r*;[a[19~H/h~PN8Gt1hlA=iy$7fJ.N`bKWSCL{v&BJ#f8?t`zjg<V(wRRU>cbfWcVofN","G0^NuhwXa4w~)jZ[j*{E%YMCaa<&H.}X945dS|w^g;'GQc<-.a(E&5g/:ZEWy?abIifub!S|`!&]&AZs'ePT?t$6ZZCB`UI@|moZ75`Sg:_nG}k6A`&9<<^[>os<kF;0F4qe2!PA^}fqmcypQwv2)hC`D,*rEqHAm)uL_I;bl6","?u2[Z<@uQ{/!E3#STHVkA'RhMEn,'e@y}aWko'B&:3Mu?UVS-@V;Ink)`@yu]:~My@|Xiz7rP@fa.GW~DlD=gKzDxOH{6fATk-UFfFe=>_8Cqi:zL{MP#[HM'6ob$BW-(@;x[H`}jv@lWTdXKMdyZ}mK=|=U+*ePW0`AR0Kuy-N",":.{n;Au!==aW_~~/31:%|ap'pU+C9#>Hlf;h;HKs)1CYZnJ5ly_+@AM%,@N`|Eihs-c~{A~6|1,M1cU>*Ej`k:&.VOu;t)&e~~#MjS5,jIA;nB4^V*|T_F_z[-,A5}jP/_/i~Gc;*(fL8p%0U-A},qRIs*YKv>qa!y19MO~^(Vy{","5VN9jpHpDfSUTBca)i8|h}_bRyht0S'H!{CRO9.Sq[efz^ORXP8zS}x8~;];v@eD^HGNAle,7ZI`T1NU4Mg~{W(W-&M[<h|Q*[l1:/3!'g*aYkfa[REbi`==?-PzhwO:%'sXir$}=O}~Cs-vr5YyZ%qZCPzPPnFZ8h^fO~)wB|dyk","1x3Vt~rj21Twzr|,,=oz8EPC)V[~)lB|>thqaR,X?GC(h`u)I7K/BWtaGwt_!_vcA%!zerw[UCYgMvE,KBX<%m8unQG2aTCbOqNk[v%}%`]IH]@0n=4^G#}`jdM3|Y2+n|TLx=~d/y0fqc&n,OZS^]3Z,]%Q#hQoYNX|b)e~?PhY)o","/!t6rJh<$~fBmH<nWA'=$:;%E'e`;}v/jOSQ^b4YA*GEiGrK{~4fync%3;JCq+oDTJhIi|)u$TC>3!qC6a=d`ccOA,!aEI6XA~_W0%S4,2/KseIf>8eclVHN&a91=uADU2|N[-*E-xv+P@9xHT7&'w$DxgfW?nOJ,2NFOCcY@7s24]*",",`HDkC$U.~U'arpO^7jRs]noo(UES(0LwSUbf@#+JSp0sfGq{*b@i`n}Rc|9>Bu>_NU>#_DG)%QYR^a`od5Ur|x8lyt&]Wc}f{b5}c7:nQdLrV.Dqy|XUCZlrgL-g6uyCW8pg2DC[0qxk0B'!tA)s[y_?}xR`VGm$0pPcPn}g[Q>oD5.","*jji4DRB!hfp?ZuKi9k'ac`.p6,[NI[W#/?|N!'[kkltdB+{[9p^&~s7_[4^)[[|S.)s+Aou|O;yO&xEZD^)'U#A2F}V?iqsuurhiF.N!)7K!t@^-LGY_n2cxwvAT>q>>3go&'seAX~WI2)qxnX8n|}*:*Xb|)&mR<;RbxYd<}*fg47TZ",")9CRIedE3+m?Od0R1]irO:W=/#h7)Lh=~{KW0X0f^g9XrRAdlZ$z?Fc;x7j8Sd-2|g55F$;cXNhs/mw<s,TQDSeWsm33#3(R{,Ob8`2~@{k]$1Jwe-yT'`c&x3y(O-OmpGPhh^LrZS6j`?yx4~7T]vdtnje8zi{@=jd05}`Z>IkH'5kSKV","(#HoN7l>L4n=^ANA(IaRW.G[)a~Ba;X,w{e8v8clkID!fYH+5{|xDSS$uC6syF88!9+a9ih_egHrdO@.;1*{d8^F:zB-99jpxCc@:X8GEVd*'&05V`~33r%m+bT'lN`G[k|`QHd|TZtk4GW^DBSQ7e}K0muStmgPPmt`.n}-|KkY03@5^2s","'!^B^p',7STXpZVf!2wPNs!z53Tk_-^^pl8bur(,DSd-'NfF0GGO+'=a2*d#8-^Ja>&jO:J+tBeaIU&^5e^11z{f~{ytN6ul%t.p-3yu$VYB-tfY(/oPp9aH1j/L26}w{'{scAx]z8@zK7[E8yMBe(HyyAg!;ccXrY-_N'@a!(&L(Dnb/cTk","&2pjLw&NC{giV*juxwZWN_}/[*!%Ti?4@;z]A[]Dpj9h%~qj1_jYBnxTzo*(yHv`SJ^O]gr5jV{)(e2zqQZ%:t-CG+(Yh5K,%+!AAf:ME/x#fovahf5<|:Fw<oGcpve8n:[p[sThf_RUs&f:y}s&3wq/gD./o>3xtwx!+ir<@IB.*~}m6WypV","%Pd*8Gq8{;atxi@9$8q?&?f#T]yuZ@^,6'54subP_v/fw,i.Z0|wzZ0C>Kyi`Sc@w4kUsL^CAlKy-Jza<4?pk+XHykmfao.1jaLrNOiidfXW`_8'_xjQkzN1_rC`uJ/>xaq=>wTY7'HY4~2Z=_Cjmj$4EIKc4H:#w8[*CKrh]7C=.S`R;8jcH:","$zY+<nWAv5i;5blo,oAh0F/w[:=L@%K1XC1Op3Li<aDJFGJQWPb8Pd35kPWnJjUL<|hoHVruU)5ikGU6/s*|o1<E4Co{yhRn*>[C1+$fD0@A:1Xw^.m}j3NJ+3vw;Z.`WIKy!ZUBTS>k(y5qJnaw0X.)d*=oAk{B{qJw.+10!m$m&4Al=A1f0h6","$OHucOmzWj'k|Jum@9Mg64h49fO.<8K2<m;z`P';F50%ZrwSiHx2t1fS[/Vx'G~#]6GA%x`QVa6/'%boOHc2U+4kXCnB38j]ff&7PfpLTCa*EDDM[*)ry;]$,o~vrZz=bw}CYJE-~|}^ubb6O{~]k9dB5?uW^F&MIYW@lgQRYK*zVy(Ur}2n4vtV","$,PB8I?Ky'%q[q^yot]_Sjm8Wem9n=BQ&e2OXz#}<O)5gpTR7fucCdbZ[yh6a&xJkk~&=V;4!Ug,>sKDH|YQ((c@x=U6i@i<'U3B6.HtIftpsNF:xp<luo!!'9k94a}G=fV?[h$lWDCO,o$A_eWM=;n#/Xz?=4K<2:[4n0miA1kDTcF;`JNr~tbOF","#lOxX(0q*A!6x.j;!R'WxF3pC=Vx}q(RXzrm,&EyEr1C[a|l,QZKf|+OUBof`Viu]gl8VQn<AoNKCcc.k8N#rEuv.2_}on<_%s1=Co/<c>3t];!V{']M/*&jJRzd,?ZiD[x%.`[5>`SDpjK<WI?N}Mk)wf2=03N5q4'uc]xqVz/n~:L~GG#CjO=tjN","#S@AU=fe$SHn]yzn6gqIfj('27i23vxet%fC4Fy/8('5p.1'RED9mctIV'Tm]2H0BA'wCtJza8k>&&JC67wZtn$O`4HNixlu9xHK.(z:4u'8bq>f@NUXG-fktAC,m[8^t1E=@58C5%_n}I#S2-C0:]*!fx^]k$=xGXaEyh7puIJVR*34^DXH(ArqLeJ","#?-RrehybIle8R52XUN-S51F3S*IX;?(cBUR25Uv(_}JP{?OI:P~2L5>LNU-Lb8lqf~mpkvv/s[m7_L?ov5Xb.(7IMSaBF]Pm~Wy)+0k90csQ{URTd:%zd}wkT3W87xMd;zJNHBFHH4!^28nJW0l^t^57H5^o%0|{x63}4rm%'<6!=@)(kWl7oNm3Qa*","#.2hWTPyqLPcf!YQV^I.ok9GxDNS#ENgo(8{r198n0M(gLp8wZ<-4F4[$mmI;vfrbKM?5pK8S]}6jV!a;ZQAEKo*SI;IOQ]M#-{.;=[Wsn?Df^,RUEX#IC6Q>[~UZono|L'B}Ux^meu(F6#oSkphejQU+q57hm(z}<s@oW$+VU5QBl6Rzu{zpc$B?HIc2","|xQ<OktmmS8Ky.b)v<(=>^0Wm['.76wt>X`B?9)fuW0)JoDfwQzn(MAedlPn}ec'Ce:7a>3(6)6b+)SoL4&)trtualfml=v$6Q5lVbzlhb0k_f=oqfzI:7n5Qg|y58?mJ$.$r+{^1#+cDWS.xAd]Vi@>+##Bsm8n`3OZhV9wiRT(lpHgT9iqZ5#m,(=4{","pv*~5&:|m~ss@H+X|H0h~{XZ'oe}VR1'N#q3fECr1p%l5&j7c(WgI8<TPL>0Y.X*P6(V{e4e-[;x,a/9).'tNQ]c;kbZyQ%kYH;(3CaS(rS4XT~/e$[x/~#mgDoxv55I@s?CEs`*^_^ZbY/G3zD.3SW]a_c?g,j}6~]5?9kg_K#~J7>L<z}i&|}v'Ns~AN","fe`c<@@ER5E?wAhfkO3jAKY+$anJ4X4iu{h![)lqYWaK98]!ZrQ3w$5Z'e3$5O~c!S5sMta/lpI4&8G4.@DpF?inWC1dDbZn`=Bz$M!;|8G):_X:q,/`<THEO5oVfJAum6}lHQQH$Qy!BUHe~vSP7<C>x@ggqh~Sk5+BxKu5ASf(rr%ls8ZqR;J:MjpD,h6","^)fTj5!q<yp).wIma11RS7,=?v1-]iV8-fvs0m+eBTCC8*h@;I-YEXC{o#gHkz@CEz2u6W~r^f9'Rm8*.+2OQZzpIUjO94@m<aJY`|~ynb$Pg.R/j+3,DnahKN!3FX1:v4lJp_X'<lp0a+G{Sc=Dz$)BWqF|W2vEJ)NJpTmvi[+pa;+)aF9rM*g)PO-WminN","UevaP{tsZ_IsFO.O,DrTETjhFk[Wm@#Y!IL:5t/CJ+eq+HwWl-OYn1Yp8zF$cJbFVw(rVM6A6xm]~:#rxW;mW+z:!>bGh%#/#>ZFPr`6eKpF8l%*tBz&wG@|yVt-6LFUUS4JuE,o@9&hYOGjJ:+<&o>nW);'0BvR/iWa{'%a/8vU/=}t$%p2KBHBS_KjSy+m{","OJ{`D$g@95?7dOu1+UxJKIgk:kRZ!I1jiWpANY{$[9.BWkzDVt<yHs?dT~p^m%U@]30Q$-K=&?+OcjxOA(?:`_C.LUElc$Xr75ZGBVUiG/)1nQW}?5cWds>+D'3E~zHE|.a&M#$F:/4Gwh3-y}IE]r@A@)%/:^=NpD^*H2|J@TL~@G)gbvDQKDv2lI!xa|,2Dk","J($ts4G+1>s:%rtmu!H*(UG%HoXPAR0)(c(_mDXZW?c|1:i*0Vq!gS2c[8heGEh?-KbP[k:A=7Y<M:IG/-5F=[Z/s/;:tVgk?,$|mjYbv1fF/t[di::Kp%3}l%eC}F!RGzy/1BOwfTA#}?5$`|StC$^Jc{b(z~~ALPw/[~]WMXi+>F=3=,MXmBvf](f}cLPHp1o","EJ}~.I!*LesVOH,}'d^+y`qqHU0B2?<MERaZ_{E=yP&9ZTn/lL'dpd%qR]gmH}&(Rmv#i7QjV'1PgKnddXjj%sb$e3d5a&llD]q.Tq-p%dOn@F&6+Mw/Z1zfjcs:}vW|&]9H'4A<qs;)62i77F$5O-)AB&<SXi]:Zo>[U#CyBl|gN?D|eR~VD2ZvGsOlJ.W((m]*","ALzX&|aT.Dmt`:~9xe7&fBf0vx+D:ZKNp9l9s3B%96fh.IXnH~R'an0yT?8{cVUG>0XF[*O=;nr[N(,tpq3^H(Aq*!h6.5%%cySP?;?bY4nfEyJ+,=rd8?9Hj[Xde.|Q:;_VoTV<;ep'T5kX4z(,.Mq19>c@y4VB+`|$}TF3,}ythw$VqVpMZ%N1^o*H=BMmE}vz.",">$rw|!m?2><`[:&M2C~i(d+iZMYy<dI7Gv=qzvvp*'G:=TOy3Up]|&o;(sc,se!5o>^kT~a!HFGqZVOGonQ7G+)lIYGe9!ys=Y!X|GJ@([iWe'e.QQKs+V`:^Ip=W1.^~Wg?y3IR6YNWV:qU`a3naI-I9#LK*}Z&Et;$?H1fgIcYSl:pwa{8uo.[0$pL3n@<qanU}Z",";'3^il_9O)ZDc7b@u'P(0|&4WuNdD--=?b[GdoBj'qqswyT^oYv.`UmEkrBAEM0/[5q>6+,a0._sDs^;XCo/_JkgCae>]9E^kL4=#?6u}QLcBU/{s$VYuVK'jbCF&+JEO(a9.f!./=Ph5a2votzQj8|(KMg#bSQZdU*@eYem{leJ?kN8|$&xqTYg_vrZJ'::'Sk./;V","8MZ?;{+LTa;B,{[N^tb=&K&xKbuz(>oY:Y<BZTIC]q@STh_a:_>V>x}bA~vEb4S4zw5+NYd@e@*e&Y^?NDbUGqb&4VYj!kLq!z,f[kb+h+a2WC#>Y1kRt0`!i|3A'Pvo:Q]O@(QYZ}/6no[T+rV'rx[(}cZholzWm|Ykw<&i,u>!DK=rKAa!}9c-C9OLb{ag4sPTfl*s","66pK~$<x#nX}}G2ov/*D3nSu{O&'w[ZFY5x*{9$;'v/}Xxe|{#?hzRC;%-Gly58=@)%v@p#d&&gyd520|(?>-P3zl%HZol(aQGhI}>_qSWGlV(@'ZvweZd<TjH)ovAS;NBc?[P<YJXB1JFxJW!YbG:Xf)nO#I4|<i_8)e,#>z_riy,T#AW=j3)GUI*5!pT9;Gj{o<E7(k","4:J?]u@Lll<=)L~k(&DLSSq+oVUGVl@]Upgd%0l@&Qy0w]2&*OrS,w*~B6O_F?PW.byYh'vU,&1bQMv^*Q}P7byDt-!F@Y%RTkj$4vv1+UZNui~~>nlyjPzdgbpr&}/kK/RTx7PMBbl6)~(,JhS}gu$&./z7d[0aa*!Z,J88am1FfYk[17~6l;6Se5y+#.k!}.Qgu)X]/V","2T_]&ocY++_6VV{$.GzkrjbY1+F&}bWvhUAEYmSKj}}3{nvy8J&U7QAFeFgOONyG/id2%p^Oc[WLC9XteY~by)UK@X]1{=TdWoDxAUvDE(}T3-[(jEt:o`e^OkdZb3z20;$%4t;l1Zs87l+DOV+|IFMZ$+7|DqL(<s-POEg^]nSL`G)Re1t?(*#f6GlYf`)O^;mnG2@:f$:","1&AaeWkkM6l0VZnBT7qOB)A$@*:T>KfPz6#*Kk[pOe7SU19>JLD0um!fmCwL'US+5[Ss=oW/BfNi;BTku??4Im]ip9n}~g2D(Dtg@=_.AMA-:|Y{&g}ZfdXe(5;`H//*Ns~ca3SUeOhz])%cbr]D-;qt19pyJYNTH6=vl[QX3*msbQNp!,gV=F:^m8KOz,jut_d#ViZHxE|6","/enI@^+TreiDlM6uffShI7yAj.F?Ow+P',EXBy$^OF#Gom|V;~AkwQ0zKG!cTI%jP~#luZiKbLLQ|sG;?67y-@S;Ty9/;v'b+p4zu,P1LP[E%u4efl*I%iZMt#}U;S6$@(1=>h*imkBG2qdJ:pO+y(Q~.g|~+?FFe:`gVa~]NaFyC!eHkV3onN;L{Q#1ySeHB8pA@AWK?r~CV",".Un-RzOkdbH$-en3szwY~^Af?hTU)]iSk.4%F*@[*ldxO'/W6%nhDF2SPX^>[U`fn{y4MEMYOz:$PB6u';8T'*<L`*'c`,;!uJ`kb90#?|$hYmUJw#UdGgnfJ%!)H}mw76#*.)i,'scblCSMS:7b=uz={5)~Cr!N&T}L/.pMt!.Ji_+hIw4]iu{dqrhg@DV5/Ul]>#X=.]9FdF","-SG;#)fjZ`(Enb}`}W*H/VxeQa7Rj~jTV^PP;O&Fw^'CBHG[JXYeYHZ+2l7;G/G0ct/klpDKpq|CcK5jd>f,y:g4TyAmIPJFh{x5+HT]1tKy*|vph2kMRx}ltKn'|@Xew!>/sE+k.a@e(hDOfe<%j],euH(/`inABzDnZF!dAJEmln.F_WJ'l-92?-|zgC,f<S0lgcxb^9E{2vN",",[yX){E~e9S4jvQT/~Aakj=uo/4@*gD3,V*D8ofysX1>Ae-xXq,}:rbT{,HTIo'ZMA&i_DpHO%Q&Q7>>xZQ*dTP2_`oXz0(cO$aM0d{jeNH.?(5F-sg7$9KRkFr)NgGC<3M`Jm(Xs&8]K^+9g^;jSj-Nx&dK|li!A73VXF;'6yLj_Mb8Gk-za{wT0MW0>&^BwqJ;qmQ)P?H)n1HJ","+o#r6Pnw$cD996'^:%b$n&j,0M?G|GHN#y9(1k[niN.7ZpfH|<wMH*eU.N9R0(T95(7WaL#SfK^0n_c&k7#/X?+YFj|iv#^p61D[~(:`Q7kFu$?VIL7$knd(Hl`-qjyd{9`b?d(m$*Z.1z(e_v:UE%@qI#nj^R7%F[Vb6&h'=bPn%8TCgA;kuuIV&)~u'n7sC~KIG_XP,zOl3.%@*","+,JO<qcGu5bN/#%H`j}_DKpe09'ECkP)/s@fqz4!]J#AX]&R8f=|/TKnL2#=XM[1YrBFU^E94/536qmN?ZE.[Dk4OVT,l.++@m+I5tT$nZpWbGo}$o8`0/*{>awt)US<.8{Junv/Ds8z:iZ|^q}S:CA[5,$<CjRW[y|cN9<oU]#&vG|hxvc;s:;FD_M2KWH,TkW'MZLn4?7Gb6TIc2","*N1[!]mY?Jj#d`:'`9${KbD!(Pt7~jyE4/AT3y@eHG-:%kGs:Mj0J(k^Ua)YlmWR2B>vcUR)EL_ro]^uYOLVcGWe+4dp8ew(l'G6~5%5!D$5KPf,+k)/Y<%>#g-v=|*_x=^E}g{Us.'Ru5Rv7VYpB_K_j@[75!Mh+x,e`kO;PHk|X)e{//t6}<:CV{>`)Mu1fM_hj.$>5j|_Z#c)yq{",")w?e1OFY04O8C,8ulv*]M0'`67yRZ|AOqt!+o<2g6l-RZn6[Bm]%7{&%KH.>Y5&w0n*Kp*zJbY<]-xwLjA>nI7,TDj]Mp?Qt'wUz~0W*Qd_/SF'PMPdPa4WS2aL&MKrt2e$3NxEz{>V#ZwL5Zkg4b--jP0=o+ZIg8E/~B9~Fjv;8YIr!xWVN^9']ZH}FxlTAr|,0O!pw-7OeMMm:?/zN",")H.Y(S1~@HuNS/&&*qk1w{1V;{IsIcRDYDrx`BO0Fu?3C-!xR^uNLzpl~2UafSvwtQ7sy%RveJkiL*MMeJ6^mlGaShVj6J!_nt%<MURec4bvC^IuQA^v8Dl7Wr]t[bw?D8Nl{z:#Y#J|EuO-?MK'y/@w6S)MD9b@x$z3[o]?zvmv+=35RG%=?Mona((Ta%_Wc/QEx&>0wUIC->&T*hOd6","({zdo_T@^?&st*6ZCH4F(nJ~oWkmJ/]-1$AMJ{W;y_xDV:GWu<M1Fss~3n=I<ng8gWsZzn:N3>ah*Z*(KSX67WiMz.(_4hg_f^^%3#9U.@'oFJ<4mk+2HHc&3TM|e'5NEd2=3U>-O{~EAV;RJ%ICi$~kQY8<PW|m$|IPl6vW0*H@~la5udc%'s^/t|0s[}^-q8o3UD'/qlVbnc4]!nLYQN","(V4iSgme]A-r)`jW>0kIH_fM7&$}JM-_Kn/mM]Ov)k-Fq*e&ts=]j1Pb$lPO`sO-al2xp*8c*7o7#lEMS_cOUE_X=PL`/jsfLIwAn$wRfY5-n:fl,k:PR8hCrKw7BGgUc3J2plF6!dD[Duy][J0l8MSc^6q#[J##A8lQw9V5=U1#{+^+_UdoC5hM5;)o4{J>l%@wEa=;|e]aeWV<Ddttma{","(5FP#L;TnJb)@wYlgh`V&UJ1pfDaVF?zL;Xo*ZfP@S$JSH_=.MWZYEKa-/!|PX`)C<3&}(7~HYu'mch`SaQCx?J(IEO)!<+,kK]8&ev/Y<^{97:aWI3|[y'>)nS4ir$WP](2de{wC>a$_n#mf}tj-'851_),l*ON:j.<{DqqL3acKw*P7!<@63)ek%=)%Jk8O(sd_7NV%-R0osNX,JY=>Tmk","'u+diyQHDXQ$$dXf1h6%bbi}zKe1G|'1>lg5DU1{Sd1e-.a']0Fo0G0`+MS7BmEF&1ro?C|EM#)nI%v2<]r+8Wl_!OP2iPzXmhR;K6&P(n(9h$q|dWWY:{8'`B5wD?/?AP^nQo-`sg]-3*~;sK(;)x!lY4*5J$<HtCZ%Z`j6RE<A(wr5NAt4S(dJl@yh}B9k&GwA6LMJ/u{HfioiYFDVN^59o","'Y{H>k77_<{*x>yk^IdL{APT8y#~[r`5~Jg1+o3p^$93<'L=iDf1J5n@e8?EzNR;>7D-P*?WL=i^=,,y$Ad0nHhB!]l#Od!''l{!./F,;KZ(G-Q[KUlPN>0Q-YQNU#.fm)M!S=f.qwL@XbV7e+[H6nTB{o+kq!LO'q2@j'n%X63:'AoY||~!2F4k%n(t'U8w]ivI@v,uAVAD@$H`{(9b6o@,]*","'B^+L2*tNL3]Nhz?9dWv#IWwdUYujTZ6|@%rY}|6}k#iCD&PWuQI6v]J+2(mKP5zFAz9:4H@GRW%N>a=_lxM'$K;b[q8Pj9HDgQ`Y1KH0g;%K2`yUc+22jKDVDz]|}K-urG=IXP}2qQ5p-R+}AIX:|S8i7rA79D^{/v,|n!qTs|TNdY+0G1$KmZDCB:Vm%NtV(&;eJHF9bJiLignN-[0@]M5db.","'-s0fO*o_?61-|:h;mfv:Em>%008;X5kh)xjpmK]@`p`qh_iPb%DcQSWDWZLlQ$=6[JM(Z.t+U%7mGVztM`Q7zCW0GRq`eQ0MP$5!m7thKT0;!=@RRTXq2~!'p%vEQCb!Mi}4QM`cCp;Wa]_1c_l!6H0l54z<*(:5'v0?+)0Se<8~@hW-3KUaer@0cgb&!Mye{:2:6|5@j(LwDM/cuK.vMITUqHZ","&xGB9=4|u&BO]B7&R~^y.n#./!R%Xx.Z8yzDO]Uif%k%bBd|JJ8ML'b_&L4jekaLZrkA%lFtdty4,FZ2`V-Ub$KeJo6,.N$!4SW<K*}9E>>jWqq./@)Eqw^TWt<ic@mhQm9X/Kc*+yi!evriT{c0*A8P3'i6N$3C>2[j!S.#zJZi;1emv*jXh^T[yjyCK3;+Yb|0|4re'-HpZdsJ|)C{I'KTv^x+V","&h%DhhZhb6@Ev#_3evf|V^yG.M_^y<3~5[JBD*sGnX:u9>qb}#L8-59V-Y]H*62;#TB_Xpul4.hu!cyNOjwyL`[L^A3)>K9V|3a~n)_GjQl;^h|tp)')R/;yr'rva/J/~-a>)kHUAW]:tqJ+u{qUKE#3d<A*aVWtuB2`KzK@ewYYlleW7JTd;eqmB8?,GDfrhV%|o]W$8a4`I>j$xjV5m(Jm2j,f!s","&XWQd:?07/|#n2R_%sb9uEk)x^#GPt/M#%s-u1liz!<PXsXW0uuF~Pef2tc^nyN8Vg:/bu=N%&wsEH:_+q1j8oTd5aBeDtU}?wa)/fp[jLO7HB0Iex&ht;#*7$@z'4b3i'UnE5@kksu|ac}.n{ZuT~On,Y#t3bO@v.{teuiGgCDOVkBW*d;0(S/5}5~:tzR*BbHQLfD)YF9ITfc8t+GtMb(XiJWQdXk","&Kt>R1iyl{Pe-xo>`%s8+*AuM]3_-S1^LlW}{PDMB#<#+q<E3t(sJ7+#g-).:;|Y)':lcB{C5lT%CvP^vm#rHj~8IlBe8A@,_D]pv`4Hf`rDr@@3h|@/~$*/&,PPaqVOb)=uLG>Q~Y0'#<e#OVID}ioWl#bEPy6e/MXb;toMQ@dhz'wi9)Xyq>JW#Ob]z=>cXNzFDw;5)aCo`oWJH)18!j[B(?M|w#KV","&@m<3d~P~N_)x?M~JJ|F<gOgG[_R7l&`$MmdJ1_Zs5sGV@.+]iZFZml-UrV(lgLyTI5X1Ea6b!^)Y$L@>?kL*obXI1/UCRXbbGb6/|AeCbFYs>.&5DE[+jkdf6VAI6o#t[X:}{$x+O{@b.&-]j&Qb%kfYbd/>e'-x^l/2V_Ub.8Uqunjed`TWcMyvzSB<%oAFw9E3~)jQCG5K}3H4O+nM'U8=olN80[]:","&77g_!J'DZOxTsR<MpgQ>c!C[DeWJQ7)~&j}ZUTl8^kAg-z~+[fIiM-#E_Doa$1blY2|avWsXD@dg&nwT')C'w]E_MH5o6VrA)@5t|FaYT/]^!FbFif;#<@w]1'w`7/0ePPy`-TqLQT!sa_F/!,d{xL(A(ZX.nItXk/mCpEe0UY8.2<76p1N0@ic#g.?P[rCe>)5_c1FnYc.>H&xV3z:_Qpv1]Wz>5P736","&/(WDe4PS<6CY3wE;L@TG30Dz^28T?|K%fzH%u%+Cvhew`k70^]4bUUwLf37JL.jo5^q];5?/JkYX!]B3e4)5-R`p|*Zjh59k`:`Zvkt$5@zpd=(OV(E=HRK~&R(M}(M:JC*~gP9'|mq#D:_sawO0)uBk(_FmzEV']l?EKF(lqF}*'fU&QV9cdI2'+~Ql!U:`v@LCJ2bIg_d{.;|nQ>;&o1zuxb&,h110pV","&(7*iQA{mRD@plNg/h$W{t?LBW$3FNAt&'-V1F~@2J<Y*WKEc0VE-JKdos<Y<,%B=.9_5p~hY6Mj4fG~N5NvkIZ6rMzWnUxmrclLBN&gdE`X.RmiHeuvE|IaFZ7iEeIaSu*r5WWMi#D$D@'[3U){`<A{zqXeA!PD~[on5'TRI^'D0ba|=%{t3Oc]PCBvaHQhqBdB)?W]D>wud9m}#M=!ntYT]>7t=LPp6hxF","&!]tzv5c.`qp)4+]t4=0ut2?p<X,vU@8R~TX&9#L$Dvw(et!Mxvt_45*Dc1>}ZtDLBst8t|8-EOZt(oeicymv=U.YB}JOb/,sMy-m(z=nRw+mC#cr=])HS<{5z{ewB[FhoAfKB{IH8V@+-=nqTBEx=xUfqS;L4TKnKdg9TsrR2u&LU=$Njq>ZoP_'T!5QL$*h^C>K8t{Bf#wxTo.&24DJ$3sK0I:pZ()-6.%N","%{8giEEItyyGh{>Jz7g#CZ&I>/nR{27=qWpD-=w_H:Qfv>$'x=z`Ga4-9zQzM[[)b/pFv%nl7Y@iVzrq<O?#%mTyYp-OW:AYudAM**9W]tN0qj%zw=,l&h$UaA~'Z5{k55C6q-a0cOT5M!l{;ON3&9,v(9lt`@T$iqa`T@gyjofT[=.t~'0aCGI(2isA:)^EU@u^tB1iI$Mr2GsVPXw.-+TV(3Am_[:e/07{,J","%x!SSO+~//5`Q4|@j72YAhOb,eU/cj@$MP9?,TjF(;={.lKHq]1^#rvyH5QcuGFd+'Z5>+f6},iR3&`gBe?_1iikXz;:VB|$a1Av]a2vViLo~&Q_I;.n~0^<MY2'v#sKqxb8#kk{joFlMixtp^}s&ae*DgRf,?'VRYfc|#5:gXuZFA4qp6/:Fg8W~)6`.YWmqkelY,X?J4U{Y&.$=A>-y'v.;~_%}DNe#WJ-H}*","%ut0`n5]=4(YL9xQIxIts8`F-2NC)$6s>pi<:ea}uKv:Z'&WDU@:'i*^!1.C*etp8x4:H'1Ukw-|jwwk(z@$&p$c4snB<N9gj5cP,3(f1.LfN&.e%c{g,CL8<3y_hx/ggVRFzo`l$?OavoBL[ilpq8%=AYw#i$@L1v@/s|u<wG>9W13E*&i-Ua&a*u}U>(4]K>,XbcMGR^6nM_c,5ece>AVx`.'A+1+}b*f6|Ec2","%tqMbjP,)e(VFo~:jq?7)lauN9~?RucQ/VXA0lAPG%fjua)y6hq>,o0E%YcRdUfPwV@N,Cu#j9CbEQ]5jV}?+(P~oCOeE+js`t)Ltu43h,J~+Be[r3,{PjQ=bhzk<JUpNAWI+(L^Y)4@OSUd(hgpqXpHbb@qVLTWE<76`kFA!;?I'HpT>2M-f|y;uJ{a<M@8Z*fff}Vbi5X#d3Kq+H~mBt?uv`mx`?2Q8rLDtw4P{","%tv;h1+|!@_Je-oSg89Dw@1@(&T9(}k{Y#}u5VIq^e.E!'lxwP9_NH7NyVS#`co}Vp{{F<:LhXN7Y|j&APt7xi_J%{PYb;<,{B6%M9}lC=hW[o)zT40MmZlR^}!ekBy*iuL+B#,51-';v3YAaz`S/v*UDtB<nir)C#}GIG2g<i}E4x&!cx,&,BMAa{uh`h2MQc;(S]:{]N}e5zmfxngL4YJ0?D=K|gZ50{U|y.;>UN","%v%;KXf~<;aM<6CI,N#:Ypv5h4DdU5uX.yQW+K$[}^LyjB~7_gNgyNS{M-%@&<!@I!eQJ<<2r!C&=|t[44f)IxiS7+=)QS]XOm#P7cy1|`{]`1-Y3e#l2m0L;8KN.$V]'T&XN%DYEPG_=E/3=s*ZA'Q2e%`.KUaeNH?Y=ML;hG&1,h?)zFO]_B'ouAz;_(<GsmipHNwF)@'WORd<&baV^d(=rU5X??^ndw^}7)&5o`6","%x9'{X)y#eZ6*Nm)7$;^%f!~VF]w-3T1+|A`u_oL4M9?eB-qEMLu[IgLnXqPw,]k3%<S`>03nP<.4x-VxN0jZ@mlcX'WI^?BX!MPHtn-PYX&bZmlAIeCS}EsyUZBItOfmBZp&UC6?;_g)571xUkhVl=<RMXC](8B/m(3F81Y}&[D8d$_J:?(Os7ZRHu7m-k-89UJVn'8~6BJ*1s[uy{zY7{a[!7=El3FHK58ly]OLJ5N","%{V/DZIv*!rN5JB$p=z1>_uL!jC_CTz_skqo(6o#yHa0${3uU_5_c_bK.7{/PI*~h;WQ|!%#WcS++vn@y1<;,3f5[#zOYM2-A2n80XQl[>e&7yPCvV;L~YV,L30D'AIaVq&Qc'*:}(-%.FPbi.C6:,aihL9xlGng8yLu#eC^x_sj{5`F*N4]3[X!td(fpakTOwtzvu/otDIHIO0,+yn;5YnP8Q2&O2$N@mkE7:bqyWbT{","&#!y>t~PAqR.V%|i~`K=C`P;mtyU#PR!%n1Oli~bOm!)r*hAnb;bRgK%<dK'*&Ikf_etTiJ.Yk,,6AfNm_1_VYGmKP!K=D|%%bOan0S9sTm~4<'jcWo>>g^^VX/&KUzVt&S?S_'nkk{$XraA:IEORO5lOPAcE*)K~<<|DJ:E~6fdk>J-!>Z5sFw1}%/_tRZg/.Xzr:Z+R,XTfXBOb8yhex@rPct$)kWn+TkR#(y~d@2p8k","&(Zmm.72gip[0d;F(1gqQybOtV=ke4qb7qaMX1p#}WQ]`>y9[t*PPHw`eNOVOI7Haatl)A=D+khBJ>)@s.kyCtaWrrM8#801>!e(;2$.a(w(!$6$C>*H`iYYEr*!gQ,gXI4DJ8LpK}Ui8EjWl9kL%3dr#UZ8c<>-OZpxZ6C]Kh}~nv_Uy_z'Au(kC8v}8q_tA0bL@W@/m&p(u#;eGw>R14K7ZdlLP_HZ*Q.H6%Z''2.edAo","&/J.Nt;:aH/>idWpCdRYg2wCIBkaUcRTQnF/g=.{Y9GK23l3Eo9pu!:1^)Jx>2z?a5fDS|>Mn|R@*F-ZL,^3tRe2=@0t_D4;XHhzwC_I9$,D~&~)ikBgc[fxH>lHQ9^]al!XT%h&klWmyn+v=zrt)Ky6W,xrc)dTbG!/`Mz%(bG_klTcSE}?XiMx96c[8){-jb%i<CfyG,xkvc6X*j6prsy7cT1W<<P@IDO]xy=q>E`C$,]*","&7R@4`hqsgPzRn5o=?!)eD'HaSl&/Og$X&W3<aoO6YhzAib?{}pC)'%hJeSmODCG7@`i?z&`|=#_QyLy.A5%#KP5$s3Cf0pY>MfYp3^AH{R}h]-X)P.I+kv4Zit7l/E4>dD(c7m+:lx6]cc,IWXz<85V8M/L%=].{ob9`jD]=RG=+<.Mro,t%33iif.FGt|:,6-]YHCBY.f>DWmd8;u0%+!'ti`)>oyIj%UJn]}C6.1wK}jI.","&@zz+v,sQig,mt`fm(,1!B=M'r5&_J6RvjElE4!+XZsF|-qK(E0|si*lS;~r0iN8rY[w7CZO}B+;Cke7Z$il.f2{I,MDC#R}BuM,z`h5!&D*v`{}S5OK$8F^NqwXI4sCOYjIjW=)E3<AEXVJpno&wc1RcQfoR_X4K7|S([(~h<:b=TyKHT~vuB0P^dGNpz-;oSDF.R*0Vp>8Ws'OH%]0^-pUVp'NpA)/Gfx-;R/Ko'bY){=*qZ","&KmjIGZ}T`V7=r'0bi}T]>`>$]%Egsbu[Z6VW7hkWYL/>mX!5x-sR+0HDkWp^L/K`:>-aJJ[=^%$<BZ7:wT+%q85dgb>&v@muDy4TZa7Mw^[H!];dZR=)dj6k$@D#43dpTOjR2LT|'=4WBqQ<4(*s@C7u=Q|?7VaWO3`E*fp!22k-%}.AW)aBPi?wlLgdiN.}Qv8>p!V]zw~=T{y`m,P0^iH2,!Re[u/iN/{cfLJN]*1n8~UsxV","&X3z%oAU7C/(l+}kOFxyw<;,UVAlqDmb%YrwLZliJN?_T.NcGx?Zz>d}OCR+h-KNs[Eo(LTUxQpH|EzVy#t$fSRACzX}OLDMg9<RmN]X%uhvJ`H|`:_A6B+ts9~5~j`.Ja%L|W694xWJ9529FLN(@BK*hu4:L-0x^[[xzgOgxZ(:[B@[Ix0z@u>?wXu#9#g!f~%&u8G~A^34{b*xI4g^H'v[LIHZVJ0WvEg^0?!#AtL%@niuNJws","&g6(*iJ8SU1zWu=^eBWM3]LnnE_{L;-[/]ZhsTTn1]pCEP`k,P25T6W6]X;zSB}j);xo[pLN)MR~R^1;XqUr_??:Lf#:yFneG[w:*@38fx$CJ`jR>bXP9x*Xu:Nz84_j][&'<msmLBzap+U4@<_Dyq3N~EK.I9pTe)9[v:6]laEr@K$t_xk0!`Q&=0/:3p?O9z6ZNg'Gmyw]qC!,atvI;GwQU#hjI!LAOgh'0<TKjk;bZh<h$~0,k","&w#ExlgoO#qZ6lAsSt:7yv^8`Dx'F+l*!(m4+|TQ:3ez^j1f+l8,]{nUFFC[;DOc/Y>Thu9*6!E?rDJ+&4ez?FC9oBs71Q6s6piMuEt+y5QJPE?gQ?D&~PaJ[,Y+N=Sj_8?+o0g@*cxp`/%7Dxw5oPEYkMGcw}6a9)k5:7cbBAbahP+u^k5A=auzg#>u0^#B`WciaGQaR:LqUN8y@]+T'b5J|4ZAYW%ud_W7a+ZmWG`0CZA*gvD*hV","'+g!]HA8.`yy,}<.C4SAm?vgFDY5FOomR6S~SaYiu(mSMAk0c=SrD&b&>E9k=v^d=}Z-Y0z6W]af8F9pCM>{XdtXi#1@?n;~*.@B!zShx+/WsV[IQ'4b<Ib/>>$jJs+^EPej/U]eM!xRX~+}af1oKY3n1<dEliNH%Z=,)jzI~636FM5dS[e@&7L=uu)onr;z|A,zn*|+4tjn2tubaM(h{ZzNvY~(S%:&0CgN^xZ#K<:q;q,F!D-OF8:","'?V'UGGP|}`ZxXn=MOkdzNC&k/}je0e9*(y}_n:~j_;=FKfnt6u4h}QXnmZaM&QZ,gr4Zc/PDLJDbali#.Knq+}rf/)gA}$+psUEqrl`{jqksv*1H0V$fLSRW-]LGRn*hkUbamc5FS9l(ns!'eG8_D+NX}jz?}yW?Ixy#=?=pZ^1Ts]*Gf*Fg7&k:p~+U;Xaso^n?`>t^aj[EZ]9x`;Y<(U&3zvk.}HPLK]So:ouQHg6v5|JrO}dKaG6","'Uc#?%n>|8i't.1^>RSl,1>(n;YL7p+V|agbq]<3Lzz/>Nlif5ULaPS/zsfH@)@+{N/h+q@+mOBW9'J)<)iOyS+u`!mPW?hNkschD7EraAZYb!T6ab|P4hP~mQBlzl_ufaG^8#Y{$Hu=a1?`(zfa6Pl:O;A:;)duA`r*a(Vu,z3Z.w|A;tIP18>YrYeCxJbB*Id^NrRE&J14aZ@Fpk7FH(-{3STL=#K(,)wv-MY;E2@^Rk{^,_ymI*H?V","'oBzev'qdA])6$DzD~H]@XE/oCQ!)n*?knyKAzGs|LUg$)6L/>ctZ,YPPE_d5$S-8w2dzUZ)<~Js%w%+S[SRuFjkPXh(uO`BkzE)}+uFTKl6z5+4}/r(KaFmMU*IAoY&oH>A~(w9yn|4poCi0y,LKewKX~ZpX4]5r*o+NTUwiVBwWeb+uuBdM(kh%Lq#(#Y8.j`|.xCY{@Lv[{G<|2x&eqz~j_d`TE|1g~@7gAWd6'TFO][}C~~pG6lj/F","(-myEJBheWd$M:Qea89c^S@KCJu-cBC)s1'<^-a2L3,2-GKrbO$.zDhVldQt(9K.YVCMux{-2W.CO*Z-(`]l:3(xmpmBcY#+y'Bxqwtg#bh4Jev*xCV4a0gIL#(<K`3]-.?E:eDCwD8mL2#+!&^bddW0)vEFgS::YT|<z1,y*cu!Sm/K&-afW=N?./t`ew@:uR~L?D+<,_EeNrNA(>1<02KFEKb]5p&<2kT'dsZHJ:U+N:{1EY`kQ{2-f1N","(LCHV$f<zGDO-wbl4E0M`_mJP_lh;8>yg#KdAosur!XxkPx(lA,';eXc#EjK,_unyz'|7=$?%@o{R8l{<gL*i](dB/3gK+3?W'X|j`{j,0jZviwjs9-<NC!{hXgqL*NHZ(6k+Q6V&v7:s7~}P{Yr'qK:~>M9@;L--a|_rhB=}kk=B6;7LRm&*:a$T>[6k8|AvhsF-Xd*[+7b($1FG;tD=g`nVrQ1h;GysC4<E17+>^2^[#'Hs+1YQB)*qomJ","(oAdE+GLv>6~=l_*8JYlzkp/w$,a`i'8B^m5DGFHs]<e6l{Ek<j-soK>.ulcml,I*ad?:2,H&nn@']+Fs8-RsO:'0%8la`w'W){an/[t5smfrRY']J%7E6+]f.[ijXOq;!_'E{GckyEP:/x'oWtIDd|cM6%rL{6T^q`dvH:H.B,#J~e$aDkT^Enyrv7!rAO07_9,_f%mb,kfU{/X-5rt`)r1q/`az|[7Zl-Sy2(g_t!Oddv4.@dtw<_E(=a]*",")8/U6{fR)$.p*i7Jpoig::%Lgbjhc%ItuuumWH{Rgpq0,]'FJH)GxuB:kxv2AeJ[1<%t=ef|`L}r35#[Tk-Z-%D}Bf/ihkH}?uE{zG`UDH-Qh`,AW+ktq`:iz2bCLWrv,ua*|7?Bv!BPv=w[mC^lfU};RTY+EW45@O]1wLD3[jw/!,bnv~.()%9O5>K?0^quTs:{^yD{hF1qr98sgs;I.qST5w]BK>f(d7t3Q%DX~CB.P<E6E3{/Jf!S,x==c2",")c5ji)&<7G8&W07Q7ywkLV6ddadrpgD|kk?:-N3j&=f@2C%_X:Nh0U~3Tx0LC;=3-t&QRKKwIN2CB4;}HapMEN,eoB:-;AyWBY<f8+&=Imz&'G0H)=R)z^c`9VL;[tn7THS%I=hl%J;-Az^8.23qgx)h{*hA2G,-Gr1z:X%V%SRtcSG!=:y~wipa9Sa9LL,Py^U_Am(>-rRow/Wf%rDB=vRe*%TJS&0tT>L&-[f&?..1G%995'Q?$ayhv34A(0{","*5'%u}Aquvq9uA$XT&'3yO?hMF#+vClkz6+mYSK~.<gKdBNfpE/H/>+Mo#&Kiuj~lX':Hm~:^t]jc.2Lk8q(1,uR,gelMoKxkMkx6xLe:J8;W<[.8M06<E[,h*kT5>8@45%{tx5@~I#JMt:H`Am^)|B4xTpXfY<gx2x2OP%g6ct73#<h|DFbIr=f1mruWtZF=?8xq}aP[+()c-EH#7H.WN%%6RYHpJ9-2n'X=(_0o#;sbfsvt*}CZd4cj)ze/M1N","*j8fYqG8>]b'!FpVzsCwfxV&Xx|y)0x$Z_W`=vdj|}!n]-A&B3)FkXp=Olvdr|,w!(':$*E?1J#w&hlssJG[=Hj.h[?wbD*o/]a?;|)VI7Co){'?OVqcR%M/;?j=UVa%y=2^i4~?^LmGv7pT#{GB,a^rr{&5LF/'}b/d&`c3SAn0sfF]%H6v<)rzUAgOHu=TRqp)3Q%txW3-|J4{U@z#hzL]?QC81S?=GN7Iw5`jGgs9N<J&K,QEZ^+z}r5gLS-[6","+GL#RG:_9-*4VHCz+3-v@d|4}]Q(2C|^;{3EhQV*P9`VgI+=wF5lzC%tTtAI;:nr{{N8Fa;Vy?.>5dI'}!$>t&[6>!jZ2`oI06za6='@0[($>!+t53mXfmIi2w}l]gA-(X']HlpH8wz-CCL|c}wu`qd/E8h+ZL`%;-.l]gLg2tzG1EsFm$4rW'U{b3ZZwR:*?adn`tOvcu{31hF9W%Ioh?Y+M'[tc|]zp%A!r@A9Izx<k2jE-u6oj%8YlwJhneH:vN",",,K%#wHw(_3!=0/]*@_w4#ZZM:#Uc/B5.MB%ph}6W(tl]4D|[<jQ&<[_8pf|?S/Tn&=sQ#1xS@2A^bt:IIvdo*pRACAj)Y2(&@OQQ6*CFI,yc}]gwOT__iU{qY(IA{p<<KdRNxubHz>pI6/5c%PuVQ7;q9fldg+!`*D,qR{mPFRK+qyE{f,l739/zxocNS_x'ZTT0[sRv)K>n4.jONe}tO4u|'z+(Qd3g]Q?a+4IK?]%bQ'yrTV?Bc2iv:>unD9`gH{",",v*ASLj[c=7,Eg[R+L2M9fke#p3uXw[p>$X9j}ugwtRG>p_/_6ej|[V7lMj+GUfzca1F6t_,^P#i:P:Kdq]yMHWiE?$$G4&F9nG65{+.efvZ_I$dH4_}hn@{|0Vfs^ZmjNG0BpL/!hgDn]mGk'Um]H.9j?1&['3)uaN|cO!Vk[o6)FC]b/QLWTn:[uh`th6Ou{SS~$Qnp`#!9@Y6,MsT@2J*.j1YUl'}'7@d_pX64R*had%Z/;7'pqJ!EN}iNC@{A%ak","-kFXt|5NetdlWQ!fj*)(BM>TKQdbDM]5#!v>2(C1'jUtXGb`[WF}n2D%KFW&WR2z!*<qtKcXTvOA6@bk41B0dBk[S(`G9i-]OvF9*_cM{1s$g^xUE(1tAYi<(qi8^{.GB[-^Vz1{7K9OKDhWPvn.!eEWv^18u/D!;<dfbUu;J$rS%~-L=+e0LlCcg,bs;T0t{fsyh0.gzX(&,dF4LW6&.'FHr*tI~-1xTr,xfJ|/Ye0mu+$2g4y}z,AIpG=:8f]vC|AIo",".jRPe)Ixz3EFION-8<10CQch}[N*i^ySd#J%kqc|E@`eeS/6pv6|DBPsCgGkK[nhs~j*-M6<}_*^e'276|^Njk0kz:^}(^a|#>T}R/W6H-7MTij%Y.|:ak0f.60.=[#CAD|P64=s,EqD@Qo6;v-5U=AzEZ42z5xv~4-oP8rubB~Yj'd0`$`Ex`t%h&E/Qyl`k3v-n9y,'nanhBImM_,'&ot8M!Njr#E2Wx|YOm;cgTk)]b,He^1#~138yduJ(UY}%e8m]*","/tn25c-piMHQGKWi*N0_3[IS~gmOWriMZmoi5jIJJbEtorn!P(A|6-TW^?1t?Kn>h:-V})$E+,KAZuKfvjb7oC'R#V:Hb^+~^/#$>pNjsI.@ez*DIs{6=7Nl-nW&-Jn}<f3agKRHjW9v?&c$D.@n(}M)lrZ%8fb[Vj>|eF&uL@P,psv1/lTROF/$qZ69:0kxn7T(Xh@Ws(D'-q,Ifq>.#`0h6~NZX]6;$-ulg9N!<<Y4f.1Z|B!f.Srsep&+J}24[2Ek+1.","1.mo;$(!s'[%;&&<-t2?J%I3n`QizhNX8}+A2xe#hScJ<C-bq(X'+>A3lt>%{AV@p7{WNHdbwSf<LOiPGbohO%GUdmZ_'[TNr4wLFzpw|5c8aH]Oqjq/1wz4x6(wr-7yXWsKZAT@ijZdK<`HWd>(q+Jm:YH9EaH~TQH5}_I2w|QH%EgKUEPZ4vDs$?;9&a0'DxqdGn5=`d`0[wdrFjr/Z[]OQCn~q<#dZbhlul!|w-E8G&oBY<6fIh;0{|y.@G@O0qqFt=<Z","2T>'F|mIV/wuwiD%w`V;mBjqFRQY)$wY`]UPanj#%Q~1$<i$KZv#y,i}Ixg3M?HnrBA2Mi%H&p@MQFS0juO}R|)IGz8!t'6ugd97FonE7dS.e`Bz7[#D)@+G(OW4]2J!ZG[/H*Jy_R|M[`w[7=~Blk_GH4gdj<!W#iAyQ3rJB[$1+9B:>r!}S;8i>`alHDFk.5hfSKu0{_fE(Wdif^wCnLHX5[GbS<EqKEq7C(EbBqH)G`;a37;5V^5G7^={n==4;d+O`*!hV","4.C_<}34U0YZH_VxuULz|X_HvpkdRsWZunf8'X+o[_QWB!o~e<^Iv]-k`voq$@dR2@0UE@tACr0lll$.Q6,*N4TsH~/W-g@D!M#'_FEj)D&l[/Y&lIglsR)9Nguhed_W3UH.ogHA-9g.r<JG[M9v[9[OX/qJMoWXYgVw)m$RaW|b,/0Ds#3$B|'<vc&lX:2@WW#.>O|EhF4]B;5c0kL&zlG)70zRi.63uaD-urd$|v^qc(GCI6v7y(?9,TSZoZ7L8H~(b-{yos","5xG/e&BMWR~Wx$Z;{Z:;UFO[lJb$oB-#1b~!Oz_sg:I/8ccc(#d1i<?]FJHC9_!O^6>+OUpa%]#tq.MemuYBY3+r=Asg5bMfs1>z<JkATw!jJ)NF-hR0#Rq?Og}7M=)cw~0,`F$Y5Yjca|^VsjB1iG<.]}meEn5+Q+Pi%0'Qg6r*>V?%d51@26I$*g9G-;P.PCzn@JX`|yPOL9MH_ysB2Qh^A@<{LkeoM4#77DhAm[8:P1=^:h:w1/,-z_B-$+D=e~/RhUO7T]k","7{64bEI7YSYXC'5O>.5j.mha3?mp@Ov(+TLg8gy7un.uINhD{qy9h&,9KYOr_HdOaBb7;Hxd?LP<n0h15;|}ax1{Eh0u3R?VlJ;8lFV-r&h3%kb0<hp*Ck`$eF1%Xr|GeF5L~N`**MTQ:<9$eVtvMkr65mH=MD!E<]`c8,E$Rn'OQ6b']#3i:msPo(6:$'c|V$'FoSR)oRe2Cx28gI,tj^3u<Bs15FXyE@V4i/7NgXeTC.}r@3TP>#n5:h3-Ov!Gb.xhbf6Mks'V","::)$OcnfBSmn@7IU`'1S1-O_}5I.[aimA~U#bp$aPkLT;)_A|[]aCP]=2<O2E%>+2T;Oc59@AlqJW=*Ci:U!+*>Ec1#63#ab}gm_<3e<v!:Jsw:b00gV1S'/juk8+^E`mAUzo>pB>L-WG>:AM%@-_(3|K0S;4oELKfJu#R_n*wG'Z3}wT`p/Fe-:J&'5C_viFg}VHGu2SRF{'SOT+LPJ/6/8t@gstm|wd-_Uw8;&%0}~8o,mXzw*uc$$<es8NN6AjdAHZIB{r?$q:","<sk#T>!Lc(Le<:Zr3UX9DGr_2NgsDA*jTPl%,?vr]o(GaKf*$wt8'fPWNZ~](-9ncVirxqMmdi%<a}WP[uK}.xD.33Br0=Mj~zL3f8}j`ze4YOd7_k^e7eO_,Ud_)C4)wAopNr/S+>5{^9./T]![<5]78a>%Sln>6}c+y$jr-2`w'0,)[0+B[@?$VU7c-#!;w]vk5!QiJUNq3)c*t?NUw-qx)BY3*adv.2L|C'q!Jr8vF$m5}WC9%-4HE^v6e12?[U_5S0[YaRjf[6","?qkr{PTow/L,sEA^vB+V3:a3t_:mpOt#cuHI#M3@Xx8~b0)A(fHZ/A%z}Ez?w(=eYp$J$dMy{I!ku&M@M2.v7pM=Lq-(L3s9Oe?frFXE=kRu*|/@TV,TiGk!`H|uhSZRB&GMh!;LuCk$el13F`8{]{El2TGk=9.=wWRbcNGK72D*<g([=k&CmzD=R;]2M8{&P|e#G,QT'br{+|xb8vB;+o[&9xVA/;sX9}FoAym4D3@0Q3_t1J*u(.z2<=$xAzdore6IZKc9A%3^hlV","C9?Mqu0}qGQW~y.d#FdZhCocB.I^5~G`5v`F|8@d.O[wzKy>N*)'q_%-Pm|f_k%bp*/ItL8=8z|gN><hWWl&hgaYUp:#qI+P([}>T1<Noiw>X|rB6x92dK(4S_p%msE/L&oygwV2e.fYo[?WiE}goNu`{OuP80IE7!1r^iF?4=S(Kq=8??pjsGHj3=f=N}vaLh`;~5ll;y3B,Ae`q%E]S$V`V2R>yk6Pp]b'd!juqA@1Ut8m0e_&Kh?fibHL^,59VKm`{R^h-%.N}JCF","G.N|9^}I;^ww7GkTa=EsSD7x@1@gE!h=K{8Jw'$I5O,z?]C0&dGv}HJ]NA!)XYH|vb`hz'1Sd`n&yk@TU{YJsE,/)ltz6ad+-lEP[V`}snyV{a(FT>`M,X^+0o$Y0UxwM1`r%PkrlrjZb3>W>[lNqIDqokzSaN<=D/;<qW7?@9PZ+?McX{!{WJi6CkNgx.lQ!/&ZNFc~/FT1a?W_')mi0;Aad8BfDzXMuZyOr.<{P{29?uzNd9HDPl+j-4[h)fnk&yRU9(?J46Q25e}=N","KWOC(Q}p68l~},uN_Z,:9X$D,<^'IH?gCGQ<I$RU,pi]~w/`0AS>J+gGprGN,i;b=_p)of(ho6JYeNPX!,s'p0*wZ}'w]rRGYH!G?S,uE;Uj8|9'dv0'YJTW^0SO4WAkPt6LJ^nJ+6fP$}o8=9Or>@e;snzndN3C*%#?u%Hm]'J$KEX0|`TUe}*z|ifD(Q,p8E~YW*6F!G-z!0Dc&z2#h`qSD]&;p@Eu{wr)goY30hwVq&3Ba?l(#h&>7U<6Mv8:^iK-`p@FVb*sMpGlPJ","Pam?dqbl#gMC2O0PRE)jwm!cA<rt(5<_5C+qcU{?B)kuH|2~4?zz{C~h_0FGsO'w9Gf_@C+~;98PqM_5!e_V&]&:;sNR<'K>nf1%E^K{[^vB}Ci@|I+.Xlk^XzcBt5t|@Xhu'I!f9(9CZy$9B(gj`%]92~HUzg-^$1g-~AEJ(hx]UCCi>xC;D1p2;^isxQ]0u'a*&yW.Iyc2D}{H4(N;C|59^AB%:^8p6%>95-*o,tAn.XZ.XaWi,Ekw;Qkh{<tTqq0=>#q+;8z4lomkm<*","VTIn9(r?$7Xx)1;w]2Jb?Slq:dcYABtAriKzhi*Y<EeU$d,W90ll?UC&x%F#O}<APi%7zTX}~W_w@D=2.8(G}e<|5LwDBqUv6Wz^]iP)JAi5I-!P9+,X810i.J%E)x:P%qBuNp(2B6J'A8u5?S#C+_}N>toa}ZjHW~i&a4Bsp@`b*4X=rkF?YC!r-WownGVl.Kd=4lx7=C1MwOa,.yYl<j'Y]EoV*2v#H0cuU`Z#;_LB_{%;<WX%<{EO[QI3{NL8b/dqMAEphBPdT{$N.1c2","^>3@osGB*<Q1%xC[$AZQazOp@SZS&mh!vvaY%?dmK}]]43CG~<|]4QyRDZ|31myYfNpG.^9HhG4b*n1I~@Vd..-3a=NFr)]$QVfwsCpo!hb+.;tf9gu&b#Vn!$}swDZt@h&Ln1$/d&K_Y{;tKTLWU=v~h1Q5C%v,I_R(tpB'yZIpZ<4gbP;^&+=]w@M-RQ/V5G6'&KHM0x0=Lw:`aNS4z6:cT!t5(]O:l2{mZo89YCupkhyr8rY/w6(*~csA0dCto()kmu*AC?p0W&aj:.Sm{","f,(mTM@22om}$P=dD^rB=|x8)T,_#?IME~?~0C*/&G=%e]2aH5;OTlvL~f$=]h;6V&+<_'W(O`LWn/%wX7B;'|GU]iO3V9(nIp2FE[Ni3d`1{8a<0C6eA;k.XWGTn,!3qc%O6fPUI!A}lI;(6j-/3f[(IDT98mM?x-|H6n'RBR0j_yaTw@Mkuiz:'7:||5ECcA0k2|Y~bozU%6Y9?<RBw%'gbcem)]'?1~.BBs4ilD2+TmuX*~OU&^x5R::.-bb{IVx{(>x32W@U~!zte1?[jN","o.cIxaY%Rknl|fLYe4WPx'-hAh*V/xu+)mgJtN.c2<U5FamI2>9GR_H9-.<8gso^VPZu?dPKiZh?H42}_@D^byW,d4pOG=>=Aq070N:<PSQ0Lkm;a;/d0hA/j|_6a<Wc[gck&rrG/|3_KB:y><D`MaXh:`b5xCn+9YDHDfRb6i7?zkOnzt`~}Mh8iNS)XN:b_d9)#m(iI2e68*wfP.'{wMR;sVso;9|qU2Z8'UCq[aZC0}$#n8kwI+!=r_'ILVk{)+%P[[9)a06NC`D`7P$ODW6","yYmu)SNT]3WoS2z&m5gBK5[BTU@?BU/4m'yyHpN&SOOlQjDf7T!0og);75[QD9jYaBC%Lp_U|dXTel*sx#j4d`x/{1+1hXLc&<jd^1dDGOL~wJc]|H)McQ566D7FfdNwQTN@O2ivT%OE-D~@q</zrOKW(.Yo=}o+.5Ht%muHo:#j'R7y#5v}`1yc3b)`IrD)jZrGYLMMu4P/[z;As{iSo$srxm(RH]_U~3mK46xw>++m_s*JTWr|K%(7,1)JaYoC5>XFrDCgW_8$!xd+M7$Fy+YN","#(ixw}il[2!tw^QFME&fy19P?|Fl:`ro>CfGn>8fL|j%onSR[z=b2P*W|Sp.^L5AO5r^QwX.IjSCGw/a<_M+wOIb+cOn^5C;wS}ufT%w1@W#k|?O_d;s';6bX[y;6-RUOX?DUHz5i^/)w(j;/qAf]O)uwUChhn0My}G;s{Ky&|$?B$o%i(P-@ICzlL]X)1xPniOG.imT0UK)3_]elWQR^G=tbVrK+Mzt7a:#SvXZm>fm>S%+ltYg}agv;zc/16=(v%&ew)qQD9gf0rGN<w$@4cl|<{","#6y-R`Z(6vm#BS|MQc^96=^J#0dQaS9MT>M}%g`{SLgh7Xkv>m(oz?UPFHL-$yl(%@<q]I;p~xm?Db2{Ea@hE1wOg#03(JgtjP(n6Ed]Oq4x_K8ys?69wY6Z0juzB%U?=OI<&HE)`U]RRib/f#0hd!sdH=d(%-bg=tMz9qIMvk@@@Eij18M#C&~ogwX)Q}P.#HeCfCR;&o8dIIf,_]=;1y/S?oYwo6`EO{358!`&#.ld=%=]a4Z<0TdleIs?x|AIz*LX/nS~5n|%<%@NK~RoZN!E0,k","#GLyddH[O!u?{)K0R67YGycsb&dXoVMf)l7^]Vy(k@0`7;#{17?@N2:ZeaQ;&!}[*YgqJ$h/7=o`_|ct,O9+JMq*`^G0*M-lH;N?kceK6bF.'.RQj|p'sb/u?d<T83{!~C44*T8j_bQ<aKs~YF)@X$?X!e3qd[}j:@@{ZM~&_Di<A_ybp#6%'eG!k,vEJ!l1V<Q!6--5>)r|=6-o+CV6q,*:Mk@c@fg.Xu|**<):9YCfvsDd`%dB#C={vp}M#x_g1MGRLBg!P_#yY`hs)6BybDC=b+Qo","#ZlWB>5Hxz3!BuK6CbLJxf{5z0XA~'21su#yiJ&6rrVwd==.?;r,dC+{HT9Ga%FtHP4~A~$jgz0ujgdF^O-&^b$RJ3k[S!B2N<w6<k?|+?KWK(T~EiRjw[4K`_T'+YGl#OCMszY2&(9>DYN8$'-8O$(=q_TY;`cq3z)Zd^p!1yW4k7c#AO+P{+EK}669dV8V7'wL{hR@?=e}Pw^TR=>+#/a}t=S.I,@TYeTzf~DiTW,xFAp:SR]Q[KT*A&W6I<*?Ez^J>s7Y)NTd;7HXl(!57(d?q*4]*","#rL;XYqXANI&J)!%'1rL':YdJ09]9{]2p5%s^*/hWOe[SKG<3H$/K3$x;1^=5x?9xOy#G^paY~by5iN^[2:X./H~5Ko)0-D2W:}GGf1rN/ro#e4iqLh81-vfl9}vy!60w&[n&cm%7Bt=XD0tN]br$]~v!'vK)G[Oe-8bX4L5Ux@03V&,XB8SyxJ:iTXUus,3ZZmszvD%1[ktcJ57W>$YTB]a9r8l[hJrLNLlWe]uvyqKK`[/*C)'bD?HO+|a14boXmyQ;w(?7KQTq}]'RXjf6D/W;J)av.","$0)&DevbA.2iU_Hf<T.@S8$fB5F{7E=~9@W2YV7`(wwq?dn9CSgb]'h0fxC01@Qd$ciZE|{p}jhi9(-74Oj5LxmKH&*cqJ0rtx_i$hxT~Bk?Ko;}8|*TD'PeaW8m~x1>Z[*A<TT9$nv[bGs-iye}wkgeKFCiv>^{:Y1d,G3DAJ^br,gP-F?Dm5EYX>F0u>~%=u,sI&&_OfT5L^pD&T0};eby'RF*SrZJ9*(:R0zeHmU%G2`I47#tMQa5=&0a/i}80d7s9Km]ayB$W'~qHmeaqfV,?e74KeZ","$OGjtpKA`vz*8DE`?zqFcOQIPE%MjL/f#3g~Atw4{^;[^y<bW:%yx+,Xg^9~GNob]y5T#DMPPKX>TlH24Vr%feA{&#V5#5G7#v^6W.sbk7TA7GZ:Y}`Bx%b+dnC!gpP<uUv5>5:]<?bw=>SY&J#F^Aj|3bPh@+(bjRkmGfDP8x;,hN~1wxzewb[([FE-x#jc!VXt8heFHo$P|B=]:6kjni0L7&m1dPx+i4%(#06M=pb/WA&Erw,'h!e@J[Xq8|r*Tk9u[Bx%4nvw&M0q<EhgeJ`p@.rhJ>WV","$uDqXvMZcIaE.=MjGG+Fe`uC;Qawx;(</$Z~c+'.Mn-Squvz0^8lS=I8/.@%)F/a#'#I{;4$gk~S$#h'|Q8]zti,ODR%4#^qDW1ol20Yi*c!M3WI5X9p*hG73g~!g{~_]T9eig6iKXv49*'ybz$`8?~A`WH=MQc+F-{0o($j%*Ws{g$*(0x;=jk,]FF?uo0?7Qu*tfQ%guA~KzNW*BWdS`'S`:Lq9w3Y5#N'(00]rPc&#*#Ihob9-aj.On4owf1*dh[1_IvKWVZ|mEkSI'N'@'ivwHv,}c6gs","%D*?W@yqSA$efWzmSw>gn1Fj=(#LS7GS*Y%ort`HjX8!QMCIPC7s-yI$v(X^U?<3SahO0/Mr.,&&@FK,zJ:k%$Ej4MNhX%eV%!/CeyO=n6Jnku;p!~4^XO6Dy#kRwC,f2PBdE)dbB4[67]^J(UTmQWzB$s9znKZ'dPHK,FR2C)'33'VR)ni'v`0meR:@-I|{1:}6JseLy5)+xVGU3!>#(~OJ#Ms3<QDyA=PR=b%Ltb;G_pBL8(&OH7f>Kbr|j5SQ}[?miKiNc(NU3c-xxAuJD8_y=r4jv4av0k","%xtr[Ak{Qc)N3@AO=sBXYXxu/eL}C#MJ4HMBRdm[QTo<q.O8UX6.}&y4G_~IUw>+|@+^IINa$xAm):8~0m:sZlcdXj4kRECju5%A,6m1+i]*?_0Q28FQ7GhjW?qr$$_=23*xNaxA{JaefIP}<EFhmK5}9!dyVlSPYL(_>r;/d:kTT87C175XHOB2v9ieziK+T}9a_|*yqxl_ri$)T-$hL[<iG8r1+GTrET~E??'Q}9AP'.5T|VQX?am@@*/*/=/;6G~M{6Em7,)^O~`N1j[a.Wa>v[1#XZv!ACV","&YG`yc12FXq;/!(2Ni0S2g7]3rTi@j:'f'{~CMA?s1Bzm!-QJRil]12O#[6DU9FB;R0^';z2<.-zY6z0_FG-/k~+k8LXTH1BoZxa]H=g~k{)I!v[m$tx_bDl!x}%CQW%d}T0?dG)qPE/}pnZ'emI5PBAI);C,8J/v9%L,^VhhpO9z`<tmGcA~6@RtJp79'QD}0{kn4uA/A6/;Vt>2t4f<|Tl[vHZi6DmWxs#[uVC2#R+$XQucI2@'Tt+:<R+#oJyZX)2gE!1qz&Fd;,k*k~U;*~a]SNF{iO(`SL:","'F]Mh)|R$YjxV2gS(qW0A7M;+mE$|+nJ>3&Hw!GoWklM/R3?be#-WS*]ain06nx8K$_oGWf0%hyRBI&ISHsQprL1o*5%gl&d%#M2#p.<}XsYweR4QN?13O7g:z9Fk<2Th-8rh-`}OP)`UtEEN:/{$_mv:V2tde{ef-{eC^ptSx[.D%(F0BgR2V6rb*yy#dcl]o$y4C=6Xr{qU~y?42y`6?M4Q[$6p'&3s&W[71`7Skr$z*^(px'%U2i!1I9[c'MH[uOk;&V3*`o|{~R;ek$!.M+{B[{o{$Z>dNFp6","(A~%DO5`36dR#yi-pKMuwylgz$qE_^Oa[Jl|u?Y$w9;7JmtE?/-_`[?DF4+N^*to.;ibmM&mzPv4qMaY=2J>gv9Rm6Fz7-D-g)aKRU%+m,obrltb,8ggJKPXF{z|Jkc9~d[jib$t%r/Qrbe(ZE];.qxRInvZUZHXMTa)JVMkD*6XgH<;[/i2De$FM<HYC@xT%V)~O^#3Mst,38sr/vSP-5q6<FlzNWv5H1Pby*o,ZIyW`d'`MxD^|Wn@S;)~/a},xb)Q&awBp$4U})I$_ZjC-)1f80M$NNXFOTp3;V",")NILV}J<,fm{|b^8;YRO;gR<ss!5jqrsn#@UM0]$-'nyfW)k~'<4=b~E*Z`OJqSosCq%(m|OTP86],9D7.NSM/<p!1].5a5:*<FTHBMjDw5F/P(6rJ/Bs(4YC/aE&UQg5,Yd50ppq(k}|u3oc@H292+$;5Oz:s*R5K-x3.NVf7Wp3@x&|s4aetR1CV`fD$p7@GA8t.DofQ&gE$2nEhoSRBOZ3Yb(6T>h9)a<{eXzwp|G+o&#@@Cn9}~zaM37cem#VHfm~9=d-=ETx/tD8WwPK^bpHawLj4qxMEGihWF","*pVkZo/M#.*/)2[#L]Nxs4?x?+g~lg>t(,QCorU*5?X.xx;H4&>!^*0L(jH;=G8j68fJlO(8[j~aX6+<3.n}7VqL@fKJzUk2$DQC&^nt8nnd!9G!!r?%o{!AEv;khKZA|cAU`7D]cJZ&YU*+FfNQ(``Pl9@yzL~V3oruo+^OW%^/<@k1r4<Eh`HjF-bOCTa0x(O0!b`-sG=wDh>0h?:{(R-v&I*R.)>k@bh9E>rE&,h$@9UYGp?)ODDjKO}7c^fIS`4|Y$Y,,^BLe8,S;pYSVyr=Og@99BUlwCS)'tIN",",MrIu=y|@T@4m8@D8NOc8u(Dp/-6!wv*[h+0;c8^Z~mhI&z@|kMz5|*BYZ>'R)e/`K9~V!^Yd1B3i|Y1W@zk4t,g2%(l%saq/[MVm6W<0e5gA]9`yM-DMV8ltN9>I*EPA!D74d<8m4HV8_zW:Ja1&0j5.F0^m3xpGOe$j%CzdqP7OJp8dvQXk)gHk844)%39j]Ot*(`~,dHM/vaKncl}Hpjb.OE97K>~LZ#bRctV.&vTph3C`!#^&dL<CD3,W~;di.{to4GK&6(y5[Qjel1c,^]z@(u4h&9rbl|l7]q4J",".Jh9Ass+DhP1QglLwRGGb-v<;~$Qu|rTdkAPzK:irmPo<*@OFn{0FrKgfy9AKT0rn~>1wQJhQcs[gWq4|5mpf#;Y!!H5W#c:4j(6b4&+,#@S'bJ']3~@K:X*t]8@%Pd`X,Bhtfz18Fh=D-p6l.ztytR^IDMaF+CV;H@`Bv()F28P%*#E`A.kt@vIRxjShM~mQPg%nnoqntwMG*%u~tTV`+w%>|~E531wu;|NU0dOl#ca02dS;&GQSqA7g!}svMShs2II[R1({&xh6&jTHj*k`i?umv#:G1G!)VeBPZely*","0m{0=9xG{1;gcav>r,nGX!EpCAE&['`r}kS.KsX4^k)8/?fFsc1S#j3+47@nU%VZWvI'nuQiA0Tg>d>1)thz9KzX+4St1Y%~iO,k@)4BV.'?Yow4%N0CJOET7}.67=u0)f.!fQn1xX]v<GMK`R.kkpF()X!'9Ewc0<LV)hZ[~kOL+~L,:##`I#DDaDe}S_V}h`~?B=nvp=p!:#,DOrb~bz;3kNp[VoK@(R3D2em%;Lh]v!fBcMAE:GHgsO/YVx+$u9_(d5FJ_..|{{nmUddgc:wN^hV&},%soS)q)UZ)~c2","3aiJwY#i8!s~LY^iANizu>l/(ywHss!5,$-SHqvf=qplq/<=jLNo#}n|K#Et=|1%)<FKTe^kF4{n:`,A||W}~o!]A3T,&I@22[S_<03'yBvn<+O,=?23AK`N3]vcQ-60oaXrGn|>d^mPKQ_}wX*j+URop.2MSN'Y!#z.<k_QM|%'4dyphF8;E,^=[x339'+p|fO%829M,y_F2,^0z#|As3mvPa(5?/v9S<h&D53BVJ:teEu1u>'OYDLARTe+{vVPmYfL384tJEu~w`5</G+i`T]fw:%c+:=ymU-7jSiq*[L{","70HKkgU6by5:4,f0$nNy8E$r23AnV6/<]}dn,VzcSGf?|?ONMnvBQ,!~[;D^EQgGYAF1v&H*#I<6beWy>wv4GGKQPN7cha2hQGJ@'hQy>r7-CgRzW[-6$L~:Fz;I$@U@@B9F:3{8]ca+kMS<ft[|:4aC|RZ$[-n{VGAgt2U[!0F#ITV]2gC)yd8+Cze]'fpC[5Es`#7TBQ-;DjFpk/wGR.g,(KkRbJs.O~t`|Y2vYSV'B92rV%)*EM/Jqc:TMLf#|5}xGEIxt^[i1m#_5C3:8]ARRB*RO<f^,#1p>U1G/3kEN",";DYEl74o.`>HRyei'%@nN**1v>TF4sy4C&!*_dExh)InVEA/X#IwkA^I;2LV-H7uG+zMGBL:evALtpXUFjr]ERH^s4r2E.L#u;0Wy}fU1w5!d3CSQlW_:w$D@7Qnw*+&'-8)O]*686W:^VWT=6+e1swK?WBT6>Ri6(t,'K3CF1v7j'*2l;I>iO]3xsz9I$6h'7mLAt;'Lx%k<]vwrHe^>K[e{X/[D|&/hJv<@9U)_su0X/@LCa<!E%%l$y+-/zQe}96HY;FO6}EIW2.'R^QZ;BjmGg$qL+:cNYq1`,NL7@sWS6","@Q'tc*;Qjz_B3Km=ytWn*?~&uU(b6sqVTxG5vfUj(v{yk_KAgEyA2^Fz,vq@)GoP|4$*PIkWCco:)*%w-dwc6;>6Jl~EnX4W8^#RP{BhY^S%.{nB1XXEH>luf|-EKBr0<MEk8a7e1]Z9kwDj<*2en#B[]*xytPY}-0T{)R6k7WJZ7BC[~Ua%{A1p3l(T~/Y!GU%gK;dALctQWdWfM[x*7/,J0bCQU%E4d<u.n`aTkfV{BX.yt,?H/K=.N-&^!MbqI7|s8Rgtl&avC#=RM7R4o+xg61b{]eQL>3#t9]^cQ~5[y=N","FjEO)NcQ':odiWn%!tv>9GQu.#'R_a^~M<g-jr'!Nh:x?RK:,5VUjxR%Nuwyom%@`@GdK0b&tK-3Tc02EwhY^.xL^E/1L%R$J$t_5HQ!%O5IL2c>is;s>g2Q[j*EBE%Y4JOQ}gu5#Uus:2_ucV)b'VMzEfb@m6yMh';sdnmw|(`OCoX0,P.6q}H+Cu(Pr83+]}P57KkQkr_@u}$MeVx1/,|mI/fR{JxwoW&;t;>%H]Z{NLN1_1PG*PCYh(R$h;h5((7G<O)y6bY16}rGCKXc>=Q;Ew'};N#Y4K,K)ovVD1eK]D0{","NI|+b5qq)8+i%{`}w9)gVe;b:vFpFvC!R{:YWF2}%AO^HZYyu?H#DUs<Phi&6}gXAii4ScA!f6F0@8o^i#LwjXppE.8>PH_uuGlOZ/AmMd}1`5?%gyMu/7v^@+p}}H-k.pQ3&aYhWK(mCRc.wT3DUSY4o5U:xn4%%t]qIx=m<DCdq=T>fhnlmvOsuBR^7Pek(N_}q?P;8psZ0YOP_tQ45U;8xY5DshCB>h^O0U@.fj=A8e.!?PYxfrrHNSzuz%(}OfYX^#-_6hgoE9ZlUUSK^I`'NG&cO<)HQ[V_sG!<,ze42x2Tk","Wn;hhdbNk$Q1_F>,uspUK]Jgj4?+3#*=@MALQe>}9}Akzyy3{-LsA_u>3<+@`o3za(m1&`R1F}3G}G1]Mm::}B$ic^a786vkFqnIx(BALaBtsbnV3~H?T8*3wx-&7vL/p})'Z!JFkD%1f/C45k+!#fDN+J]wBgsZ3)ZXd%u:+Gl?[qAscDM@*Z_02_,5vQ&lqd4++kTUG_w$=yJp6b$I!C+}FY6W,nC-g=F3m9iJ+%4vE^(MBb74pVH>^v|q~DNh75$+dpjj$6=dn0`fP&'JEdvX!?MG;8?G@DklL?YAF66y};1~Yo","dAJE`{`}K1?XHQu(<M![{<JT{2|Y:^XnB%-S8siWn8l=2=i(+;y#tsQ;i{1aivYa_sF4S.TGIW-z<:ejuq/Y/CIS5^ab$#U#-WaJY~*4kns`(')qly5k7_Lq8)|yh?wo6tdaNeP~Eh:,3Vzh.ZEzC'5ZP7iOF7].?[sSGGJ?)dxe8#va|_oO7Z.WU)<|0Su^E+BR~A-@v-]bO9Q5Zu}uzp0pf=u<8;,*G)X^^QrMU`}JicO3zjmoD{}C_bW1`B,8Tg@c3rB,0<AyWC$vGp<c71LL~[=Y4^8EGU>KwN_BJ9daQPT]<]*","rR7L:j%d+=T'h4Gd|@!50[T-'}&}bR9~tAv@#n.5ii[VPklF3X3`zciq8s,OPo^47RKoy6p[hx+3}sZ8wX]X55oyco<FdY}tQ't.F856QpPDHT_9A7w^9p;V)G@gY{WRs,2*aLRiy,:4la<aj$`BRWoO;4b<pq)ZRmB.MEgg*LU:u,:M*&q:j!pv05s{F>S|PWhv%!d}(}JPv);=f~~VfphYi`jx9pl}L)Vv{Rk!:KY1!dL0^K:T&YxO?$+NEV)uF#$WF-o`j~5dE7SD>84|J_SLE3f%gl?~_ab`<F2e*Ul:.a/uCR^.","#'#bcttIXwNOCYvebn%,eEh<;z)Jfh|*?An34=Sgh,4MW+.RVR1EZsmn)%r(YVm{F|tJSm@R=)LGyU:rv/o+Zu.b$,1y0.[Q~gegZ8,!F<0u4;1Qvj2%a'+|ekW6:2VmTYdLmf-*9]0hJu[>Zw3e0lRo!VaS|xc7+sf;_-iu?T_3F|Md<vdz&{XT<Vqx,L<4Xz,SD7I53T)%Pgr@cnMi')M?z375R0zY1:bC(x[&1f(r=?_S&K[MXh'n/0X,^!Kwl-`*g_qB$S,.&xU9w<-&d=Yxt0%l@8Q!=AA/z:._TFZ,hkz05a,V0Z","#<^D^4{x^T^C5@-PX,Yu.j&li0CV!j~GTv!e}qYS1>o1M^zEb61WMz+R_W=fkfKM`1w1%EEO?1XrFjkTMy=7[n5*.[U^4fC@^9(gJ4r]u[`RJpEt4ASsffb4aj@widV[?QmK#bRqq%`]0Yxmk`*PiH%-iP1i[0S(L7X?by=+.2=eG)t/V=Q%J[@f;.R_P_6gInvI6E3;[+?3,t.(hRj>qv?Ug|x/;7X@$T]ieJ#)0u0P#gx05$RK1hg7-$UY>,qHxGP(PG&tiS9U4H;J0#2M9BYM/$MaJ??t)*<R{ym)LpxpcKv|Y^?okGV","#WJWtI6}Wq-(/mr'|F{`&n=T5h*>a6WTZs!G7#aA886&e=X:kY/KhZ27xL{mru1}AXJU.C8aouNq(w%agHvf7pAuc0u]8R}u|AMgb=aj>VF!uUcoC{.gen&gRSZe5Xceh}8yK%bkk1wD)AV7#LWwdFJ9YE=n6G{*<*gSI(7oAO7L+[H`@|70VnQY4`BJghU#[PSR_`k3L^IY!x{Q@xvw1j$o@DrUTGNb-b&H#6o7NgTo<OM[C6M*52~+M956c;Z5JQP7Rn4FBOld9C*$?0993q_H+)Dn3<dF>4u_OeawY8UahPqWfdz;m<_s","#ydhx<~teMT^HfbhdZ1Z/-'&m;,z}g^f4F:[TVJ<(Q+1#ZNo/AAJ$.1joxfnBnU`^FQgcOs($}Bx{Ag}TqZ|Efc4.!@+_ai#1VDxx(XvJ~MrG#|gCJ>.C?P>N])'ErM6VXQM3tq*6MS?W<E~wf)dG~.{~!08bh)|#H2.5<z+x/tb7zY,})>(OyA0_QW)G%%Xs?qZ<3!)jHbP]r>]Cgji0$AL(<Ppd%d[WkNHnK$b.m=B#}=/!PH0%!4J?2DslW`+r4D07f:NP3KZLhs7Du>}'2IX6'1&XN,vu@+45NcceaJUi'qf=vJVlj5ak","$F-HX0{O|O-.kWtew81jMy}n!gTaOyt~+(QY8ozkejbIL}xwuNn@ba$ATywmHdowcyme4+TS]#NdP.HkrKI$0R%Ng1cQA9Vx+3Zx)u#Ebz4deV]6AoL}'XOtGIY|2G&Kc/78?nx>-.+<HOKF3IX.9H_Fl[eX^}$64fsV:nVJO@Zz4aW(RTv'xr=S`J*ty$#:v`kVjzhX5iTV$_Su:gAqT'@UD3ST6$qk+{dvO=qKZZszBxT[@rT}G~>]q7J~i'l('HR/l9IJ'|`}xC-rT}Ew@=G8xc}j38|ub~uB(CC:r/JgRRAYrv/,f!oP`V","$zj+$BCM2*jrT1QABrlNnsWcw0(:X0q{FcuZC,)nE?HoZ(F0oeglKpE]d>L*pr940_)XZ]NVJm|fy&;dwliS9gyrn'{sP~rb'W],Cj]avBk;m]b'5n:hzb)qc_-Eb-oXBxN7om`q)&cwzHWI;hBARGY*$ZBd{`/HK)mnp!%T{Q->}%5P:31#D.Y'`_yPBQ_Q~Vh4WsU:'1lJ>_1j'jYJYtcu;v;XvVV`F3@/W#V0>7f^{i}is060!=XKcHBw@Pa$?H$~Mk0`o`/pwqNI_S2|kfKZFQ'+j}@e`muR]BY@|F|$`h.o[EP&sK,Xw(:","%_@s,]8CF?@+HToQ#1<VF+vwodQ7))kiSYr=h_qRk/tjw^KWg`$'S~)*~>p@^{D8mM3mF^>&$m49&=Y>X;oo1JLSBBIh-.j*)[[no9T+`bB'A_*%o8DLo`I*($-}TP[8^[gsz:finLeKqa*~.W.WQM:>V8Su5)GC|K8zYf-16{C8Gntunf(o4fmO]'0NKm0;%7[psxeOjWUb[4F.[%N,%OPqOO7Jn3%P<ZbP80)$2ce5(X{cj?2D(?u@rn=`S.,4M#<QNp$ow9cnSMr4WeU+@.UrjLW`S-/M~=k'm'S9<<oWquZ/]x$>Bt.fUa'6","&S68xnqL?jt=nJHgis&*ZgPca&w;XG]}|rH3zR$KtnF&sgG[-dMo2,0)m}PMF`FyX'Cqij<p].>jzz13>c;8}U-(f$w1Y~mO90D3@C8pS(lVZ-PA%6!!:Piwp#Y}2B{F^I>q;h0KXWe:H][9w{tbS8)@YZ[ki:K-QT4,UpvFT;$nO+DIa7_,ZM1k]*%>zr#uZaXaa1p^%D^29G=O(35^RsquX]|{N&`|~4B3l`7$F@/b,Tr*KGA2#tk/*2>pZDUPu}|6~Bqgh@%;F7L}q,p(sgoZUtr.._Iy60os!vB6ptfGNBpoDDut}STrX_chV","']jMB)IG2`RJzjN+$NI8*7iv6/7_1#;Q/9el)br5T.[L+)R{Gk'[,)G7R*hgKgsOOhZrdX'tMRUFqOfP#cM_!-bykP'*Ex;quu,{Taa&$Q[LfC22Kw4XxG*HVe>Llt=J!urpJGh&M1w$14ZX+mVYL@KKiFkF?TFi#m2n:O{K*Ai7[<y}/nT.c%Yv$ZbZre'Dr{.`M[b]HRtI.@B^k]f4$;x{md%`<%};gk4^!7!zxyJ@m`D1gPhDWxL=3ji#qAu2ByJ?K^Um+D=7(,P)Pc,:cr@Gxo,c7AjV0fjh5r?C3xyc,~z%iy>?3up/ar0elF",")$VR<ms!>RSTSH({sVrL)NYtc)j22yPkLZFnEcbZoi`66rE7L@>U19Mq@^fpPM*(gMh!%r$]DJwup.hT32JOP@C|0U#~n|eY:W|%vi4qc'O&N1]~<4>3)h'P-/=_%xZu7O{}&5ufpsW|n1HQ([%}&$#ha',`SOr?KG%fbmqW907>u;rx1zNgeJ;H4bykK8`=)o9jOQkD>&;k{xwc]9N$Ye.J4]s},W$>x77u0iHO#1F@GR|nB3hb3nyuCTW>|g~SPoA{}}~]U2~CCBpH036T4~p@2H$dH~}psxi{CrDTrt)W4zMPQ9^as>I6z>j2JUN","*jfa7K){O/#?SLj[J~pmY;!j8fD0nT;zRvNRuMH(/j`RH%vNq'Ummtuv/x*DRV7|vd%nmM8b-XQgg?Gr2j[r?[17#v]5l$NvkCgObi.NU%XpB]e!F,9j23+hcxbxd^Ck`Z;(P(,KHQPHsD&EZ`wu[sJ[[l!#}Q#~JFI#Pk=-`t,]4-XJe.}:N^M51]j#`cQ-Cs,W'U/F*T1(IaGGgQ`/Vghcw)+(.942(l~zuDRh77K>/Au;Zl}Z{}Ov]>Ki!X)}{);;UL0&!Wn/pdc|:bH._y4N&r]>XJmJcyFP*E$^`^2zw'MHxY~;jm~K?v1%;}uJ",",~Io6vl2IE6IH$kby-Vdt{<`_EPm]NJ*O;bRJI7@iJ7q8gkMv'dNoZ;_aeYl}|1XWfb*+1^Yw)H]E%s:is-)BLq:K1t>a!orjZyEs5P.=XsmGct8axD.t?kDtAh!=g2*N-P@QoBYdu:B1w|;?kEvTNqx2&VU_Y3x**[I+Xkef4x%t3%SV]0>-Krtuv}&AR5*-fIt9RIXAA&?%9EIG{wu6<{6t=4lu&qK^q%m-&<:n,&GaaYNa-n4DD.,5`Kh$LezK'wt>`'6}?A*DSB?82Ni)>>}[O@3ml7Z`O0O'3w`cbI#EirlQ5A8H)&IeJCd^7`X*","/lKkVWzvSP/wNNLi(xHY@aFVHXq~X:$=uYP!>vdYy%=-a7FjV&(WW/}{_Rzu/$_qh*m5sR9MW!ghoUy-/=+Qd1zR`S=/f&PCVO?GGH]f$'fz2Wk[tEt79JduH&l%#ll8iFxE{=.S*~Jt;sa?eMYPl2'Wu_5>X@hi8~5{mW<2F&}-S/+w5d@ZC>/0G0|15n)Fl~CAi3>KbgXLy+A;N5<two1jtd8/Kk/NjtskL:~ts7ZmKYzopbX[R3)EctA1PVx,>)F!YBv#W)nfl$,+^Ip<is2l'88y>s.['uD}6yriZ-Kv02qT@sRJ!8!)K,$6/Yijc2","3C!Q^8llMl?e1E^^3y2,g|x~K#X-yP?'w&6n-OZy{=)v;jnYJI1jQ2BXT|)hXAg<~P4,z%<ep(38]6n;J?!))Y*Rn>QP/M~,#%4u(|/et.8?*mHRZF>G)&AmjFtqcq&Mxm:?Kr*bS+g%QsWzaGu$@S~0Sp<,j)&Y|N[}QTO`h/<LeMd51ztXnzhr.X[c1:+e(uT@UTl@Q%!iihiZOZ4vXG-|XYFbD!``i_nB9?+xmZ~wO$A[=gkE>7-2>LPg(E6*5vfm5W#hY?;E7SYXg%cKx8KVmfUNBz]MJ<}bi;I]*A|'=Z?:9y6qUIqHxWfZ9Bq~?,{","7tfhFhN+In9@4y;uJX.Vz.^Y|HDc>_q1[n)N3v%FY(,Q66SPEOE'eN|8I%7{/%IaIVTX$Oe*IJ=i5}t01MK<7P_&VJ#!^~.h[QzE:X7.-ZMI([[*B7LUwNk=c$FLC|{Azoik.g;:nIv![_;#``chZNlWcVR:>y[)]N.p$[1%=X'WPd}aD~l:$N)Q1qz%;'dfKz-Z^-Ca0}6J9x/per{@X/lf/WCi_f,$w587~5u#Fg|8CVz;urpg0~Sp{!DPOppRLAj~~J+4:le?oVyif~fK]hm/oywcNih>7sO2q7@YEy,[[O2'sB]JdMT&:F9|+gJp/y~N","=`*2pE~jAfzi:;'$9!8`/c|=v8Y`+p2k.Ic[T#D<zEcXyUVIq;%A;P?R^vi~x~=@)|;Wc`|^g@B#F67,+-|L[8MrUv#'k[w4^q'SF%%.'|e<8exT7}~#/$e)64<F3f>ol8Bb4((gt{4zGX$rx;w[|oCM+VgzPbr5;31s(07,}e6z>`*2iqtjRnQjIvTjTr}74zZ$Jtcg1hX~7Nn`*]SV:*V_'b'PNpS{f<iXQ$:ky]rj[L`y>a$B+oq+h$Y%$Fq{<4JUzd:=ktj]]Dg/v>Z;jwL5-SN.rD><`v8Nu}0Q>a@H=@.IGd,gjQGqAxrzyA|+uLgO6","E&(aY$GfJIc;YVnE'4Yx1sTq[q$oJ[Z9P?X:I:,HWDQNR^&JBhRe6O~@Glt]?f`G[yG]{2qWTQy,lcAQ+,Dw:cdS_&c?X`DolV!!GDQ;QxY[mt}yqy+b/{4F;c0$@aiN*#x<fMsfq&uo'!b]eKt^.~vhT9(1EFeSWW-PtCL5.=.DxV/@|Rds7bQafBvVjqDX4~2'Enj#pl$J-WNF8;P-WSl_(_I,zf`Tm'yhThTy*v7;eg:mfU$=-RK/<m]ZD!=-o]FXk|b1qB)KO&;lMt0zi~gO^TZ~'$B2`j%97sWBVPjR@l>Ng~|`^W!59#vzxibkG[+i~N","NOYA]|Zy%[E9w*'SQD[e9bd[R8dKhs'YlZQ,boXf^lnx(>$[]SW`f9i9Mt>N?QqI8m4byK0NHF<j/K*AUc;uXBX$~{9C;L)<hjg#{.haglq{'mX*J[_T>Dts5x8TRU!Kr2kpsy<meuZJ<Y]YIbU7&baz)l*bPw!G9TYO5hoN(>MO~/6UCpF?S,&VZCG$]R#Vj7TTfUMga<@aXC[<G<gp;?+4TZi`:eD1VJ_ixO,~fW1W0+{A$Ta~(C?tcLS-<H^_b-iZ.1QP@0g#H;BAUX4aI@%eWRgKYmXeL09X)&Rjj}%.=%HYWz$#5~8a:OGd(]zXxD|mz${","Z[W;%Mkpe%k,g39A;OP<:V1ax}G?lf*5A0=G!gRXEE'0xBL#/+$i#`t:$2%Pn7p9s+z>>(TT}t(s+*<BBE@ZA>g:@)C812ZwHdr}(ZAb+7/HVI0E#bDK540?k<cUKEj/07puI&mY@XhY:p7|2)jNG1>adFmtRD_&45m(ogqz#42}4iW5=g!9:AgSLTdG$P0;3rSAFZD%s[N_*ZgU=m|calSAJ$wRm-opooIU-%]S,Cj@Jl04@oQn83fn'YtEIm)(-Ap#oMZ6{?Z#:t$YbUz{wcqyCMuMCO^cTR`C-R:}:'WdNp-RA1r~'ax#VMzM1Q=Qgj#.W,}k","k6|k`H$MH32,G?mD+3X4kl_qi|a-+o3:&Xs.:,h#_^w1WjhF`ylHS1x-ZJY.}@['v7~Q#VJWm6Y-G~TLe&fcxP3NIgn*BU7{4TbOz#[Sj'cVy5p/K*N@H?-K%@r/9sF6bR`BZcOF=yX?a#d(UH}Kw*x!Ds-sDk6~A?rEwWiCSF#EBrKwE]B!VCeHS[<LJv*p+Z<]%N`G-!!&-1E[Zx.':/43=0k8ms<?cg?'2j+30+ytbKVC|-Hz3.5,4A]4rbvkVwCrxYh2M}:+Cx4rE)M{AXX}`=kHZr8'zdiIy<mt9uhFIeQ/X'jy?]`)dV{FXz!bkP3vpg#bo","#!A7RqIK|K%Ji3sYP[kUMnn1I<'jh},;8<sW(Oxvbs|5QA>+hKp$52:AOH/tqA}@[rLcEH<1qP[R}3-kHS*.ALL0n)!^L<$nuPuD2?m#5n2wYZfjyYPR$@'gePjn#3SD`^{Ywjmb.IRaf6o}*U~nT0$t+e,T:yS0i]qG0OBz(k(dW]U7`IwofxFUvv,9SU9](VL>x|QCc>jWM^?le3C,.YOb]t}AFuFCntN3g}/7v%1wb?~Cdnr3!F'|%v?A|+h%i;I+f7Fz~EH#$Y#ykMTKfnsGk$%`d-/]++jURI*e<))dyckGC}SuEyF]4wjqtZ&N>Nd$3hO|(]*","#<?J53IY~r2]](I`bq|1pA3rS<Nd@H@c(:M-k]>{xe^Mo[uIgh?4BDd_>7G?$u^aqLTBvr~YVn.JXc>>uO]OyAbk;_*KzSfsg7KQ:_8r6uOvOy#bW.16,&[wN|>s9r'sry%20S6D8yj#Mt!8#Y40?K;<rW.N,AMgxt-j(eB^{=@_z9[o8l&|5rq/Hm|iB(r52~lAA[RAeaq9x)]d^vP1^l}p%#p7Ohf)Vy{#>!Jjqr]Cm>+?3bnO+BEESMj';S)>DyTz{JdR!zc[$oLQ([MrH0[i:!<n@s(^#$#g,(@d>OPQ7`7@riNWzvSPs0uaA<ws_4z|QTU4+]E.","#^zp}Y3dmNyNFYdW}N#O'impD9tcs[w,NvSkyDh*OOjDlx3XUF`5JHeJlP/u%i<I*4,XlN0$7QR-M*5kDrZphsk*GLQm_Y<a.Q*NzqR+?A-WEq_'z`55s@wiN%%kXC*l+rfK}K;v[]Rat>;4uzN'>3xqJ.Cv}P4e$%8CTqvyLLdF4}K)498fmgp/NAmvfiZSaKvh'j#8x&IU#K[^hQ7a`,++yDQr7XKPl9?^ksbs>nKI0O|_]mLuA`I{G7e7^%fKPRw,|fUtfun[,Npy$ET&@FQgtt,ZvAZ9ulk*ALI~LU;Dva7E;H|/Zy;).-{vFoWX%v*0V,=zoO]XZ","$-XZIbQk5EX%|'=^06g-UWQQ,UrX(%21VJ2uZM7p*CV~c*I-mN<&'{7-$:^$xzq4,mE</IY-)H9SqF}GnVo<BhW8J81?Ld9Ztx~T_5nb7TuR6lT=S@TZ[VAa#D..hRD{HP,>Hr?wi`MTyx$>D|h?Jh2_xy,p7)c/~o:h.Gr)@(Y$1X?QGa1_-i-*#HRCk5v.T)oKa?uN-Q<$UXQu`Cmhh9[=+'P|3(a2*V;9l;9JB.{,![IPR4HP^[tBOO7$oqiO)d2%XTFIX5}RxZDOaOj3qOB~1iklMo_:#)?]ENgYwb(9g'W,d!y<*8y{XWshGQsLQJg$R&hhn^OJ7V","$g@e{!IdK@kp}qbO6V(i!)ry:O]p~*^dI8[#2]kuwDX8fhf?w6U9n1FH:P(NO/$po<PAuvQ-r|=kkYmSn4FS^<?lc:iZ-N[9.H*bj6X{G'xo>S6Tdn,`H4n!.7W6E3%EohZEI2Spv.25LF74-.Iq/W(]'G)pe&~,Z-b'@rh%J@1%jgj'S$i#p.c!(0!/(qhH(Z|B,QMH8oEb7R9![B~ZT7FOyw4]-RBXhS/I-G]uv(qvo(4q}|nme#}lg{u(ZsLi2vm$Lz-Ie5_:lFcKehJpPJE,0!y^-SU8mrsdz&ej(H^81W*Q7ngFT>`sh03D-T%|NXlM43c|e_.I.Vs","%T:di!5|Uw.6QR[h,i>_D^:<5)e9PM_}5sPW>;INAI]-YY1f(QhgBS_!H-`KIfHC29G}bt*!)x,>{%$-$a[btyf8!YRzQ?ud6mRAJ(=yXs=c#9c411vOp(=z$J~'7mcF^[mR*ri9w~P4?xfk&+dhO>asDcb'Y%<>;%O34v*l4Jo75aAP=d)*J0_LOZOpwIPsc}6'%)PnN(-9XR@/,zMkIT-,m;.J8z~D$%tMOXjIhQhEkXa.mRJacYEG&u:r7Z+Mj[|Ov-#_bTb,!VrCtL6nJid.dR/4)jV|]1jE6!QDXH03|ts.6(x2|(@%(R}yin)i_yOHI]5G)_]>yN4k","&Xn$=~2(Ld<BhF'FQ//G#m$z'y!&^3@W14O-CNYoMA|hjaIl%y^.,LJ=cZ,Q.qsUl?D?{|w#pZ:|z+4ybgD_w9o3+|]>?RX1(7&TaJ1}Yc#SzC_T+a|?JIgt4I]K,wz!&}!]oN29FwV/Q5cB^_!/)Yr+%duKZr@,lNv%yzRSApr5&_D]xUX+y3hO5UvUue=}D<u9PH:MD,|xilIHiCrT@^we:rzr~jrYyc`CC<$],KQ~|Z|H:c@t`b/x?0>i22O+_5W*olB!e[1{egP3%$Si5oB-/0D1lXhe5m:L+uXF:o;@$8MfG7UP=[c{8TB>N:wtXTqb*['vrM(<7+C|V","'|0p]1w;Ulg{*[aHODXhz3pP*(h*F'p@nwvO/j]<1'7)>cXK%1-amh<Ulc=kg3eg,p`g]T[~w8Uh#by{yGJ.d1P+>?0'0Ty7MpQTTy*oVk0}M71P93-hfLzz&uRZ22b{F7&BK*C|qag]tUaiEE4mPr5&5A}Nzc_p9SKSFvXGwxV>&rwSj1G3wL)v:&=mHkaFyyO0n&fMRUwSMMl(U^92ngs8/b%fpj!padysC?/w{W7Wt^Ki&q{(&r:TE((Mt0t#BPa%@V<8n*0'JN$v[(YGMF2X3WlC{+K9Y+)_mH,p-#Gz^5^JYN^x`<01lt9x@50?{e?hI))K*mlul*/0a:",")iq}8qDHN>vwf)K(,P@!Js,5^kt**9k|IBPd^)5;}lk&}'?JD=OU1S%+9a!f*S0}jWg0ol+f%^BYl*t#+5^iK'oK:Abh9HXNt3tf`HK<EaA$2C>k4fgQphn]RO6WQ5^gReq=BVYmVAo>4jPL`.Yc](0rp&Kr#RT0CAPBF^59B7Z%&i{t|#'}&Y>.1qDYoNXLyPCHWwT'RuEe2TR*C&70-{}=`}KGo'y_c%g[2dLD]{8(c38A2Dfe|3=2ZU3T&njF0iy']Va{itp5)QPF|?pT=xii`KCH/byzw^5#BDv(jPR)~``7y1Y1FNDzo5C%{CT.TVMTdi|`d(~dr2Q#U;6",",.[pR2,1ELu;PQDOMsIk5]HT*/J/TOePoDBLpx$Ck_`~dU1$+h9tL2,Jow%cpnP.J*$!'},~M_3-H,2OT5qO}|kuyMEW&$1oX~SD5Ah/l(T[*N51F=Z4+?^R~}Y`M*{,fhu]XF:1ZN;2Kd&@(kfRtkNctc^.{e6zin&V|+20BU5-D-=f<z1J^O=[kx0CXVtv!W4^#3~QLrz@$qay2-teJ0Y0uLg]=+cP}AJAJ/S-sv&P@|@I2&43cDME^D2@r~SedB<vbCT$D-*%OTq-^<BfMMpV^60L[.Pbpcq[d(1wiJB{_u1+/RvojM]4_@=8#ZZut~$qHi?2_?PfGbEG,>7V","/9K>Ec@rcr:B-Sm5n1Az~*q[-*qgG`I1>si8BQvvCWQ8m%uR!QF~V<^K^'(:nH*@JAn^e0L[f6_Jz#2^n{,:>Us3m)yoq1^|tw}FwJl+xl>ZW{tK4GQ?YDQ&h5ea_PJ2Dof+wUu5Eqy[biJx<no.Ccs`%v.FZ)IRT$Bc.?k0V3V6'N2LWx.373MzR,gM+*!QoJat;9zxhb&k;PCcL2uWTeDx/B.yOk/jk]WhjQ5SH=`<aZ?MI8`?1_;nq;w=trV$LIY+t^)+g0g8wSywcURnAzp%v7.B$FAWk)BThW?F2#RkeFemBSaD<)}B@I7@md6+6_:b;64JysKK:X!tl0B#F","3D#pRZ:<>Fu'e!*Z`-nVw^Aukh[q{b;#>RtG|I7Y'gvIK_F`+}XQZ7$H5]Va$^Z#EMFxsljfj~i)@!~xXbHAEubsD>1|1Forb60Y7JLT8VeUr%})?HF9h`~J@B7h#UW+>nO[eep;l9!pFr(f}HV{>J{VPsCU9Yfe&UmqvtAVY9G9czio`H:w#~![#V~do]JsVjTUhB3`wyRRmV~('T<#Da`xQ)<{*BTw]%[cWWjD/-Ka?~m{<<I]Qf4P'Hbr1bm[;3jX`KVvbE'Z|^4S,J(*aV&.:;Zn/M*9u_$?hvX$)bvY(2[S34J-eh&`>y@wd}*kHn*Qr6.[7nL}Af=y7O,^bN","8mhZV4J-XR1/{ftDN4Lf3+K^RT(3(`].gu>*#/0Na2]t:y|+h`GQkxzC~:W6R!QLU<;]sL3zcoW1UJCTohnl4%7MfGB{?'dQL/+lp]ik$_DMGB[jIm}w4Oi1;m-Y}yQ&CXA~)_wi5z]=ah$,*|Txv]~!4H!w_&E-ot>CP35@Q,3(|[qvmH`;Ik>;*./hCdXNwQv%,hLefb$;p/yTV3^^<8y]jqkI)}<:x89C*bMVtZ5x-D,^nlm`KcS3B/0U;<8!~vC<9]]2_FPgGVA4_17.IrfTF:Y<6$xi*.`|9iY]/LD<Y93|@0WNTy7'<^zf2JS~1&;]WVHo(y$2smPH1qw)5XJ","@$O1/kxR&oD8CG+78WST0DRU6BQ<+-#KL>6@ZV(_zIKNb0p+r^xbvDe+^w^7SG2gG+cKRx$zGChJ%;Z!*6J5$(Ra#=1$k2UgM.@C*M1Md+W:pt_XFA(s:S<_hrmK]J*gmn#<@hSLNzgRR!:aYb{Ww/uC+$%/<KCVVcWns,IV)w8har|%MJPX^=n|O-f|Y0j_TPqgJsEb|6A0vW^C)/DWDTe|}w(sO_@'Lw:uq9z}=jiR))*O:o>gOK-&cA4bP^F[DE%Vb]^)sp'm,2p22+ZCO!:[$Yvfm8W$c+z^sB'N8V+/lfg0zX{d;Ib3nmj{Hyzy/UF$BnupwH^s[,_<S|B;KG8*","IZ/d/</NOmb$x;tc%HR|tpLqxU=N6?~.^QnLvw7J1>xZ|[W<@_!@:9`/r;3wX*&`TI08tZ7~@o/F;1aBwY2<<9fqifXM@%I_B|{>0L,%=rj^J#[>U,c:=7>o6`?hFw5p*M#|FuP{IdA,:oc=PzodU/z~w}B+J;wy(C87zk?ddV3@vq.wSV*X+cV*Qnfys5O8,FL+Ugi&;Ay'8I(#6heftIO'dj:4|kVnZEn6eB78La~?VW=LRdq[=kxESa?_iO:wp9<aBL5AQ~:wSs'#a$9{pp@oq3D<=-P~YxdV=^{|@4`]Ct5AheXrkJN0f&x(0$.7|Cz__K$(p^{X^l@RL)hx?kQc2","VCi;F4*}!9i#Q!z2tZh4n+Q'B3EY3@USxf0JGXJhSm4]B=Kb-r+k:'BUy`Hahl=GP'U`L**~A)iNqvvcl*rcwHL~l3Nv#S+_Z#XLA)l/a!6KYunvcAGO.^`Fut.Yx`2E$s5g?C)v$JVvr/GFC`mpOmx#3!}57zp1I6AJ[1%WOogI)P~13_n)<UKdXcnoFn'Rd8&=j4=I5a3nvoN9LoVI3vE:UyLcP(hWWJ+sk/MiLL1Zbt]:V=P1<deL}A.fM}alkcg)t!o%qJylt7+0-&I?zq1TMXu0{,EzK5)j'Y,<hsa'vt=#a>*e6^/6Liq}6+@%'#K&sGowCWu66#Z,^ws)S?ZZi{","hE?Mdq,e!+FZ^FOEnx54'3Ok;<!(u%QH~QV^q!5t4>{{]wd#.gYc|9ZQ0(JF6Kwi_tQl5sn^)xd@XNv#Ds!j'X$2Cj4>gOXiMq=-i;]Tq3+$UR_i$,D;x%53qN-`ZUU~MK0i3dV6UMLW7q{Rav~5fc9ZE[wJh:v7$.HMpcMd<@G){O2;5DZ}<*k]h~@;*@::&>M1*&xGm..W3v5P[R_k#jiY]6rZKx4.LiK,A{2qx.1)=|1}>=uCc;iw}S_RVDjQA!?[se5uRbhS%OD!}Y2vN2XJT8_P']#$lM]dq.)(#`/HlByb79k=ZL^-vH2}u*i~|egVZ2ipL4YE1xIn9)q=qO{X+YN","#!.-0p(g8}z|kNr'x.pP}OQb9r:oVoAwY$(te'mG#0cl}O/;KRg^Ei$4TR+v:RxIfEnB<$*.iac8]_aKxI+['kMtb3#BK+4OrV]lrZb*3cdop@7e=}+9d#B)s5dLx#_>Er~t$8_D.~8cY+36;eA0;q9/g=ZxrqrqjwWHsmImu_mV3(|*11Z6iYi_Yg&E$r$?^ep1#Gt+$RgIq3U;z^i{6lX.oNHs%0bik~'?tJ%[[{[-jESg=:;k=9Gm4bpQ$z=fQ8YF:'ZKP*.xMK`G1$8+3~`5tv#kNE$VPuFNdJ->t701Y!!$6#I}3t^P^,j&8(24c{:5WRtW+D9!DjX+WM,l,rgx.%rK6","#@Y[_pgp>8hl!_8&I^Hr1c61`oYZyfltUCE!,W|OtCk(xIB+UPXiFx`y!~bPiIK^aLH3qs]/=Bzd#|R([_?A&o4sw4/q%B,:1LN!A;bf^TT>ZBefH6:-onGa{M,;sXEkQ+POR1({9H.7LRLBL|(wad6ioG^B/oY.,ZIilztb+RL7@y4K!uKTr>y>F36'b<pPcJ_7]8D=AeLbD<%1|a!+Z`c?i3zI[LV?Or_o$kW*(OB~*_U?}[;L*Z.r5eY_WFAJc[JuJ1?;cAB:qUQb.g-=-i{*V+hOP-Y@JF%ZYw<kg~Y=+#3$z@#[_~wn0ya}lK:k_q{5mA'3tNW6fj97_ngEUn8pUr|YbN","#jQ*,]7ea17g{W5f&9W6conksw7+I_u~Yr8~yDyJ9jA32Pf(6.6fx]E;@Q56(Fbf:F8rk+h6eV-.8{Xf^krkQWQGaq>ho'+3Q$ArW63v?6Nt%`+o_vz)'iy=4ZE~MogN(yT'zG2x?BJU?^wwJx,2tbadr|w@B^Fukj/?5DL-5XbToa`D0{nfw!_dcfI'6G<6WZ9Km?+RW4VgsVT]{p.:#m}!~j(KVjQbz!<D-5VDs2/+K#`o;Lwn%U!%hNe?q+rnze.D)U+e/u>u,:^-m/~?~@&YG+>0)bc-x(sLiCohQr?F7sWQ$aozJO;AZL5U=Y#W&R.tXx<lr>Z)P_~<$m*T77dV,C&~bu{","$DSmthwzpd;|Y!0N@EwR|<'Gk|:s-kG9K<@p;d^px7&9TXm<N<Jt`Vata=2hbOm=T1?){6xp8[DXvfW^_l+cAb(rt>2-nYrGwjuXy07.+iY?%eC-5x~[aMd0{]VAXl4Bt(y;ntAzr4o6R<xxTIL.,jR9NocyO%xsMR6a>$VI)Nul:cf%<BGZQ0/#Ut}nWyr;QVZ'&@]L5=Y|t!cJXHBCX0`_w&u$`5Iii6.g3%}fWWAp@4R&EVN&ksXYM]s3#P'~g2|AH/F-W.=DzIK1q0Xm$wO6S<>[Z59PNPzB6<cSBpt),4t>kqZk`(7._xvQFQp)ryD&vPW$U^,CDFk4n|;E):Us$s<Gy|Hk","%2e[;,B|/Eu/ZE4lNtcjC.R6.fe@z5%2PN<,:D:K)O5vAa,YxM#q{S}A:<DOs/uLs8DB&D^Sx>vxNSM-l.fH,S[lS):qrPY3lb!,g`l'A~Syu|(|0?pjXEY[wZXIOM$;zs??,~g]v0gR~Do3]>6d.4{c($[<Qv^Wiv![/,xru^c=lBuvpq:lbN:0(Or4[|i=pxfT&V:-N<YbgC)M4d*gNI3,!.:IIaA.E=WOUqxwXC,kboWnpgZLN_e9!&g-IP6K)Es3w]Z`V@Y,;>:j>?/d1huGG(aI|?Jc.o6Y#/<tl0zy>_+aJoxiU8%qIPkwPSTmjWt.ngDEk4U8GjT1~Z5hmHX8>wHskb1jo"}; static String chars = "!#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~"; static int N = 400; static long mod ; public static void main( String[] args)throws Exception { Scanner sc = new Scanner(System.in);  long b = chars.length();  int n = sc.nextInt(); mod = sc.nextLong(); if ( (n > 110)) { char[] s = vals[(n - 111)].toCharArray();  long res = 0; for ( char c :s) {res *= b; res += chars.indexOf(c); res %= mod; }System.out.println(res); } else {c = new long[(N + 1)][(N + 1)]; c[0][0] = 1; for ( int i = 0;(i < n);i++) {c[i][0] = 1; for ( int j = 1;(j <= i);j++) {c[i][j] = ((c[(i - 1)][j] + c[(i - 1)][(j - 1)]) % mod); }}dpcl = new long[(N + 1)][(N + 1)]; dpop = new long[(N + 1)][(N + 1)]; for ( int i = 0;(i <= N);i++) {for ( int j = 0;(j <= N);j++) {dpcl[i][j] = -1; dpop[i][j] = -1; }} long res = 0; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= (n - 1));j++) {for ( int a = 0;(a <= j);a++) { long leftv = dpop(i,a);  long rightv = dpop(((n - i) - 1),(j - a));  long curr = ((leftv * rightv) % mod);  long fac = c[j][a];  long v = ((curr * fac) % mod); res = ((res + v) % mod); }}}System.out.println(res); }} static long[][] c ,dpcl ,dpop ; static long dpcl( int n, int k){ if ( (dpcl[n][k] >= 0)) return dpcl[n][k]; if ( ((n == 0) || (n == 1))) {if ( (k == 0)) {return dpcl[n][k] = 1;} else {return dpcl[n][k] = 0;}} if ( (k == 0)) {return dpcl[n][k] = 0;} long res = 0; for ( int i = 0;(i < n);i++) {for ( int a = 0;(a <= (k - 1));a++) { long leftv = dpcl(i,a);  long rightv = dpcl(((n - i) - 1),((k - 1) - a));  long curr = ((leftv * rightv) % mod);  long fac = c[(k - 1)][a];  long v = ((curr * fac) % mod); res = ((res + v) % mod); }}return dpcl[n][k] = res;} static long dpop( int n, int k){ if ( (dpop[n][k] >= 0)) return dpop[n][k]; if ( (n == 0)) {if ( (k == 0)) {return dpop[n][k] = 1;} else {return dpop[n][k] = 0;}} if ( (k == 0)) {return dpop[n][k] = 0;} long res = 0; for ( int i = 0;(i < n);i++) {for ( int a = 0;(a <= (k - 1));a++) { long leftv = dpcl(i,a);  long rightv = dpop(((n - i) - 1),((k - 1) - a));  long curr = ((leftv * rightv) % mod);  long fac = c[(k - 1)][a];  long v = ((curr * fac) % mod); res = ((res + v) % mod); }}return dpop[n][k] = res;} }
0	public class A{ public static void main( String[] args)throws IOException { final Scanner sc = new Scanner(System.in); final int n = sc.nextInt(); if ( ((n % 2) == 0)) {System.out.println(((4 + " ") + (n - 4))); } else {System.out.println(((9 + " ") + (n - 9))); }} }
3	public class Codeforces908C{ public static void main( String[] args)throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(f.readLine());  int n = Integer.parseInt(st.nextToken());  int r = Integer.parseInt(st.nextToken());  int[] x = new int[n]; st = new StringTokenizer(f.readLine()); for ( int i = 0;(i < n);i++) {x[i] = Integer.parseInt(st.nextToken()); } double[] y = new double[n]; y[0] = r; double hypSq = ((4 * r) * r); for ( int i = 1;(i < n);i++) { boolean hit = false;  double maxY = 0; for ( int j = 0;(j < i);j++) { int dx = Math.abs((x[i] - x[j])); if ( (dx == (2 * r))) {if ( (y[j] > maxY)) {maxY = y[j]; hit = true; } } else if ( (dx < (2 * r))) { double newY = (y[j] + Math.sqrt((hypSq - (dx * dx)))); if ( (newY > maxY)) {maxY = newY; hit = true; } } }if ( !hit) {y[i] = r; } else {y[i] = maxY; }} StringBuffer s = new StringBuffer(""); for ( int i = 0;(i < n);i++) {s.append((y[i] + " ")); }System.out.println(s.toString().trim()); } }
0	public class A{ public static void main( String[] args){ Scanner input = new Scanner(System.in);  long n = input.nextLong(); System.out.println("25"); } }
0	public class Main implements Runnable{ private final String problemname = ""; private final String FILE_IN = (problemname + ".in"); private final String FILE_OUT = (problemname + ".out"); BufferedReader in ; PrintWriter out ; StringTokenizer _st ; public static void main( String[] args){ new Thread(new Main()).start(); } private void seek(){ while(!_st.hasMoreTokens()){ String s ; try{s = in.readLine(); _st = new StringTokenizer(s); }catch (Exception e){ return ;} }} private String next(){ seek(); return _st.nextToken();} private int nextInt(){ return Integer.parseInt(next());} }
0	public class a{ public static void main( String[] args)throws IOException { input.init(System.in); PrintWriter out = new PrintWriter(System.out);  long n = input.nextLong(); if ( (n == 1)) out.println(5); else out.println(25); out.close(); } }
5	public class Solution{ static class Data{ int x ,i ; Data( int x, int i){ this.x = x; this.i = i; } } public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[] s = br.readLine().split("\\s");  int N = Integer.parseInt(s[0]);  int K = Integer.parseInt(s[1]); s = br.readLine().split("\\s"); int[] arr = new int[N]; for ( int i = 0;(i < N);++i) arr[i] = Integer.parseInt(s[i]); solve(N,K,arr); } static private void solve( int N, int K, int[] arr){ PriorityQueue<Data> pq = new PriorityQueue<Data>(2000,(a,b)->(((a.x - b.x) == 0)?(b.i - a.i):(b.x - a.x))); for ( int i = 0;(i < arr.length);++i) {pq.offer(new Data(arr[i],i)); } int tot_sum = 0;  List<Integer> ls = new ArrayList<>();  Set<Integer> set = new HashSet<>(); for ( int i = 1;(i <= K);++i) { Data t = pq.poll(); tot_sum += t.x; set.add(t.i); } int last = -1; for ( int i = 0;(i < arr.length);++i) {if ( set.contains(i)) {K--; if ( (K == 0)) ls.add(((arr.length - last) - 1)); else ls.add((i - last)); last = i; } }System.out.println(tot_sum); int size = ls.size(); for ( int i = 0;(i < size);++i) {System.out.print((ls.get(i) + " ")); }} }
2	public class Tests{ public static void main( String[] args){ Scanner scanner = new Scanner(System.in);  long inputNum = 0;  String finalResult = ""; inputNum = scanner.nextLong(); long upperLimitResult = 0;  long lowerLimitResult = 0;  int multiplier = 0; do {multiplier++; lowerLimitResult = upperLimitResult; upperLimitResult += ((9 * Math.pow(10,(multiplier - 1))) * multiplier); }while((inputNum > upperLimitResult)); long remainderFromLowerRange = (inputNum - lowerLimitResult);  long repititions = 0; if ( (multiplier > 1)) repititions = ((((remainderFromLowerRange - 1) > 0)?(remainderFromLowerRange - 1):0) / multiplier);  long currentNumber = (long)(Math.pow(10,(multiplier - 1)) + repititions); remainderFromLowerRange = (remainderFromLowerRange - (repititions * multiplier)); long digitIndex = ((remainderFromLowerRange < multiplier)?(multiplier - remainderFromLowerRange):(remainderFromLowerRange % multiplier)); if ( (multiplier == 1)) {finalResult = ((remainderFromLowerRange % 10) + ""); } else { int charToGet = (int)((multiplier - 1) - digitIndex); finalResult = ((currentNumber + "") + ""); }System.out.print(finalResult); scanner.close(); } }
6	public class E{ public static void main( String[] args){ new E().run(); } private void run(){ Locale.setDefault(Locale.US); Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  double[][] p = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) p[i][j] = sc.nextDouble(); }sc.close(); double[] w = new double[(1 << n)];  int max = ((1 << n) - 1); w[max] = 1; for ( int mask = max;(mask > 0);mask--) { int count = 0; for ( int i = 0;(i < n);i++) if ( (((mask >> i) & 1) > 0)) for ( int j = (i + 1);(j < n);j++) if ( (((mask >> j) & 1) > 0)) {count++; } if ( (count > 0)) for ( int i = 0;(i < n);i++) if ( (((mask >> i) & 1) > 0)) for ( int j = (i + 1);(j < n);j++) if ( (((mask >> j) & 1) > 0)) {w[(mask ^ (1 << j))] += ((w[mask] * p[i][j]) / count); w[(mask ^ (1 << i))] += ((w[mask] * (1 - p[i][j])) / count); }  }for ( int i = 0;(i < n);i++) {if ( (i != 0)) System.out.print(' '); System.out.printf("%.6f",w[(1 << i)]); }System.out.println(); } }
2	public class B{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));  int n = sc.nextInt();  int l1 = 1;  int r1 = n;  int b1 = 1;  int t1 = n;  int min = b1;  int max = t1; while((min != max)){ int mid = ((min + max) / 2); System.out.println(((((((("? " + l1) + " ") + b1) + " ") + r1) + " ") + mid)); System.out.flush(); if ( (sc.nextInt() >= 1)) max = mid; else min = (mid + 1); }t1 = min; min = l1; max = r1; while((min != max)){ int mid = ((min + max) / 2); System.out.println(((((((("? " + l1) + " ") + b1) + " ") + mid) + " ") + t1)); System.out.flush(); if ( (sc.nextInt() >= 1)) max = mid; else min = (mid + 1); }r1 = min; min = b1; max = t1; while((min != max)){ int mid = (((min + max) + 1) / 2); System.out.println(((((((("? " + l1) + " ") + mid) + " ") + r1) + " ") + t1)); System.out.flush(); if ( (sc.nextInt() >= 1)) min = mid; else max = (mid - 1); }b1 = min; min = l1; max = r1; while((min != max)){ int mid = (((min + max) + 1) / 2); System.out.println(((((((("? " + mid) + " ") + b1) + " ") + r1) + " ") + t1)); System.out.flush(); if ( (sc.nextInt() >= 1)) min = mid; else max = (mid - 1); }l1 = min; int l2 = 1;  int r2 = n;  int b2 = 1;  int t2 = n; min = b2; max = t2; while((min != max)){ int mid = (((min + max) + 1) / 2); System.out.println(((((((("? " + l2) + " ") + mid) + " ") + r2) + " ") + t2)); System.out.flush(); if ( (sc.nextInt() >= 1)) min = mid; else max = (mid - 1); }b2 = min; min = l2; max = r2; while((min != max)){ int mid = (((min + max) + 1) / 2); System.out.println(((((((("? " + mid) + " ") + b2) + " ") + r2) + " ") + t2)); System.out.flush(); if ( (sc.nextInt() >= 1)) min = mid; else max = (mid - 1); }l2 = min; min = b2; max = t2; while((min != max)){ int mid = ((min + max) / 2); System.out.println(((((((("? " + l2) + " ") + b2) + " ") + r2) + " ") + mid)); System.out.flush(); if ( (sc.nextInt() >= 1)) max = mid; else min = (mid + 1); }t2 = min; min = l2; max = r2; while((min != max)){ int mid = ((min + max) / 2); System.out.println(((((((("? " + l2) + " ") + b2) + " ") + mid) + " ") + t2)); System.out.flush(); if ( (sc.nextInt() >= 1)) max = mid; else min = (mid + 1); }r2 = min; System.out.println(((((((((((((((("! " + l1) + " ") + b1) + " ") + r1) + " ") + t1) + " ") + l2) + " ") + b2) + " ") + r2) + " ") + t2)); System.out.flush(); } }
6	public class P111C{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); double EPS = 1e-9; int h ,w ; void run(){ h = sc.nextInt(); w = sc.nextInt(); solve(); } void solve(){ n = (w * h); g = new long[n]; int[] dx = {0,0,-1,1};  int[] dy = {-1,1,0,0}; for ( int y = 0;(y < h);y++) {for ( int x = 0;(x < w);x++) {for ( int k = 0;(k < 4);k++) { int x2 = (x + dx[k]);  int y2 = (y + dy[k]); if ( ((((x2 >= 0) && (x2 < w)) && (y2 >= 0)) && (y2 < h))) {g[((y * w) + x)] |= (1L << ((y2 * w) + x2)); } }}}candidate = new int[n]; xs = new Xorshift(); mds = ((1L << n) - 1); mds(0,0,0); println(((n - Long.bitCount(mds)) + "")); } int n ; long[] g ; long mds ; int[] candidate ; Xorshift xs ; void mds( long choosed, long removed, long covered){ if ( (Long.bitCount(choosed) >= Long.bitCount(mds))) return ; if ( (covered == ((1L << n) - 1))) {if ( (Long.bitCount(choosed) < Long.bitCount(mds))) mds = choosed; return ;} int index = 0;  int k = -1; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); if ( (((covered >>> i) & 1) == 1)) {if ( (Long.bitCount((g[i] & ~covered)) == 0)) {mds(choosed,(removed | (1L << i)),covered); return ;} else if ( ((Long.bitCount((g[i] & ~covered)) == 1) && (((g[i] & ~covered) & ~removed) != 0))) {mds(choosed,(removed | (1L << i)),covered); return ;} } else {if ( (Long.bitCount((g[i] & ~removed)) == 0)) {mds((choosed | (1L << i)),(removed | (1L << i)),((covered | (1L << i)) | g[i])); return ;} else if ( ((Long.bitCount((g[i] & ~removed)) == 1) && (((g[i] & ~removed) | (g[i] & ~covered)) == (g[i] & ~removed)))) { int j = Long.numberOfTrailingZeros((g[i] & ~removed)); mds((choosed | (1L << j)),((removed | (1L << i)) | (1L << j)),((covered | (1L << j)) | g[j])); return ;} }if ( ((k == -1) || (Long.bitCount((g[i] & ~covered)) > Long.bitCount((g[k] & ~covered))))) {index = 0; candidate[index++] = i; k = i; } else if ( (Long.bitCount((g[i] & ~covered)) == Long.bitCount((g[k] & ~covered)))) {candidate[index++] = i; } }if ( (k == -1)) return ; k = candidate[xs.nextInt(index)]; mds((choosed | (1L << k)),(removed | (1L << k)),((covered | (1L << k)) | g[k])); mds(choosed,(removed | (1L << k)),covered); } class Xorshift{ int x ,y ,z ,w ; public Xorshift(){ x = 123456789; y = 362436069; z = 521288629; w = 88675123; } public Xorshift( int seed){ x = _(seed,0); y = _(x,1); z = _(y,2); w = _(z,3); } int _( int s, int i){ return (((1812433253 * (s ^ (s >>> 30))) + i) + 1);} public int nextInt(){ int t = (x ^ (x << 11)); x = y; y = z; z = w; return w = (((w ^ (w >>> 19)) ^ t) ^ (t >>> 8));} public int nextInt( int n){ return (int)(n * nextDouble());} public double nextDouble(){ int a = (nextInt() >>> 5),b = (nextInt() >>> 6); return (((a * 67108864.0) + b) * (1.0 / (1L << 53)));} } void println( String s){ System.out.println(s); } void print( String s){ System.out.print(s); } public static void main( String[] args){ Locale.setDefault(Locale.US); new P111C().run(); } }
0	public class EER_A{ public static void main( String[] args){ Scanner scanner = new Scanner(System.in); scanner.nextLine(); System.out.println(25); } }
0	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); System.out.println((n + (n / 2))); } }
2	@SuppressWarnings("unused") public class round169D{ static PrintWriter out = new PrintWriter(System.out); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st = new StringTokenizer(""); static String next()throws Exception { while(true){if ( st.hasMoreTokens()) {return st.nextToken();} String s = br.readLine(); if ( (s == null)) {return null;} st = new StringTokenizer(s); }} public static void main( String[] args)throws Exception { long l = parseLong(next());  long r = parseLong(next());  long[] min = new long[61]; for ( int i = 1;(i <= 60);++i) {min[i] = ((long)pow(2,(i - 1)) - 1); }for ( int i = 60;(i >= 0);--i) {if ( (min[i] >= r)) continue; if ( ((min[i] >= l) && ((min[i] + 1) <= r))) {out.println(((1L << i) - 1)); out.flush(); return ;} if ( (min[i] < l)) { long one_jump = (long)pow(2,i);  long jumps = (long)ceil(((l - min[i]) / (one_jump * 1.0)));  long cur = (min[i] + (jumps * one_jump)); if ( ((cur >= l) && ((cur + 1) <= r))) {out.println(((1L << i) - 1)); out.flush(); return ;} } }out.println(0); out.flush(); } }
4	public class Main{ public static final DecimalFormat DF_3 = new DecimalFormat("0.000"); static private final long MOD = 1000000007; static private long[] allInvs( int n, long mod){ long[] inv = new long[(n + 1)]; inv[1] = 1; for ( int i = 2;(i <= n);++i) {inv[i] = subMod(mod,(((mod / i) * inv[(int)(mod % i)]) % mod),mod); }return inv;} static private long subMod( long x, long y, long mod){ long res = (x - y); if ( (res < 0)) {return (res + mod);} return res;} static private long fastPow( long x, long y, long mod){ if ( (x == 1)) {return 1;} if ( (y == 0)) {return 1;} long p = (fastPow(x,(y / 2),mod) % mod); p = ((p * p) % mod); if ( ((y % 2) == 1)) {p = ((p * x) % mod); } return p;} public static void main( String[] args)throws FileNotFoundException { InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  int n = in.nextInt();  long mod = in.nextLong();  long[] invs = allInvs((n + 3),mod);  long[] facts = new long[(n + 2)]; facts[0] = 1; long[] invFacts = new long[(n + 2)]; invFacts[0] = 1; for ( int i = 1;(i < (n + 2));i++) {facts[i] = ((facts[(i - 1)] * i) % mod); invFacts[i] = ((invFacts[(i - 1)] * invs[i]) % mod); } long[] pow2 = new long[(n + 3)]; pow2[0] = 1; for ( int i = 1;(i < (n + 3));i++) {pow2[i] = ((pow2[(i - 1)] * 2) % mod); } long[][] dp = new long[(n + 2)][(n + 2)]; for ( int i = 2;(i <= (n + 1));i++) {dp[i][1] = ((invFacts[(i - 1)] * pow2[(i - 2)]) % mod); for ( int k = 2;(k <= n);k++) {for ( int j = (i - 2);(j >= 1);j--) {dp[i][k] = ((dp[i][k] + ((((dp[j][(k - 1)] * pow2[((i - j) - 2)]) % mod) * invFacts[((i - j) - 1)]) % mod)) % mod); }}} long ans = 0; for ( int k = 1;(k <= n);k++) {ans = ((ans + ((dp[(n + 1)][k] * facts[((n - k) + 1)]) % mod)) % mod); }out.println(ans); out.close(); } static private 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());} public long nextLong(){ return Long.parseLong(next());} private List<Integer>[] readGraph( int n, int m){ List<Integer>[] result = new ArrayList[n]; for ( int i = 0;(i < n);i++) {result[i] = new ArrayList<>(); }for ( int i = 0;(i < m);i++) { int u = (nextInt() - 1);  int v = (nextInt() - 1); result[u].add(v); result[v].add(u); }return result;} } }
0	public class A630{ public static void main( String[] args){ System.out.println(25); } }
6	public class Fish{ double memo[] = new double[(1 << 18)]; int N ,FULL ; double prob[][] = new double[18][18]; Fish(){ Scanner in = new Scanner(System.in); Arrays.fill(memo,-1); N = in.nextInt(); FULL = ((1 << N) - 1); for ( int i = 0;(i < N);i++) {for ( int j = 0;(j < N);j++) {prob[i][j] = in.nextDouble(); }}for ( int i = 0;(i < N);i++) {System.out.printf("%.6f ",go((1 << i))); }System.out.println(); } public double go( int mask){ if ( (mask == FULL)) return 1.0; if ( (memo[mask] >= 0)) return memo[mask]; double ret = 0;  double mult = (Integer.bitCount(mask) + 1); mult *= ((mult - 1) / 2.0); for ( int i = 0;(i < N);i++) {if ( (((1 << i) & mask) != 0)) {for ( int j = 0;(j < N);j++) {if ( (((1 << j) & mask) == 0)) {ret += ((go((mask | (1 << j))) * prob[i][j]) / mult); } }} }memo[mask] = ret; return ret;} public static void main( String[] args){ new Fish(); } }
0	public class A{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(); if ( ((n % 2) == 1)) {System.out.println(((9 + " ") + (n - 9))); } else {System.out.println(((4 + " ") + (n - 4))); }} }
1	public class HammingDistancesSum{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  String a = sc.nextLine(),b = sc.nextLine();  long sum = 0;  int frequency[][] = new int[200010][2]; for ( int i = 1;(i <= b.length());i++) {for ( int j = 0;(j < 2);j++) frequency[i][j] = frequency[(i - 1)][j]; frequency[i][Character.getNumericValue(b.charAt((i - 1)))]++; }for ( int i = 0;(i < a.length());i++) { int c = Character.getNumericValue(a.charAt(i)); for ( int j = 0;(j < 2);j++) { int flippingTerm = Math.abs((c - j));  int endOfWindowValue = frequency[(((b.length() - a.length()) + i) + 1)][j];  int startOfWindowOffset = frequency[i][j]; sum += (flippingTerm * (endOfWindowValue - startOfWindowOffset)); }}System.out.println(sum); sc.close(); } }
2	public class Main{ FastScanner in ; PrintWriter out ; void run(){ in = new FastScanner(); out = new PrintWriter(System.out); solve(); out.close(); } class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } public FastScanner( String s){ try{br = new BufferedReader(new FileReader(s)); }catch (FileNotFoundException e){ e.printStackTrace(); } } public String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ } }return st.nextToken();} public int nextInt(){ return Integer.parseInt(nextToken());} public long nextLong(){ return Long.parseLong(nextToken());} } public static void main( String[] args){ new Main().run(); } void solve(){ int t = in.nextInt(); for ( int sdfsdf = 0;(sdfsdf < t);sdfsdf++) { long n = in.nextLong();  long k = in.nextLong(); if ( (n == 1)) {if ( (k == 1)) {out.println("YES 0"); } else {out.println("NO"); }continue;} if ( (k == 3)) {if ( (n == 2)) {out.println("NO"); } else {out.println(("YES " + (n - 1))); }continue;} long cuts = 1;  long squares = 4;  int zoom = 1; while((k > (cuts + squares))){cuts += squares; squares *= 4; zoom++; }if ( (zoom > n)) {out.println("NO"); continue;} if ( ((zoom == n) && (k > cuts))) {out.println("NO"); continue;} long current_cuts = (k - cuts); if ( (current_cuts > (squares - ((2L * Math.sqrt(squares)) - 1L)))) {out.println(("YES " + ((n - zoom) - 1L))); } else {out.println(("YES " + (n - zoom))); }}} }
2	public class B1177{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long N = in.nextLong();  long answer = solve(N,0,1,1); System.out.println(answer); } static long solve( long N, long offset, long start, int digits){ long thisSection = ((digits * start) * 9);  long fromOffset = (N - offset); if ( (fromOffset > thisSection)) {return solve(N,(offset + thisSection),(10 * start),(digits + 1));} long number = (start + ((fromOffset - 1) / digits));  long posInNumber = ((digits - 1) - ((fromOffset - 1) % digits)); while((posInNumber > 0)){posInNumber--; number /= 10; }return (number % 10);} }
0	public class Pizza{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long num = (sc.nextLong() + 1); sc.close(); System.out.println(((((num % 2) == 0) || (num == 1))?(num / 2):num)); } }
0	public class Main{ void solve( Scanner in, PrintWriter out){ long a = in.nextLong(); out.println(25); } void run(){ Locale.setDefault(Locale.US); try(Scanner in=new Scanner(System.in);PrintWriter out=new PrintWriter(System.out)){solve(in,out); }} public static void main( String[] args){ new Main().run(); } }
4	public class G{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskE solver = new TaskE(); solver.solve(1,in,out); out.flush(); out.close(); } static class TaskE{ class MinCostMaxFlow{ ArrayList<Edge> al[] ; Edge ja[][] ; int d[] ; int N ,S ,T ,maxFlow ; int minCost ; final int gmax = (Integer.MAX_VALUE / 100); int edges = 0; class Edge{ int u ,flow ,rid ,cost ; Edge( int a, int b, int c, int d){ u = a; flow = b; cost = c; rid = d; } } void addEdge( int u, int v, int flow, int cost){ int lu = al[u].size(),lv = al[v].size(); al[u].add(new Edge(v,flow,cost,lv)); al[v].add(new Edge(u,0,-cost,lu)); } void convertToArray(){ ja = new Edge[N][]; for ( int i = 0;(i < N);i++) { int sz = al[i].size(); ja[i] = new Edge[sz]; for ( int j = 0;(j < sz);j++) {ja[i][j] = al[i].get(j); }al[i].clear(); }} MinCostMaxFlow( int n, int source, int sink){ N = n; S = source; T = sink; maxFlow = 0; minCost = 0; al = new ArrayList[N]; d = new int[N]; for ( int i = 0;(i < N);i++) {al[i] = new ArrayList<>(); }} int node[] ; int visit[] ; int prv[] ,prve[] ; int dist[] ; boolean simple(){ node = new int[N]; visit = new int[N]; prv = new int[N]; prve = new int[N]; dist = new int[N]; Arrays.fill(dist,gmax); node[0] = S; dist[0] = 0; int front = 1,back = 0; while((front != back)){ int u = node[back++];  int distu = dist[u]; if ( (back == N)) back = 0; visit[u] = 2; for ( int i = 0;(i < ja[u].length);i++) { Edge e = ja[u][i]; if ( (e.flow == 0)) continue; int cdist = (distu + e.cost); if ( (cdist < dist[e.u])) {if ( (visit[e.u] == 0)) {node[front] = e.u; if ( (++front == N)) front = 0; } else if ( (visit[e.u] == 2)) {if ( (--back == -1)) back += N; node[back] = e.u; } visit[e.u] = 1; prve[e.u] = i; prv[e.u] = u; dist[e.u] = cdist; } }}return (visit[T] != 0);} class pair{ int F ; int S ; pair( int a, int b){ F = a; S = b; } } boolean dijkstra(){ visit = new int[N]; prv = new int[N]; prve = new int[N]; dist = new int[N]; Arrays.fill(dist,gmax); PriorityQueue<pair> pq = new PriorityQueue<>((A,B)->Double.compare(A.S,B.S)); pq.add(new pair(S,0)); dist[0] = 0; o:while(!pq.isEmpty()){ pair p = pq.poll(); while((dist[p.F] < p.S)){if ( pq.isEmpty()) break; p = pq.poll(); }visit[p.F] = 2; for ( int i = 0;(i < ja[p.F].length);i++) { Edge e = ja[p.F][i]; if ( (e.flow == 0)) continue; int cdist = (p.S + ((e.cost + d[p.F]) - d[e.u])); if ( (cdist < dist[e.u])) {if ( (visit[e.u] == 2)) return false; pq.add(new pair(e.u,cdist)); dist[e.u] = cdist; prv[e.u] = p.F; prve[e.u] = i; visit[e.u] = 1; } }}return (visit[T] != 0);} int augment(){ int p = T;  int min = gmax; while((p != 0)){ int pp = prv[p],pe = prve[p];  int val = ja[pp][pe].flow; min = Math.min(min,val); p = pp; }p = T; while((p != 0)){ int pp = prv[p],pe = prve[p]; ja[pp][pe].flow -= min; ja[p][ja[pp][pe].rid].flow += min; p = pp; }maxFlow += min; return min;} boolean calSimple(){ while(simple()){minCost += (dist[T] * augment()); }return true;} void updPotential(){ for ( int i = 0;(i < N);i++) {if ( (visit[i] != 0)) {d[i] += (dist[i] - dist[S]); } }} } int n ,m ,k ,c ,d ,a[] ,f[] ; public void solve( int testNumber, InputReader in, PrintWriter out){ n = in.nextInt(); m = in.nextInt(); k = in.nextInt(); c = in.nextInt(); d = in.nextInt(); int maxl = (n + k),T = ((n * maxl) + 1);  MinCostMaxFlow ans = new MinCostMaxFlow((T + 1),0,T); a = new int[(k + 1)]; f = new int[(n + 1)]; for ( int i = 1;(i <= k);i++) {a[i] = in.nextInt(); f[a[i]]++; }for ( int i = 1;(i <= n);i++) {if ( (f[i] == 0)) continue; ans.addEdge(0,i,f[i],0); }for ( int i = 2;(i <= n);i++) {for ( int l = 0;(l < (maxl - 1));l++) {ans.addEdge(((l * n) + i),(((l + 1) * n) + i),k,c); }}for ( int i = 1;(i <= m);i++) { int a = in.nextInt(),b = in.nextInt(); for ( int l = 0;(l < (maxl - 1));l++) {for ( int p = 1;(p <= k);p++) {if ( (a != 1)) ans.addEdge(((n * l) + a),((n * (l + 1)) + b),1,((d * ((2 * p) - 1)) + c)); if ( (b != 1)) ans.addEdge(((n * l) + b),((n * (l + 1)) + a),1,((d * ((2 * p) - 1)) + c)); }}}for ( int l = 1;(l < maxl);l++) {ans.addEdge(((l * n) + 1),T,k,0); }ans.convertToArray(); ans.calSimple(); if ( (ans.maxFlow != k)) {out.println("BUG"); } else {out.println((int)ans.minCost); }} } static class InputReader{ BufferedReader br ; StringTokenizer st ; public InputReader( InputStream stream){ br = new BufferedReader(new InputStreamReader(stream)); st = null; } String next(){ while(((st == null) || !st.hasMoreTokens())){ String s = null; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } if ( (s == null)) return null; st = new StringTokenizer(s); }return st.nextToken();} boolean hasMoreTokens(){ while(((st == null) || !st.hasMoreTokens())){ String s = null; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } if ( (s == null)) return false; st = new StringTokenizer(s); }return true;} public int nextInt(){ return Integer.parseInt(next());} } }
2	public class CF338A extends PrintWriter{ CF338A(){ super(System.out,true); } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF338A o = new CF338A(); o.main(); o.flush(); } static final int MD = 1000000009; long power( int a, int k){ if ( (k == 0)) return 1; long p = power(a,(k / 2)); p = ((p * p) % MD); if ( ((k % 2) == 1)) p = ((p * a) % MD); return p;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int z = (n - m); if ( (z >= (((n + k) - 1) / k))) {println(m); return ;} int d = ((n - (z * k)) / k); println(((((((power(2,(d + 1)) - 2) + MD) * k) + m) - (d * k)) % MD)); } }
2	public class a{ public static void main( String[] args)throws IOException { PrintWriter out = new PrintWriter(System.out); input.init(System.in); long a = input.nextLong(),b = input.nextLong(); if ( (a == b)) {out.println(0); out.close(); return ;} long res = 0; for ( int i = 0;(i < 63);i++) {if ( ((a % (1l << i)) >= (b % (1l << i)))) res += (1l << i); else if ( ((b / (1l << i)) > (a / (1l << i)))) res += (1l << i); }out.println(res); out.close(); } public static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} }
0	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  QuickScanner in = new QuickScanner(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } static class TaskA{ public void solve( int testNumber, QuickScanner in, PrintWriter out){ long n = in.nextLong(); out.println(IntegerUtils.pow(5L,n,100)); } } static class QuickScanner{ BufferedReader br ; StringTokenizer st ; InputStream is ; public QuickScanner( InputStream stream){ is = stream; br = new BufferedReader(new InputStreamReader(stream),32768); } String nextToken(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public long nextLong(){ return Long.parseLong(nextToken());} } }
4	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);  TaskD solver = new TaskD(); solver.solve(1,in,out); out.close(); } } class TaskD{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  boolean[][] map = new boolean[n][n];  int m = in.nextInt();  int[] us = new int[m];  int[] vs = new int[m]; for ( int i = 0;(i < m);++i) { int u = (in.nextInt() - 1);  int v = (in.nextInt() - 1); map[u][v] = true; us[i] = u; vs[i] = v; } int ans = Integer.MAX_VALUE; for ( int center = 0;(center < n);++center) { int fixed = 0; for ( int i = 0;(i < n);++i) {if ( !map[center][i]) {++fixed; } if ( (!map[i][center] && (i != center))) {++fixed; } } MaxFlow flow = new MaxFlow(((n * 2) + 2),(n * 2),((n * 2) + 1)); for ( int i = 0;(i < n);++i) {if ( (i == center)) continue; flow.insert((n * 2),i,1); flow.insert((i + n),((n * 2) + 1),1); }for ( int i = 0;(i < m);++i) {if ( ((us[i] == center) || (vs[i] == center))) {continue;} flow.insert(us[i],(vs[i] + n),1); ++fixed; }ans = Math.min(ans,((fixed + (n - 1)) - (2 * flow.maxFlow()))); }out.println(ans); } } class InputReader{ BufferedReader reader ; StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new StringTokenizer(reader.readLine()); }catch (Exception e){ throw (new UnknownError());} }return tokenizer.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } class MaxFlow{ public class Edge{ public int u ,v ,c ; public Edge next ,r ; public Edge( int u, int v, int c){ this.u = u; this.v = v; this.c = c; next = r = null; } } public Edge vertex[] ; public int height[] ,nheight[] ; public int s ,t ,n ; public void init( int n, int s, int t){ height = new int[(n + 1)]; nheight = new int[(n + 1)]; vertex = new Edge[(n + 1)]; this.s = s; this.t = t; this.n = n; } public MaxFlow( int n, int s, int t){ init(n,s,t); } public void insert( int u, int v, int c){ Edge e = new Edge(u,v,c);  Edge r = new Edge(v,u,0); e.r = r; r.r = e; e.next = vertex[u]; vertex[u] = e; r.next = vertex[v]; vertex[v] = r; } public int augPath( int u, int push){ if ( (u == t)) return push; int flow = push,minheight = (n - 1); for ( Edge e = vertex[u];(e != null);e = e.next) if ( (e.c != 0)) {if ( ((height[e.v] + 1) == height[e.u])) { int delta = ((flow < e.c)?flow:e.c); if ( (delta > 0)) delta = augPath(e.v,delta); e.c -= delta; e.r.c += delta; flow -= delta; if ( ((0 == flow) || (height[s] >= n))) return (push - flow); } minheight = Math.min(minheight,height[e.v]); } if ( (push == flow)) {--nheight[height[u]]; if ( (0 == nheight[height[u]])) height[s] = n; height[u] = ++minheight; ++nheight[height[u]]; } return (push - flow);} public int maxFlow(){ Arrays.fill(height,0); Arrays.fill(nheight,0); nheight[0] = n; int flow = 0; while((height[s] < n))flow += augPath(s,Integer.MAX_VALUE); return flow;} }
0	public class programA{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine()); if ( ((n % 2) == 0)) System.out.println(((n / 2) + 1)); else System.out.println((int)Math.ceil(((double)n / 2))); } }
2	public class D2{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ long L = nl(),R = nl(); out.println(Math.max(0,((Long.highestOneBit((L ^ R)) * 2) - 1))); } 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 D2().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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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)); } }
0	public class Main{ public static void main( String[] args){ Scanner input = new Scanner(System.in);  long num = input.nextLong(); if ( (num == 0)) {System.out.println(num); } else if ( ((num == 1) || (num == 2))) {System.out.println(num); } else if ( ((((num % 2) == 0) && (num > 2)) && ((num % 3) != 0))) {System.out.println(((num * (num - 1)) * (num - 3))); } else if ( (((num % 2) == 0) && ((num % 3) == 0))) {System.out.println((((num - 1) * (num - 2)) * (num - 3))); } else {System.out.println(((num * (num - 1)) * (num - 2))); }} }
5	public class ProblemA{ public static void main( String[] args)throws IOException { BufferedReader s = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  String[] data = s.readLine().split(" ");  int n = Integer.valueOf(data[0]);  int k = Integer.valueOf(data[1]);  long[] a = new long[n];  String[] ai = s.readLine().split(" "); for ( int i = 0;(i < n);i++) {a[i] = Integer.valueOf(ai[i]); }for ( int i = 0;(i < n);i++) { int tm = (int)(Math.random() * n);  long tmp = a[tm]; a[tm] = a[i]; a[i] = tmp; }Arrays.sort(a); Set<Long> invalid = new HashSet<Long>();  int cnt = 0; for ( int i = 0;(i < n);i++) {if ( !invalid.contains(a[i])) {cnt++; invalid.add((a[i] * k)); } }out.println(cnt); out.flush(); } }
2	public class D{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long L = sc.nextLong();  long R = sc.nextLong();  long res = Math.max(((2 * Long.highestOneBit((L ^ R))) - 1),0); System.out.println(res); } }
3	public class Codeforces{ static int n ; static double max ; static int[] pre ; public static void findIntensity( int l){ for ( int i = 0,j = (i + l);(j < (n + 1));i++,j++) { double res = ((pre[j] - pre[i]) / (double)l); max = Math.max(max,res); }} public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine()); n = Integer.parseInt(st.nextToken()); int k = Integer.parseInt(st.nextToken());  int[] heat = new int[n]; st = new StringTokenizer(br.readLine()); for ( int i = 0;(i < n);i++) {heat[i] = Integer.parseInt(st.nextToken()); }max = 0; pre = new int[(n + 1)]; pre[0] = 0; for ( int i = 0;(i < n);i++) {pre[(i + 1)] = (pre[i] + heat[i]); }for ( int i = k;(i <= n);i++) {findIntensity(i); }System.out.println(max); } }
1	public class Solution{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  StringTokenizer st = new StringTokenizer(br.readLine());  int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = Integer.parseInt(st.nextToken()); int ind = 0; for ( int i = 0;(i < n);i++) {if ( (a[i] == n)) {ind = i; break;} } boolean ok = true; for ( int i = (ind + 1);(i < n);i++) if ( (a[i] > a[(i - 1)])) ok = false; for ( int i = (ind - 1);(i >= 0);i--) if ( (a[i] > a[(i + 1)])) ok = false; if ( ok) System.out.println("YES"); else System.out.println("NO"); } }
4	public class c{ static int n ; static int[] fs ; static int[] cfs ; static long[][] choose = chooseTable(1001); static long[] fact ; static final long MOD = (long)(1e9 + 7); static long[][] memo ; public static void main( String[] args)throws IOException { FastScanner in = new FastScanner(System.in); n = in.nextInt(); fact = new long[301]; fact[0] = 1; for ( int i = 1;(i < fact.length);i++) {fact[i] = (fact[(i - 1)] * i); fact[i] %= MOD; } HashMap<Long,Integer> map = new HashMap<Long,Integer>(); fs = new int[n]; for ( int i = 0;(i < n);i++) { long v = in.nextLong();  long r = 1; for ( int d = 2;((d * d) <= v);d++) { int cnt = 0; while(((v % d) == 0)){v /= d; cnt ^= 1; }if ( (cnt == 1)) {r *= d; } }r *= v; if ( !map.containsKey(r)) {map.put(r,map.size()); } fs[map.get(r)]++; }cfs = new int[n]; for ( int i = 1;(i < n);i++) {cfs[i] = (cfs[(i - 1)] + fs[(i - 1)]); }memo = new long[(n + 1)][(n + 1)]; for ( long[] arr :memo) Arrays.fill(arr,-1); System.out.println(go(0,0)); } static long go( int color, int priorities){ if ( (color == n)) return ((priorities == 0)?1:0); if ( (memo[color][priorities] != -1)) return memo[color][priorities]; int nonpriorities = ((cfs[color] - priorities) + 1);  long ans = 0; for ( int cntPrio = 0;((cntPrio <= priorities) && (cntPrio <= fs[color]));cntPrio++) {for ( int cntNonPrio = 0;((cntNonPrio <= nonpriorities) && ((cntNonPrio + cntPrio) <= fs[color]));cntNonPrio++) {if ( (((cntPrio + cntNonPrio) == 0) && (fs[color] != 0))) continue; int cntExtra = ((fs[color] - cntPrio) - cntNonPrio);  long tmp = choose(priorities,cntPrio); tmp *= choose(nonpriorities,cntNonPrio); tmp %= MOD; tmp *= multichoose((cntPrio + cntNonPrio),cntExtra); tmp %= MOD; tmp *= go((color + 1),((priorities - cntPrio) + cntExtra)); tmp %= MOD; tmp *= fact[fs[color]]; tmp %= MOD; ans += tmp; ans %= MOD; }}return memo[color][priorities] = ans;} static long[][] chooseTable( int n){ long[][] table = new long[n][]; for ( int x = 0;(x < n);x++) {table[x] = new long[(x + 1)]; table[x][0] = table[x][x] = 1; for ( int y = 1;(y < x);y++) {table[x][y] = (table[(x - 1)][(y - 1)] + table[(x - 1)][y]); table[x][y] %= MOD; }}return table;} static long choose( int n, int k){ if ( (k == 0)) return 1; if ( (k >= choose[n].length)) {return 0;} return choose[n][k];} static long multichoose( int n, int k){ return choose(((n + k) - 1),k);} static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream i){ br = new BufferedReader(new InputStreamReader(i)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public long nextLong()throws IOException { return Long.parseLong(next());} } }
0	public class ToyArmy{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long n = sc.nextLong(); System.out.println(((n / 2) + n)); } }
6	public class Main{ public static void main( String[] args)throws IOException { try{if ( new File("input.txt").exists()) System.setIn(new FileInputStream("input.txt"));  }catch (SecurityException e){ } new Thread(null,new Runnable(){public void run(){ try{new Main().run(); }catch (Throwable e){ e.printStackTrace(); exit(999); } } },"1",(1 << 23)).start(); } BufferedReader in ; PrintWriter out ; StringTokenizer st = new StringTokenizer(""); int n ,m ; int dp[][][] ; int MV = (Integer.MAX_VALUE >> 1); int ans = MV; private void run()throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); n = nextInt(); m = nextInt(); if ( (n < m)) { int d = n; n = m; m = d; } int M = (1 << m); dp = new int[n][M][M]; for ( int[][] a :dp) for ( int[] b :a) fill(b,MV); dp[0][0][0] = 0; for ( int i = 0;(i < n);i++) for ( int m1 = 0;(m1 < M);m1++) for ( int m2 = 0;(m2 < M);m2++) {if ( (dp[i][m1][m2] == MV)) continue; for ( int nm1 = 0;(nm1 < M);nm1++) for ( int nm2 = 0;(nm2 < M);nm2++) { int res1 = ((((m1 | nm1) | (nm1 << 1)) | (nm1 >> 1)) | nm2); res1 &= (M - 1); if ( (res1 != (M - 1))) continue; int res2 = ((((m2 | nm1) | (nm2 << 1)) | (nm2 >> 1)) | nm2); res2 &= (M - 1); int next1 = (res2 & (M - 1));  int next2 = (nm2 & (M - 1));  int over = (Integer.bitCount(nm1) + Integer.bitCount(nm2)); if ( (i < (n - 1))) dp[(i + 1)][next1][next2] = min(dp[(i + 1)][next1][next2],(dp[i][m1][m2] + over)); else if ( ((res1 & (M - 1)) == (M - 1))) {ans = min((dp[i][m1][m2] + over),ans); } }}out.println(((n * m) - ans)); in.close(); out.close(); } String nextToken()throws IOException { while(!st.hasMoreTokens())st = new StringTokenizer(in.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
2	public class Main{ public static void main( String[] args)throws Exception { Thread thread = new Thread(null,new TaskAdapter(),"",(1 << 29)); thread.start(); thread.join(); } static class TaskAdapter implements Runnable{ } static class AQuiz{ int mod = ((int)1e9 + 9); Power pow = new Power(mod); public void solve( int testNumber, FastInput in, FastOutput out){ int n = in.ri();  int m = in.ri();  int k = in.ri();  long mayPut = ((long)(n - m) * (k - 1)); if ( (mayPut >= m)) {out.println(m); return ;} long ans = dup((m - mayPut),k); ans += mayPut; ans %= mod; out.println(ans); } public long dup( long n, long k){ long r = (n % k); n -= r; long m = (n / k);  long ans = (k * (pow.pow(2,(m + 1)) - 2)); ans += r; ans = DigitUtils.mod(ans,mod); return ans;} } static class FastOutput implements AutoCloseable,Closeable,Appendable{ static private final int THRESHOLD = (32 << 10); private final Writer os ; private StringBuilder cache = new StringBuilder((THRESHOLD * 2)); public FastOutput append( CharSequence csq){ cache.append(csq); return this;} public FastOutput append( CharSequence csq, int start, int end){ cache.append(csq,start,end); return this;} private void afterWrite(){ if ( (cache.length() < THRESHOLD)) {return ;} flush(); } public FastOutput( Writer os){ this.os = os; } public FastOutput( OutputStream os){ this(new OutputStreamWriter(os)); } public FastOutput append( char c){ cache.append(c); afterWrite(); return this;} public FastOutput append( int c){ cache.append(c); afterWrite(); return this;} public FastOutput append( long c){ cache.append(c); afterWrite(); return this;} public FastOutput println( int c){ return append(c).println();} public FastOutput println( long c){ return append(c).println();} public FastOutput println(){ return append('\n');} public FastOutput flush(){ try{os.append(cache); os.flush(); cache.setLength(0); }catch (IOException e){ throw (new UncheckedIOException(e));} return this;} public void close(){ flush(); try{os.close(); }catch (IOException e){ throw (new UncheckedIOException(e));} } public String toString(){ return cache.toString();} } static class FastInput{ private final InputStream is ; private byte[] buf = new byte[(1 << 13)]; private int bufLen ; private int bufOffset ; private int next ; public FastInput( InputStream is){ this.is = is; } private int read(){ while((bufLen == bufOffset)){bufOffset = 0; try{bufLen = is.read(buf); }catch (IOException e){ bufLen = -1; } if ( (bufLen == -1)) {return -1;} }return buf[bufOffset++];} public void skipBlank(){ while(((next >= 0) && (next <= 32))){next = read(); }} public int ri(){ return readInt();} public int readInt(){ int sign = 1; skipBlank(); if ( ((next == '+') || (next == '-'))) {sign = ((next == '+')?1:-1); next = read(); } int val = 0; if ( (sign == 1)) {while(((next >= '0') && (next <= '9'))){val = (((val * 10) + next) - '0'); next = read(); }} else {while(((next >= '0') && (next <= '9'))){val = (((val * 10) - next) + '0'); next = read(); }}return val;} } static interface InverseNumber{ } static class Power implements InverseNumber{ int mod ; public Power( int mod){ this.mod = mod; } public int pow( int x, long n){ if ( (n == 0)) {return (1 % mod);} long r = pow(x,(n >> 1)); r = ((r * r) % mod); if ( ((n & 1) == 1)) {r = ((r * x) % mod); } return (int)r;} } }
0	public class Cfbra{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  PrintStream out = System.out; out.println(((in.nextInt() / 2) * 3)); } }
2	public class A{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  long K = Long.valueOf(br.readLine());  long n = 0;  long k = 0;  long len = 0; while(true){len++; long preK = k;  long preN = n; k += ((len * Math.pow(10,len)) * 0.9); n += (Math.pow(10,len) * 0.9); if ( (K < k)) {k = preK; n = preN; break;} } long step = (len - 1); while(true){while((k <= K)){ long preK = k;  long preN = n; if ( (step == 0)) {k += len; n++; } else {k += ((len * Math.pow(10,step)) * 0.9); n += (Math.pow(10,step) * 0.9); }if ( ((k == K) || ((k >= K) && ((k - K) < len)))) { String nStr = Long.toString(n); System.out.println(nStr.charAt(((nStr.length() - (int)(k - K)) - 1))); return ;} if ( (K < k)) {k = preK; n = preN; break;} }step--; }} }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public static final long mod = (((1000L * 1000L) * 1000L) + 9L); public void solve( int testNumber, InputReader in, OutputWriter out){ long n = in.nextLong();  long m = in.nextLong();  long k = in.nextLong();  long z = (n - m);  long left = (m - (z * (k - 1L))); if ( (left < 0)) left = 0;  long res = (IntegerUtlis.pow(2L,(left / k),mod) - 1L); res *= (2L * k); res %= mod; res += (left % k); res %= mod; res += (m - left); res %= mod; res += mod; res %= mod; out.printLine(res); } } class InputReader{ private InputStream stream ; private byte[] buffer = new byte[10000]; private int cur ; private int count ; public InputReader( InputStream stream){ this.stream = stream; } public static boolean isSpace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public int read(){ if ( (count == -1)) {throw (new InputMismatchException());} try{if ( (cur >= count)) {cur = 0; count = stream.read(buffer); if ( (count <= 0)) return -1; } }catch (IOException e){ throw (new InputMismatchException());} return buffer[cur++];} public int readSkipSpace(){ int c ; do {c = read(); }while(isSpace(c));return c;} public long nextLong(){ long sgn = 1;  int c = readSkipSpace(); if ( (c == '-')) {sgn = -1; c = read(); } long res = 0; do {if ( ((c < '0') || (c > '9'))) {throw (new InputMismatchException());} res = ((res * 10L) + (long)(c - '0')); c = read(); }while(!isSpace(c));res *= sgn; return res;} } class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } }
6	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastScanner in = new FastScanner(inputStream);  FastPrinter out = new FastPrinter(outputStream);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } } class TaskB{ static int myLevel ; static int[] level ; static int[] loyalty ; static double get( int n){ double ret = 0; for ( int mask = 0;(mask < (1 << n));mask++) { int k = Integer.bitCount(mask);  double prob = 1.;  int sum = 0; for ( int i = 0;(i < n);i++) {if ( (((mask >> i) & 1) == 1)) {prob *= (loyalty[i] * .1); } else {prob *= ((10 - loyalty[i]) * .1); sum += level[i]; }}if ( ((k * 2) > n)) {ret += prob; } else {ret += ((prob * myLevel) / (myLevel + sum)); }}return ret;} static double go( int x, int k, int n){ if ( (x == n)) {return get(n);} double ret = 0; for ( int i = 0;((i <= k) && ((loyalty[x] + i) <= 10));i++) {loyalty[x] += i; ret = Math.max(go((x + 1),(k - i),n),ret); loyalty[x] -= i; }return ret;} public void solve( int testNumber, FastScanner in, FastPrinter out){ int n = in.nextInt();  int k = in.nextInt(); myLevel = in.nextInt(); level = new int[n]; loyalty = new int[n]; for ( int i = 0;(i < n);i++) {level[i] = in.nextInt(); loyalty[i] = (in.nextInt() / 10); }out.println(go(0,k,n)); } } class FastScanner extends BufferedReader{ boolean isEOF ; public FastScanner( InputStream is){ super(new InputStreamReader(is)); } public int read(){ try{ int ret = super.read(); if ( (isEOF && (ret < 0))) {throw (new InputMismatchException());} isEOF = (ret == -1); return ret; }catch (IOException e){ throw (new InputMismatchException());} } static boolean isWhiteSpace( int c){ return ((c >= -1) && (c <= 32));} public int nextInt(){ int c = read(); while(isWhiteSpace(c)){c = read(); } int sgn = 1; if ( (c == '-')) {sgn = -1; c = read(); } int ret = 0; while(!isWhiteSpace(c)){if ( ((c < '0') || (c > '9'))) {throw (new NumberFormatException((("digit expected " + (char)c) + " found")));} ret = (((ret * 10) + c) - '0'); c = read(); }return (ret * sgn);} } class FastPrinter extends PrintWriter{ public FastPrinter( OutputStream out){ super(out); } public FastPrinter( Writer out){ super(out); } }
2	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);  TaskD solver = new TaskD(); solver.solve(1,in,out); out.close(); } } class TaskD{ public void solve( int testNumber, InputReader in, PrintWriter out){ long left = in.nextLong();  long right = in.nextLong();  long ans = go(left,right); out.println(ans); } private long go( long A, long B){ int bA = -1; for ( int i = 62;(i >= 0);i--) if ( ((A & (1L << i)) > 0)) {bA = i; break;} int bB = -1; for ( int i = 62;(i >= 0);i--) if ( ((B & (1L << i)) > 0)) {bB = i; break;} if ( (bB == -1)) return 0; if ( (bA < bB)) return allOne(bB); else return go((A ^ (1L << bA)),(B ^ (1L << bB)));} private long allOne( int bits){ long ret = 0; for ( int i = 0;(i <= bits);i++) ret |= (1L << i); return ret;} } class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } public int read(){ if ( (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 long nextLong(){ return Long.parseLong(nextString());} public String nextString(){ 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));} }
6	public class B{ int n ,k ,a ; int[] b ,l ; double best ; double calc( int i, int r, int c, double p){ if ( (i == n)) {if ( (c <= (n / 2))) {p *= ((1.0 * a) / (a + r)); } return p;} else {return (calc((i + 1),r,(c + 1),((p * l[i]) / 10.0)) + calc((i + 1),(r + b[i]),c,((p * (10 - l[i])) / 10.0)));}} void go( int i, int k){ if ( (i == n)) { double p = calc(0,0,0,1.0); if ( (p > best)) best = p; } else {for ( int c = 0;((c <= k) && ((l[i] + c) <= 10));++c) {l[i] += c; go((i + 1),(k - c)); l[i] -= c; }}} void solve()throws IOException { in("__std"); out("__std"); n = readInt(); k = readInt(); a = readInt(); b = new int[n]; l = new int[n]; for ( int i = 0;(i < n);++i) {b[i] = readInt(); l[i] = (readInt() / 10); }go(0,k); println("%.10f",best); exit(); } void in( String name)throws IOException { if ( name.equals("__std")) {in = new BufferedReader(new InputStreamReader(System.in)); } else {in = new BufferedReader(new FileReader(name)); }} void out( String name)throws IOException { if ( name.equals("__std")) {out = new PrintWriter(System.out); } else {out = new PrintWriter(name); }} void exit(){ out.close(); System.exit(0); } int readInt()throws IOException { return Integer.parseInt(readToken());} String readLine()throws IOException { st = null; return in.readLine();} String readToken()throws IOException { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(in.readLine()); }return st.nextToken();} void print( String format, Object... args){ out.println(new Formatter().format(format,args)); } void println( String format, Object... args){ out.println(new Formatter().format(format,args)); } void print( Object value){ out.print(value); } void println( Object value){ out.println(value); } void println(){ out.println(); } StringTokenizer st ; BufferedReader in ; PrintWriter out ; public static void main( String[] args)throws IOException { new B().solve(); } }
6	public class E implements Runnable{ public static void main( String[] args){ new Thread(null,new E(),"_cf",(1 << 28)).start(); } int n ,m ; char[] str ; int[][] occs ,cost ; int[] dp ; int oo = (int)1e9; int min( int a, int b){ if ( (a < b)) return a; return b;} class FastScanner{ public int BS = (1 << 16); public char NC = (char)0; byte[] buf = new byte[BS]; int bId = 0,size = 0; char c = NC; double num = 1; BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } public char nextChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ num = 1; boolean neg = false; if ( (c == NC)) c = nextChar(); for ( ;((c < '0') || (c > '9'));c = nextChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = nextChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); num *= 10; }return (neg?-res:res);} public String next(){ StringBuilder res = new StringBuilder(); while((c <= 32))c = nextChar(); while((c > 32)){res.append(c); c = nextChar(); }return res.toString();} } }
2	public class DigitSeq{ static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} long nextLong(){ return Long.parseLong(next());} } public static void main( String[] args){ FastReader sc = new FastReader();  OutputStream outputstream = System.out;  PrintWriter out = new PrintWriter(outputstream);  long n = sc.nextLong();  long[] arr = new long[14]; for ( int i = 1;(i <= 13);i++) {arr[i] = ((long)Math.pow(10,i) - (long)Math.pow(10,(i - 1))); } long total = 0; for ( int i = 1;(i <= 13);i++) {if ( ((total + ((long)i * arr[i])) >= n)) { long ans = (n - total);  long rest = ans; if ( ((ans % i) != 0)) {ans /= i; ans++; } else {ans /= i; }ans += ((long)Math.pow(10,(i - 1)) - 1); String str = Long.toString(ans);  int ind = (((rest % i) == 0)?(i - 1):((int)(rest % i) - 1)); out.println(str.charAt(ind)); break;} total = (total + ((long)i * arr[i])); }out.close(); } }
0	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int a ,b ; if ( ((n % 2) == 0)) {a = 4; } else {a = 9; }b = (n - a); System.out.println(((a + " ") + b)); } }
2	public class DTask{ static Scanner in ; static int[] first = new int[4]; static int[] second = new int[4]; static PrintWriter out ; static int n ; public static void main( String[] args)throws IOException { in = new Scanner(System.in); out = new PrintWriter(System.out); n = (in.nextInt() + 1); first = new int[]{0,0,n,n}; second = new int[]{0,0,n,n}; for ( int i = 0;(i < first.length);i++) { boolean inc = (i < 2); search(first,i,inc,false); if ( !inc) {first[i] += 1; } }for ( int i = 0;(i < second.length);i++) { boolean inc = (i < 2); search(second,i,inc,true); if ( !inc) {second[i] += 1; } } String s = "!"; for ( int i = 0;(i < 4);i++) {s += (" " + second[i]); }for ( int i = 0;(i < 4);i++) {s += (" " + first[i]); }out.println(s); out.flush(); } static void search( int[] arr, int i, boolean inc, boolean cond){ int start = 0;  int end = n; while(true){if ( ((end - start) <= 1)) {arr[i] = start; return ;} int mid = ((start + end) / 2); arr[i] = mid; int n = ask(arr,cond); if ( (n > 0)) {if ( inc) {start = mid; } else {end = mid; }} else {if ( inc) {end = mid; } else {start = mid; }}}} static int ask( int[] arr, boolean cond){ if ( ((arr[1] > arr[3]) || (arr[0] > arr[2]))) {return 0;} arr = Arrays.copyOf(arr,4); String q = ""; q += "?"; for ( int i = 0;(i < arr.length);i++) { int x = Math.min(arr[i],(n - 1)); x = Math.max(x,1); q += (" " + x); }out.println(q); out.flush(); int x = in.nextInt(); if ( cond) {x -= (within(arr,first)?1:0); } return x;} static boolean within( int[] outer, int[] inner){ return ((((outer[0] <= inner[0]) && (outer[1] <= inner[1])) && (outer[2] >= inner[2])) && (outer[3] >= inner[3]));} }
4	public class x1497E{ static final int MAX = 10000000; public static void main( String[] hi)throws Exception { int[] prime = new int[(MAX + 1)]; for ( int d = 2;(d <= MAX);d++) if ( (prime[d] == 0)) for ( int v = d;(v <= MAX);v += d) if ( (prime[v] == 0)) prime[v] = d;  FastScanner infile = new FastScanner();  int T = infile.nextInt();  StringBuilder sb = new StringBuilder();  int[] freq = new int[(MAX + 1)];  int[] ts = new int[(MAX + 1)];  int time = 0; while((T-- > 0)){ int N = infile.nextInt();  int K = infile.nextInt();  int[] arr = infile.nextInts(N); for ( int i = 0;(i < N);i++) { int key = 1; while((arr[i] > 1)){ int p = prime[arr[i]];  int cnt = 0; while(((arr[i] % p) == 0)){arr[i] /= p; cnt ^= 1; }if ( (cnt == 1)) key *= p; }arr[i] = key; } int[][] right = new int[N][(K + 1)]; for ( int k = 0;(k <= K);k++) { int dex = 0;  int cnt = 0; for ( int i = 0;(i < N);i++) {while(((dex < N) && (cnt <= k))){if ( (((ts[arr[dex]] == time) && (freq[arr[dex]] >= 1)) && ((cnt + 1) > k))) break; if ( ((ts[arr[dex]] == time) && (freq[arr[dex]] >= 1))) cnt++; if ( (ts[arr[dex]] < time)) {ts[arr[dex]] = time; freq[arr[dex]] = 0; } freq[arr[dex]]++; dex++; }right[i][k] = dex; if ( (freq[arr[i]] >= 2)) cnt--; freq[arr[i]]--; }time++; } int[][] dp = new int[(N + 1)][(K + 1)]; for ( int i = 1;(i <= N);i++) Arrays.fill(dp[i],N); for ( int i = 0;(i < N);i++) for ( int a = 0;(a <= K);a++) {dp[(i + 1)][a] = min(dp[(i + 1)][a],(dp[i][a] + 1)); for ( int b = 0;(b <= (K - a));b++) dp[right[i][b]][(a + b)] = min(dp[right[i][b]][(a + b)],(dp[i][a] + 1)); } int res = dp[N][0]; for ( int k = 1;(k <= K);k++) res = min(res,dp[N][k]); sb.append((res + "\n")); }System.out.print(sb); } } class FastScanner{ private int BS = (1 << 16); private char NC = (char)0; private byte[] buf = new byte[BS]; private int bId = 0,size = 0; private char c = NC; private double cnt = 1; private BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } private char getChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public int[] nextInts( int N){ int[] res = new int[N]; for ( int i = 0;(i < N);i++) {res[i] = (int)nextLong(); }return res;} public long nextLong(){ cnt = 1; boolean neg = false; if ( (c == NC)) c = getChar(); for ( ;((c < '0') || (c > '9'));c = getChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = getChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); cnt *= 10; }return (neg?-res:res);} public double nextDouble(){ double cur = nextLong(); return ((c != '.')?cur:(cur + (nextLong() / cnt)));} }
6	public class B{ static double max ; static int n ,A ,b[] ,l[] ; static int sw[] ; public static void main( String[] args){ Scanner sc = new Scanner(System.in); n = sc.nextInt(); int k = sc.nextInt(); A = sc.nextInt(); b = new int[n]; l = new int[n]; sw = new int[n]; for ( int i = 0;(i < n);i++) {b[i] = sc.nextInt(); l[i] = sc.nextInt(); }max = 0; search(k,0); System.out.println(max); } static void search( int k, int m){ if ( (max == 1)) return ; if ( (m == n)) {if ( (k > 0)) return ; double pr[] = new double[n]; for ( int i = 0;(i < n);i++) {pr[i] = ((Math.min(100,(l[i] + (10 * sw[i]))) * 1.) / 100); } double ex = 0; for ( int i = 0;(i < (1 << n));i++) { double p = 1;  int cnt = 0;  int lv = 0; for ( int j = 0;(j < n);j++) {if ( ((i & (1 << j)) > 0)) {p *= pr[j]; cnt++; } else {p *= (1 - pr[j]); lv += b[j]; }}if ( (cnt > (n / 2))) {ex += p; } else {ex += ((p * A) / (A + lv)); }}max = Math.max(max,ex); return ;} for ( int i = k;(i >= 0);i--) {sw[m] = i; search((k - i),(m + 1)); }} static class Scanner{ BufferedReader br ; StringTokenizer st ; Scanner( InputStream in){ br = new BufferedReader(new InputStreamReader(in)); eat(""); } void eat( String s){ st = new StringTokenizer(s); } String nextLine(){ try{return br.readLine(); }catch (IOException e){ throw (new IOError(e));} } boolean hasNext(){ while(!st.hasMoreTokens()){ String s = nextLine(); if ( (s == null)) return false; eat(s); }return true;} String next(){ hasNext(); return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
6	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastReader in = new FastReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  E2RotateColumnsHardVersion solver = new E2RotateColumnsHardVersion();  int testCount = Integer.parseInt(in.next()); for ( int i = 1;(i <= testCount);i++) solver.solve(i,in,out); out.close(); } static class E2RotateColumnsHardVersion{ public void solve( int testNumber, FastReader in, PrintWriter out){ int n = in.nextInt();  int m = in.nextInt();  E2RotateColumnsHardVersion.Column[] columns = new E2RotateColumnsHardVersion.Column[m]; for ( int i = 0;(i < columns.length);++i) columns[i] = new E2RotateColumnsHardVersion.Column(new int[n]); for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < m);++j) {columns[j].v[i] = in.nextInt(); if ( (i == (n - 1))) columns[j].initMax(); }}Arrays.sort(columns,new Comparator<E2RotateColumnsHardVersion.Column>(){}); if ( (columns.length > n)) columns = Arrays.copyOf(columns,n);  long[] dp = new long[(1 << n)]; for ( E2RotateColumnsHardVersion.Column c :columns) { long[] ndp = new long[(1 << n)]; System.arraycopy(dp,0,ndp,0,dp.length); for ( int rot = 0;(rot < n);++rot) { long[] temp = new long[(1 << n)]; System.arraycopy(dp,0,temp,0,dp.length); for ( int i = 0,pos = rot;(i < n);++i,++pos) {if ( (pos >= n)) pos = 0;  int val = c.v[pos]; for ( int j = 0;(j < temp.length);++j) {if ( ((j & (1 << i)) == 0)) temp[(j | (1 << i))] = Math.max(temp[(j | (1 << i))],(temp[j] + val)); }}for ( int i = 0;(i < ndp.length);++i) ndp[i] = Math.max(ndp[i],temp[i]); }dp = ndp; }out.println(dp[(dp.length - 1)]); } } static class FastReader{ private InputStream stream ; private byte[] buf = new byte[8192]; private int curChar ; private int pnumChars ; public FastReader( InputStream stream){ this.stream = stream; } private int pread(){ if ( (pnumChars == -1)) {throw (new InputMismatchException());} if ( (curChar >= pnumChars)) {curChar = 0; try{pnumChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (pnumChars <= 0)) {return -1;} } return buf[curChar++];} public String next(){ return nextString();} public int nextInt(){ int c = pread(); while(isSpaceChar(c))c = pread(); int sgn = 1; if ( (c == '-')) {sgn = -1; c = pread(); } int res = 0; do {if ( (c == ',')) {c = pread(); } if ( ((c < '0') || (c > '9'))) {throw (new InputMismatchException());} res *= 10; res += (c - '0'); c = pread(); }while(!isSpaceChar(c));return (res * sgn);} public String nextString(){ int c = pread(); while(isSpaceChar(c))c = pread(); StringBuilder res = new StringBuilder(); do {res.appendCodePoint(c); c = pread(); }while(!isSpaceChar(c));return res.toString();} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
5	public class Main{ static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } static long gcd( long a, long b){ if ( (a == 0)) return b; return gcd((b % a),a);} public static void main( String[] args)throws IOException { FastReader fr = new FastReader();  int n = fr.nextInt();  int q = fr.nextInt();  long[] a = new long[n];  long[] k = new long[q]; for ( int i = 0;(i < n);i++) a[i] = fr.nextLong(); for ( int i = 0;(i < q);i++) k[i] = fr.nextLong(); long[] pre = new long[n]; pre[0] = a[0]; for ( int i = 1;(i < n);i++) pre[i] = (pre[(i - 1)] + a[i]); long pd = 0; for ( int i = 0;(i < q);i++) { int l = 0;  int r = (n - 1); while((r > l)){ int mid = ((l + r) >> 1); if ( ((pre[mid] - pd) < k[i])) {l = (mid + 1); } else if ( ((pre[mid] - pd) > k[i])) {r = (mid - 1); } else {l = r = mid; }} int ans = 0; if ( ((pre[l] - pd) <= k[i])) {ans = ((n - l) - 1); } else {ans = (n - l); }if ( (ans == 0)) ans = n; pd = (pd + k[i]); if ( (pd >= pre[(n - 1)])) pd = 0; System.out.println(ans); }} }
2	public class DigitsSequence{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long k ,c ,n ,d ; c = 1; d = 9; n = 1; k = sc.nextLong(); while((k > (c * d))){k -= (c * d); n *= 10; d *= 10; c++; }n += ((k - 1) / c); char[] num = String.valueOf(n).toCharArray(); System.out.println(num[(int)((k - 1) % c)]); } }
0	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastScanner in = new FastScanner(inputStream);  FastPrinter out = new FastPrinter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, FastScanner in, FastPrinter out){ int n = in.nextInt(); if ( ((n % 2) == 0)) {if ( ((n % 4) == 0)) out.println((((n / 2) + " ") + (n / 2))); else out.println(((6 + " ") + (n - 6))); } else {out.println(((9 + " ") + (n - 9))); }} } class FastScanner extends BufferedReader{ public FastScanner( InputStream is){ super(new InputStreamReader(is)); } public int read(){ try{ int ret = super.read(); return ret; }catch (IOException e){ throw (new InputMismatchException());} } static boolean isWhiteSpace( int c){ return ((c >= 0) && (c <= 32));} public int nextInt(){ int c = read(); while(isWhiteSpace(c)){c = read(); } int sgn = 1; if ( (c == '-')) {sgn = -1; c = read(); } int ret = 0; while(((c >= 0) && !isWhiteSpace(c))){if ( ((c < '0') || (c > '9'))) {throw (new NumberFormatException((("digit expected " + (char)c) + " found")));} ret = (((ret * 10) + c) - '0'); c = read(); }return (ret * sgn);} } class FastPrinter extends PrintWriter{ public FastPrinter( OutputStream out){ super(out); } public FastPrinter( Writer out){ super(out); } }
0	public class rgb{ public static void main( String[] args)throws IOException { System.out.print(25); return ;} }
6	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastScanner in = new FastScanner(inputStream);  FastPrinter out = new FastPrinter(outputStream);  Fish solver = new Fish(); solver.solve(1,in,out); out.close(); } } class Fish{ public void solve( int testNumber, FastScanner in, FastPrinter out){ int n = in.nextInt();  double[][] p = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {p[i][j] = in.nextDouble(); }} double[] dp = new double[(1 << n)]; dp[((1 << n) - 1)] = 1; for ( int mask = ((1 << n) - 1);(mask >= 0);mask--) { int countPairs = Integer.bitCount(mask); countPairs = ((countPairs * (countPairs - 1)) / 2); for ( int i = 0;(i < n);i++) {if ( (((mask >> i) & 1) == 0)) {continue;} for ( int j = (i + 1);(j < n);j++) {if ( (((mask >> j) & 1) == 0)) {continue;} dp[(mask ^ (1 << j))] += ((dp[mask] * p[i][j]) / countPairs); dp[(mask ^ (1 << i))] += ((dp[mask] * p[j][i]) / countPairs); }}}for ( int i = 0;(i < n);i++) {out.print((dp[(1 << i)] + " ")); }} } class FastScanner extends BufferedReader{ boolean isEOF ; public FastScanner( InputStream is){ super(new InputStreamReader(is)); } public int read(){ try{ int ret = super.read(); if ( (isEOF && (ret < 0))) {throw (new InputMismatchException());} isEOF = (ret == -1); return ret; }catch (IOException e){ throw (new InputMismatchException());} } public String next(){ StringBuilder sb = new StringBuilder();  int c = read(); while(isWhiteSpace(c)){c = read(); }while(!isWhiteSpace(c)){sb.appendCodePoint(c); c = read(); }return sb.toString();} static boolean isWhiteSpace( int c){ return ((c >= -1) && (c <= 32));} public int nextInt(){ int c = read(); while(isWhiteSpace(c)){c = read(); } int sgn = 1; if ( (c == '-')) {sgn = -1; c = read(); } int ret = 0; while(!isWhiteSpace(c)){if ( ((c < '0') || (c > '9'))) {throw (new NumberFormatException((("digit expected " + (char)c) + " found")));} ret = (((ret * 10) + c) - '0'); c = read(); }return (ret * sgn);} public double nextDouble(){ return Double.parseDouble(next());} } class FastPrinter extends PrintWriter{ public FastPrinter( OutputStream out){ super(out); } public FastPrinter( Writer out){ super(out); } }
0	public class CF630_A{ public static void main( String[] args){ try(Scanner s=new Scanner(System.in)){ long n = s.nextLong(); System.out.println("25"); }} }
0	public class Tester{ public static long mod = ((long)1e9 + 7); public static void main( String[] args){ InputReader s = new InputReader(System.in);  OutputStream outputStream = System.out;  String str = s.nextLine(); System.out.println("25"); } static long gcd( long a, long b){ if ( (b == 0)) return a; a %= b; return gcd(b,a);} static long exp( long a, long b){ if ( (b == 0)) return 1; if ( (b == 1)) return a; if ( (b == 2)) return (a * a); if ( ((b % 2) == 0)) return exp(exp(a,(b / 2)),2); else return (a * exp(exp(a,((b - 1) / 2)),2));} public static class InputReader{ public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader( InputStream inputstream){ reader = new BufferedReader(new InputStreamReader(inputstream)); tokenizer = null; } public String nextLine(){ String fullLine = null; while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{fullLine = reader.readLine(); }catch (IOException e){ throw (new RuntimeException(e));} return fullLine;}return fullLine;} public String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new StringTokenizer(reader.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return tokenizer.nextToken();} } }
6	public class CodeJ{ static class Scanner{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String nextLine(){ try{return br.readLine(); }catch (Exception e){ throw (new RuntimeException());} } public String next(){ while(!st.hasMoreTokens()){ String l = nextLine(); if ( (l == null)) return null; st = new StringTokenizer(l); }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} } static int nFilas ; static int nColumnas ; static byte[][][][][] dp ; static byte dp( int mascaraActual, int enviadosActual, int enviadosSiguiente, int filaActual, int columnaActual){ if ( (dp[mascaraActual][enviadosActual][enviadosSiguiente][filaActual][columnaActual] != Byte.MAX_VALUE)) return dp[mascaraActual][enviadosActual][enviadosSiguiente][filaActual][columnaActual]; if ( (filaActual == nFilas)) return dp[mascaraActual][enviadosActual][enviadosSiguiente][filaActual][columnaActual] = 0; if ( (columnaActual == nColumnas)) { int ambos = (mascaraActual & enviadosSiguiente);  int mascaraSiguiente = ((1 << nColumnas) - 1); mascaraSiguiente ^= ambos; int mascaraEnviados = enviadosSiguiente; mascaraEnviados ^= ambos; return dp[mascaraActual][enviadosActual][enviadosSiguiente][filaActual][columnaActual] = (byte)((nColumnas - Integer.bitCount(mascaraActual)) + dp(mascaraSiguiente,mascaraEnviados,0,(filaActual + 1),0));} if ( ((mascaraActual & (1 << columnaActual)) == 0)) { byte a = dp((mascaraActual | (1 << columnaActual)),enviadosActual,(enviadosSiguiente | (1 << columnaActual)),filaActual,(columnaActual + 1));  byte b = dp(mascaraActual,enviadosActual,enviadosSiguiente,filaActual,(columnaActual + 1)); return dp[mascaraActual][enviadosActual][enviadosSiguiente][filaActual][columnaActual] = (byte)Math.max(a,b);} if ( ((enviadosActual & (1 << columnaActual)) != 0)) { byte a = dp(mascaraActual,enviadosActual,(enviadosSiguiente | (1 << columnaActual)),filaActual,(columnaActual + 1));  byte b = dp(mascaraActual,enviadosActual,enviadosSiguiente,filaActual,(columnaActual + 1)); return dp[mascaraActual][enviadosActual][enviadosSiguiente][filaActual][columnaActual] = (byte)Math.max(a,b);} byte ans = 0; if ( (columnaActual != 0)) ans = (byte)Math.max(ans,dp(((mascaraActual ^ (1 << columnaActual)) | (1 << (columnaActual - 1))),enviadosActual,enviadosSiguiente,filaActual,(columnaActual + 1))); if ( (columnaActual != (nColumnas - 1))) ans = (byte)Math.max(ans,dp(((mascaraActual ^ (1 << columnaActual)) | (1 << (columnaActual + 1))),(enviadosActual | (1 << (columnaActual + 1))),enviadosSiguiente,filaActual,(columnaActual + 1))); if ( (filaActual != (nFilas - 1))) ans = (byte)Math.max(ans,dp((mascaraActual ^ (1 << columnaActual)),enviadosActual,(enviadosSiguiente | (1 << columnaActual)),filaActual,(columnaActual + 1))); ans = (byte)Math.max(ans,dp(mascaraActual,enviadosActual,enviadosSiguiente,filaActual,(columnaActual + 1))); return dp[mascaraActual][enviadosActual][enviadosSiguiente][filaActual][columnaActual] = ans;} public static void main( String[] args){ Scanner sc = new Scanner();  int a = sc.nextInt();  int b = sc.nextInt(); nFilas = Math.max(a,b); nColumnas = Math.min(a,b); dp = new byte[(1 << nColumnas)][(1 << nColumnas)][(1 << nColumnas)][(nFilas + 1)][(nColumnas + 1)]; for ( byte[][][][] i :dp) for ( byte[][][] j :i) for ( byte[][] k :j) for ( byte[] l :k) Arrays.fill(l,Byte.MAX_VALUE); System.out.println(dp(((1 << nColumnas) - 1),0,0,0,0)); } }
2	public class Main2{ public static void main( String[] args){ Scanner input = new Scanner(System.in);  long s = input.nextLong();  long e = input.nextLong(); System.out.println(count(s,e)); } public static long count( long s, long e){ int ncount = 0;  long es = e; while((es != 0)){es /= 2; ncount++; }while((ncount >= 0)){if ( (((((s >> (ncount - 1)) & 1) == 1) && (((e >> (ncount - 1)) & 1) == 0)) || ((((s >> (ncount - 1)) & 1) == 0) && (((e >> (ncount - 1)) & 1) == 1)))) {break;} ncount--; }if ( (ncount >= 0)) {return ((long)Math.pow(2,ncount) - 1);} else {return 0;}} }
2	public class D{ BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; String toStr( long a){ String s = Long.toBinaryString(a); while((s.length() < 64))s = ("0" + s); return s;} void solve()throws IOException { long a = nextLong();  long b = nextLong();  String sa = toStr(a);  String sb = toStr(b);  int i = 0; while(((i < 64) && (sa.charAt(i) == sb.charAt(i))))i++; int left = (64 - i); out.println(((1L << left) - 1)); } D()throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.close(); } public static void main( String[] args)throws IOException { new D(); } String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ eof = true; return null;} }return st.nextToken();} long nextLong()throws IOException { return Long.parseLong(nextToken());} }
3	public class Main{ public static void main( String[] args){ FastScanner sc = new FastScanner();  PrintWriter pw = new PrintWriter(System.out);  double eps = 1e-12; while(sc.hasNext()){ int n = sc.nextInt();  int r = sc.nextInt();  double[] shu = new double[n]; for ( int i = 0;(i < n);i++) shu[i] = sc.nextDouble(); double[] res = new double[n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < i);j++) { double temp = Math.abs((shu[i] - shu[j])); if ( ((temp < (2 * r)) || (Math.abs((temp - (2 * r))) < eps))) {res[i] = Math.max(res[i],(res[j] + Math.sqrt((((4 * r) * r) - (temp * temp))))); } }res[i] = Math.max(res[i],r); }for ( int i = 0;(i < n);i++) {pw.print((res[i] + " ")); }pw.flush(); }} } class FastScanner{ BufferedReader br ; StringTokenizer st ; FastScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); } String nextLine(){ String s = ""; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } return s;} boolean hasNext(){ String s = ""; while(!st.hasMoreTokens()){s = nextLine(); if ( (s == null)) return false; st = new StringTokenizer(s); }return true;} String next(){ String s = ""; while(!st.hasMoreTokens()){s = nextLine(); st = new StringTokenizer(s); }return st.nextToken();} int nextInt(){ return Integer.valueOf(next());} double nextDouble(){ return Double.valueOf(next());} }
3	public class Main{ static PrintWriter out ; static InputReader ir ; static void solve(){ int n = ir.nextInt();  int r = ir.nextInt();  int[] x = ir.nextIntArray(n);  double[] ret = new double[n]; for ( int i = 0;(i < n);i++) { double ma = r; for ( int j = 0;(j < i);j++) {if ( (Math.abs((x[i] - x[j])) <= (2 * r))) {ma = Math.max(ma,(ret[j] + Math.sqrt(((4 * (double)Math.pow(r,2)) - Math.pow((x[i] - x[j]),2))))); } }ret[i] = ma; }for ( int i = 0;(i < n);i++) {out.print((ret[i] + ((i == (n - 1))?"\n":" "))); }} public static void main( String[] args)throws Exception { ir = new InputReader(System.in); out = new PrintWriter(System.out); solve(); out.flush(); } static class InputReader{ private InputStream in ; private byte[] buffer = new byte[1024]; private int curbuf ; private int lenbuf ; public InputReader( InputStream in){ this.in = in; this.curbuf = this.lenbuf = 0; } public boolean hasNextByte(){ if ( (curbuf >= lenbuf)) {curbuf = 0; try{lenbuf = in.read(buffer); }catch (IOException e){ throw (new InputMismatchException());} if ( (lenbuf <= 0)) return false; } return true;} private int readByte(){ if ( hasNextByte()) return buffer[curbuf++]; else return -1;} private boolean isSpaceChar( int c){ return ((c >= 33) && (c <= 126));} private void skip(){ while((hasNextByte() && isSpaceChar(buffer[curbuf])))curbuf++; } public boolean hasNext(){ skip(); return hasNextByte();} public String next(){ if ( !hasNext()) throw (new NoSuchElementException()); StringBuilder sb = new StringBuilder();  int b = readByte(); while(!isSpaceChar(b)){sb.appendCodePoint(b); b = readByte(); }return sb.toString();} public int nextInt(){ if ( !hasNext()) throw (new NoSuchElementException()); int c = readByte(); while(isSpaceChar(c))c = readByte(); boolean minus = false; if ( (c == '-')) {minus = true; c = readByte(); } int res = 0; do {if ( ((c < '0') || (c > '9'))) throw (new InputMismatchException()); res = (((res * 10) + c) - '0'); c = readByte(); }while(!isSpaceChar(c));return (minus?-res:res);} public long nextLong(){ if ( !hasNext()) throw (new NoSuchElementException()); int c = readByte(); while(isSpaceChar(c))c = readByte(); boolean minus = false; if ( (c == '-')) {minus = true; c = readByte(); } long res = 0; do {if ( ((c < '0') || (c > '9'))) throw (new InputMismatchException()); res = (((res * 10) + c) - '0'); c = readByte(); }while(!isSpaceChar(c));return (minus?-res:res);} public int[] nextIntArray( int n){ int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = nextInt(); return a;} } }
5	public class pr988B{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  int n = Integer.parseInt(br.readLine());  ArrayList<String> a = new ArrayList<>(); for ( int i = 0;(i < n);i++) {a.add(br.readLine()); }if ( solve(n,a)) {out.println("YES"); for ( String s :a) {out.println(s); }} else out.println("NO"); out.flush(); out.close(); } static private boolean solve( int n, ArrayList<String> a){ a.sort(Comparator.comparingInt(String::length)); for ( int i = 0;(i < (n - 1));i++) {if ( !a.get((i + 1)).contains(a.get(i))) return false; }return true;} }
2	public class TaskB_AF{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB_cf371 solver = new TaskB_cf371(); solver.solve(1,in,out); out.close(); } static class TaskB_cf371{ List<Rectangle> rects ; public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  int xLeft = 1,xRight = n;  int xSeparate = -1; while((xLeft <= xRight)){ int e = ((xLeft + xRight) / 2);  int t = makeRequest(in,out,1,1,e,n); if ( (t == 1)) {xSeparate = e; xRight = (e - 1); } else if ( (t == 0)) {xLeft = (e + 1); } else {xRight = (e - 1); }}rects = new ArrayList<Rectangle>(); if ( ((xSeparate != -1) && (makeRequest(in,out,(xSeparate + 1),1,n,n) == 1))) {detectRectangle(in,out,1,1,xSeparate,n); detectRectangle(in,out,(xSeparate + 1),1,n,n); out.print("! "); for ( Rectangle r :rects) {out.print((r.toString() + " ")); }out.println(); out.flush(); return ;} int yLeft = 1,yRight = n;  int ySeparate = -1; while((yLeft <= yRight)){ int e = ((yLeft + yRight) / 2);  int t = makeRequest(in,out,1,1,n,e); if ( (t == 1)) {ySeparate = e; yRight = (e - 1); } else if ( (t == 0)) {yLeft = (e + 1); } else {yRight = (e - 1); }}if ( (ySeparate != -1)) {detectRectangle(in,out,1,1,n,ySeparate); detectRectangle(in,out,1,(ySeparate + 1),n,n); out.print("! "); for ( Rectangle r :rects) {out.print((r.toString() + " ")); }out.println(); out.flush(); return ;} throw (new AssertionError("!"));} private void detectRectangle( InputReader in, PrintWriter out, int xMin, int yMin, int xMax, int yMax){ int xLeft = -1,xRight = -1,yLeft = -1,yRight = -1;  int left = xMin,right = xMax; while((left <= right)){ int e = ((left + right) / 2); if ( (makeRequest(in,out,xMin,yMin,e,yMax) == 1)) {xRight = e; right = (e - 1); } else {left = (e + 1); }}left = xMin; right = xRight; while((left <= right)){ int e = ((left + right) / 2); if ( (makeRequest(in,out,e,yMin,xRight,yMax) == 1)) {xLeft = e; left = (e + 1); } else {right = (e - 1); }}left = yMin; right = yMax; while((left <= right)){ int e = ((left + right) / 2); if ( (makeRequest(in,out,xLeft,yMin,xRight,e) == 1)) {yRight = e; right = (e - 1); } else {left = (e + 1); }}left = yMin; right = yRight; while((left <= right)){ int e = ((left + right) / 2); if ( (makeRequest(in,out,xLeft,e,xRight,yRight) == 1)) {yLeft = e; left = (e + 1); } else {right = (e - 1); }}rects.add(new Rectangle(xLeft,yLeft,xRight,yRight)); } private int makeRequest( InputReader in, PrintWriter out, int x1, int y1, int x2, int y2){ out.print(((((((("? " + x1) + " ") + y1) + " ") + x2) + " ") + y2)); out.println(); out.flush(); return in.nextInt();} class Rectangle{ int x1 ; int x2 ; int y1 ; int y2 ; public Rectangle( int x1, int y1, int x2, int y2){ this.x1 = x1; this.x2 = x2; this.y1 = y1; this.y2 = y2; } public String toString(){ StringBuilder b = new StringBuilder(""); b.append(x1).append(' '); b.append(y1).append(' '); b.append(x2).append(' '); b.append(y2); return b.toString();} } } static class InputReader{ private BufferedReader reader ; private StringTokenizer stt ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); } public String nextLine(){ try{return reader.readLine(); }catch (IOException e){ return null;} } public String nextString(){ while(((stt == null) || !stt.hasMoreTokens())){stt = new StringTokenizer(nextLine()); }return stt.nextToken();} public int nextInt(){ return Integer.parseInt(nextString());} } }
5	public class A{ final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null); BufferedReader in ; PrintWriter out ; StringTokenizer tok = new StringTokenizer(""); void solve()throws IOException { int n = readInt();  long k = readInt();  Long[] a = new Long[n]; for ( int i = 0;(i < n);i++) {a[i] = readLong(); }Arrays.sort(a); TreeSet<Long> set = new TreeSet<Long>(); for ( int i = 0;(i < n);i++) {set.add(a[i]); }if ( (k == 1)) {out.println(n); return ;} int res = 0;  TreeSet<Long> used = new TreeSet<Long>(); for ( Long cur :set) {if ( !used.contains(cur)) { int num = 1; used.add(cur); Long temp = (cur * 1); while(true){if ( set.contains((k * temp))) {num++; used.add((k * temp)); temp *= k; } else {res += ((num + 1) / 2); break;}}} }out.println(res); } void init()throws FileNotFoundException { 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());} long readLong()throws IOException { return Long.parseLong(readString());} public static void main( String[] args){ new A().run(); } 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); } } }
5	public class TaskA implements Runnable{ long m = ((int)1e9 + 7); PrintWriter w ; InputReader c ; static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} public int[] scanArrayI( int n){ int a[] = new int[n]; for ( int i = 0;(i < n);i++) a[i] = c.nextInt(); return a;} 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 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 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 interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } public static void main( String[] args)throws Exception { new Thread(null,new TaskA(),"TaskA",(1 << 26)).start(); } }
2	public class A{ static private final long MOD = 1000000009; public static void main( String[] args){ InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  long n = in.nextInt();  long correct = in.nextInt();  long k = in.nextInt();  long wrong = (n - correct);  long set = (((wrong * k) + k) - 1); if ( (set >= n)) {out.println(correct); } else { long needExtraCorrect = (n - (((wrong * k) + k) - 1));  long firstSet = ((needExtraCorrect + k) - 1);  long otherSet = (correct - firstSet);  long firstDouble = (firstSet / k); otherSet += (firstSet % k); long[][] mat = new long[][]{{2,(2 * k)},{0,1}};  long[][] A = pow(mat,firstDouble,MOD);  long score = ((A[0][1] + otherSet) % MOD); out.println(score); }out.flush(); } public static long[][] pow( long[][] a, long n, long mod){ long i = 1;  long[][] res = E(a.length);  long[][] ap = mul(E(a.length),a,mod); while((i <= n)){if ( ((n & i) >= 1)) {res = mul(res,ap,mod); } i *= 2; ap = mul(ap,ap,mod); }return res;} public static long[][] E( int n){ long[][] a = new long[n][n]; for ( int i = 0;(i < n);i++) {a[i][i] = 1; }return a;} public static long[][] mul( long[][] a, long[][] b, long mod){ long[][] c = new long[a.length][b[0].length]; if ( (a[0].length != b.length)) {System.err.print("err"); } for ( int i = 0;(i < a.length);i++) {for ( int j = 0;(j < b[0].length);j++) { long sum = 0; for ( int k = 0;(k < a[0].length);k++) {sum = ((sum + (a[i][k] * b[k][j])) % mod); }c[i][j] = sum; }}return c;} static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int next(){ 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 nextInt(){ int c = next(); while(isSpaceChar(c))c = next(); int sgn = 1; if ( (c == '-')) {sgn = -1; c = next(); } int res = 0; do {if ( ((c < '0') || (c > '9'))) throw (new InputMismatchException()); res *= 10; res += (c - '0'); c = next(); }while(!isSpaceChar(c));return (res * sgn);} public boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } }
6	public class P16E{ int n ; double[][] prob ; double[] dp ; public P16E(){ Scanner sc = new Scanner(System.in); n = sc.nextInt(); prob = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {prob[i][j] = sc.nextDouble(); }}sc.close(); dp = new double[(1 << n)]; Arrays.fill(dp,-1); for ( int i = 0;(i < n);i++) { int a = (1 << i); System.out.print((compute(a) + " ")); }} double compute( int mask){ if ( (mask == ((1 << n) - 1))) {return 1;} if ( (dp[mask] != -1)) {return dp[mask];} double result = 0;  int c = 0; for ( int i = 0;(i < n);i++) { int a = (1 << i); if ( ((a & mask) != 0)) {c++; for ( int j = 0;(j < n);j++) { int b = (1 << j); if ( ((b & mask) == 0)) {result += (prob[i][j] * compute((mask | b))); } }} } int nC2 = (((c + 1) * c) / 2); dp[mask] = (result / nC2); return dp[mask];} public static void main( String[] args){ new P16E(); } }
6	public class ProblemD{ private double survive( int round, int set){ if ( (sur[round][set] >= 0)) return sur[round][set]; double res = 0.0;  int count = 0; for ( int i = 0;(i < n);i++) {if ( ((set & (1 << i)) > 0)) { double res2 = 0.0; for ( int j = 0;(j < n);j++) if ( ((set & (1 << j)) == 0)) {res2 += (survive((round - 1),(set + (1 << j))) * a[i][j]); count++; } res += res2; } }count = ((((n - round) + 1) * (n - round)) / 2); sur[round][set] = (res / count); return sur[round][set];} int n ; double[][] a ,sur ; public void solve(){ boolean oj = true; try{ Reader reader = (oj?new InputStreamReader(System.in):new FileReader("inputD.txt"));  Writer writer = (oj?new OutputStreamWriter(System.out):new FileWriter("outputD.txt"));  BufferedReader br = new BufferedReader(reader);  PrintWriter out = new PrintWriter(writer);  MyTokenizer tok = new MyTokenizer(br.readLine()); n = (int)tok.getNum(); a = new double[n][n]; int all = ((1 << n) - 1); sur = new double[n][(all + 1)]; for ( int i = 0;(i < n);i++) {tok = new MyTokenizer(br.readLine()); for ( int j = 0;(j < n);j++) {a[i][j] = tok.getNum(); }for ( int j = 0;(j <= all);j++) sur[i][j] = -1; } DecimalFormat format = new DecimalFormat("0.000000"); sur[0][all] = 1; double[] res = new double[n]; for ( int i = 0;(i < n);i++) {res[i] = survive((n - 1),(1 << i)); String sres = format.format(res[i]).replace(',','.'); out.printf("%s ",sres); }br.close(); out.close(); reader.close(); writer.close(); }catch (Exception ex){ ex.printStackTrace(); } } public static void main( String[] args){ ProblemD f = new ProblemD(); f.solve(); } private class MyTokenizer{ private String s ; private int cur ; public MyTokenizer( String s){ this.s = s; cur = 0; } public void skip(){ while(((cur < s.length()) && ((s.charAt(cur) == ' ') || (s.charAt(cur) == '\n')))){cur++; }} public double getNum(){ skip(); String snum = ""; while(((cur < s.length()) && (((s.charAt(cur) >= '0') && (s.charAt(cur) <= '9')) || (s.charAt(cur) == '.')))){snum += s.charAt(cur); cur++; }return Double.valueOf(snum);} } }
6	public class Main implements Runnable{ final String filename = ""; public int nextPerm( int[] a, int k){ if ( (a[0] == k)) return -1; int last = 0; for ( int i = (a.length - 1);(i >= 0);i--) if ( (a[i] != 0)) {last = i; break;} int mem = a[last]; a[(last - 1)]++; a[last] = 0; a[(a.length - 1)] = (mem - 1); return 0;} public double poss( int A, int[][] sen, int[] rasp){ int n = sen.length;  double[] possluck = new double[n]; for ( int i = 0;(i < n);i++) possluck[i] = (Math.min(100,(sen[i][1] + (rasp[i] * 10))) / 100.0); double poss = 0; for ( int i = 0;(i < (1 << n));i++) { int kol = 0; for ( int j = 0;(j < n);j++) if ( (((i % (1 << (j + 1))) / (1 << j)) == 1)) kol++;  double thisposs = 1; for ( int j = 0;(j < n);j++) if ( (((i % (1 << (j + 1))) / (1 << j)) == 1)) thisposs *= possluck[j]; else thisposs *= (1 - possluck[j]); if ( (kol > (n / 2))) poss += thisposs; else { double lvl = 0; for ( int j = 0;(j < n);j++) if ( (((i % (1 << (j + 1))) / (1 << j)) == 0)) lvl += sen[j][0]; poss += (thisposs * (A / (A + lvl))); }}return poss;} public void solve()throws Exception { int n = iread(),k = iread(),A = iread();  int[][] sen = new int[n][2]; for ( int i = 0;(i < n);i++) {sen[i][0] = iread(); sen[i][1] = iread(); } double maxposs = 0;  int[] rasp = new int[n]; rasp[(n - 1)] = k; maxposs = Math.max(maxposs,poss(A,sen,rasp)); while((nextPerm(rasp,k) == 0))maxposs = Math.max(maxposs,poss(A,sen,rasp)); out.write((maxposs + "\n")); } public int iread()throws Exception { return Integer.parseInt(readword());} BufferedReader in ; BufferedWriter out ; public String readword()throws IOException { StringBuilder b = new StringBuilder();  int c ; c = in.read(); while(((c >= 0) && (c <= ' ')))c = in.read(); if ( (c < 0)) return ""; while((c > ' ')){b.append((char)c); c = in.read(); }return b.toString();} public static void main( String[] args){ try{Locale.setDefault(Locale.US); }catch (Exception e){ } new Thread(null,new Main(),"1",(1 << 25)).start(); } }
6	public class B{ Scanner in ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni();  int k = ni();  int a = ni();  int[] lv = new int[n];  int[] lo = new int[n]; for ( int i = 0;(i < n);i++) {lv[i] = ni(); lo[i] = ni(); }out.printf("%.9f",rec(lv,lo,n,0,k,a)); } double rec( int[] lv, int[] lo, int n, int pos, int k, int a){ if ( (pos == n)) { int h = ((n / 2) + 1);  double gp = 0; for ( int i = 0;(i < (1 << n));i++) {if ( (Integer.bitCount(i) >= h)) { double p = 1.0; for ( int j = 0;(j < n);j++) {if ( ((i << (31 - j)) < 0)) {p *= ((double)lo[j] / 100); } else {p *= ((double)(100 - lo[j]) / 100); }}gp += p; } else { double p = 1.0;  int sl = 0; for ( int j = 0;(j < n);j++) {if ( ((i << (31 - j)) < 0)) {p *= ((double)lo[j] / 100); } else {p *= ((double)(100 - lo[j]) / 100); sl += lv[j]; }}gp += ((p * a) / (a + sl)); }}return gp;} else { int o = lo[pos];  double max = 0; for ( int i = 0;((i <= k) && (lo[pos] <= 100));i++) {max = Math.max(max,rec(lv,lo,n,(pos + 1),(k - i),a)); lo[pos] += 10; }lo[pos] = o; return max;}} void run()throws Exception { in = (oj?new Scanner(System.in):new Scanner(INPUT)); 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 B().run(); } int ni(){ return Integer.parseInt(in.next());} boolean oj = (System.getProperty("ONLINE_JUDGE") != null); void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
0	public class TwentyFive{ public static void main( String[] args){ System.out.println("25"); } }
0	public class a{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int N = sc.nextInt(); solve(N); } static void solve( int a){ if ( (((a - 8) % 3) == 0)) {System.out.println(((8 + " ") + (a - 8))); return ;} if ( (((a - 4) % 3) == 0)) {System.out.println(((4 + " ") + (a - 4))); return ;} if ( (((a - 6) % 3) == 0)) {System.out.println(((6 + " ") + (a - 6))); return ;} } }
0	public class A{ public static void main( String[] args){ try(Scanner sc=new Scanner(System.in)){System.out.println(25); }} public static class Scanner implements Closeable{ private BufferedReader br ; private StringTokenizer tok ; public Scanner( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); } private void getLine(){ try{while(!hasNext()){tok = new StringTokenizer(br.readLine()); } }catch (IOException e){ } } private boolean hasNext(){ return ((tok != null) && tok.hasMoreTokens());} public String next(){ getLine(); return tok.nextToken();} public void close(){ try{br.close(); }catch (IOException e){ } } } }
3	public class utkarsh{ InputStream is ; PrintWriter out ; double x[] ,y[] ,R ; boolean game( double x1, double y1, double x2, double y2){ double dis = (((x1 - x2) * (x1 - x2)) + ((y1 - y2) * (y1 - y2))); return (dis <= ((4.0 * R) * R));} void play( int n){ double l ,r ,m ;  double a[] = new double[n]; for ( int i = 0;(i < n);i++) {l = 0.0; r = 1000000.0; for ( int j = 0;(j < 50);j++) {m = ((l + r) / 2); if ( game(x[i],0,x[n],m)) l = m; else r = m; }a[i] = l; }for ( int i = 0;(i < n);i++) {if ( ((a[i] > 0.0) && ((y[i] + a[i]) > y[n]))) y[n] = (y[i] + a[i]); }} void solve(){ int i ,j ,n ; n = ni(); R = nd(); x = new double[n]; y = new double[n]; for ( i = 0;(i < n);i++) x[i] = nd(); for ( i = 0;(i < n);i++) {play(i); }for ( i = 0;(i < n);i++) out.print(((R + y[i]) + " ")); } public static void main( String[] args){ new utkarsh().run(); } void run(){ is = System.in; out = new PrintWriter(System.out); solve(); out.flush(); } byte input[] = new byte[1024]; int len = 0,ptr = 0; int readByte(){ if ( (ptr >= len)) {ptr = 0; try{len = is.read(input); }catch (IOException e){ throw (new InputMismatchException());} if ( (len <= 0)) {return -1;} } return input[ptr++];} boolean isSpaceChar( int c){ return ((c >= 33) && (c <= 126));} int skip(){ int b = readByte(); while(((b != -1) && isSpaceChar(b))){b = readByte(); }return b;} String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(b)){sb.appendCodePoint(b); b = readByte(); }return sb.toString();} int ni(){ int n = 0,b = readByte();  boolean minus = false; while(((b != -1) && (((b >= '0') && (b <= '9')) || (b == '-')))){b = readByte(); }if ( (b == '-')) {minus = true; b = readByte(); } if ( (b == -1)) {return -1;} while(((b >= '0') && (b <= '9'))){n = ((n * 10) + (b - '0')); b = readByte(); }return (minus?-n:n);} double nd(){ return Double.parseDouble(ns());} char[] ns( int n){ char c[] = new char[n];  int i ,b = skip(); for ( i = 0;(i < n);i++) {if ( isSpaceChar(b)) {break;} c[i] = (char)b; b = readByte(); }return ((i == n)?c:Arrays.copyOf(c,i));} }
2	public class TaskD{ boolean eof ; BufferedReader br ; StringTokenizer st ; PrintWriter out ; public static void main( String[] args)throws IOException { new TaskD().run(); } public String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ eof = true; return "-1";} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(nextToken());} public long nextLong(){ return Long.parseLong(nextToken());} void run()throws IOException { InputStream input = System.in;  PrintStream output = System.out; try{ File f = new File("a.in"); if ( (f.exists() && f.canRead())) {input = new FileInputStream(f); output = new PrintStream("a.out"); } }catch (Throwable e){ } br = new BufferedReader(new InputStreamReader(input)); out = new PrintWriter(output); solve(); br.close(); out.close(); } void solve(){ int t = nextInt();  long n ,k ;  int m = 34;  long[] res = new long[m]; res[1] = 0; res[2] = 1; for ( int i = 3;(i < m);i++) {res[i] = (res[(i - 1)] * 4L); } long[] l = new long[m];  long[] r = new long[m]; l[0] = 0; l[1] = 1; r[0] = 0; r[1] = 1; for ( int i = 2;(i < m);i++) {l[i] = ((l[(i - 1)] * 2) + 1); r[i] = (r[(i - 1)] * 4); } long[] mi = new long[m];  long[] ma = new long[m]; for ( int i = 1;(i < m);i++) {mi[i] = (mi[(i - 1)] + l[i]); ma[i] = (ma[(i - 1)] + r[i]); }for ( int i = 0;(i < t);i++) {n = nextLong(); k = nextLong(); if ( (n >= 32)) {out.println(("YES " + (n - 1))); } else {if ( (k > ma[(int)n])) {out.println("NO"); } else {for ( int j = 0;(j <= n);j++) {if ( ((mi[((int)n - j)] <= k) && ((ma[(int)n] - (l[(((int)n - j) + 1)] * ma[j])) >= k))) {out.println(("YES " + j)); break;} if ( (j == (n - 1))) {out.println("NO"); } }}}}} }
6	public class Main{ public static void main( String[] args)throws Exception { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); int n = nextInt();  double[][] a = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {a[i][j] = nextDouble(); }} double[] dp = new double[(1 << n)]; dp[((1 << n) - 1)] = 1.0; for ( int mask = ((1 << n) - 2);(mask > 0);mask--) { int count = Integer.bitCount(mask);  double pPair = (2.0 / (count * (count + 1)));  double ans = 0.0; for ( int i = 0;(i < n);i++) {if ( (((1 << i) & mask) == 0)) { double p = dp[((1 << i) | mask)];  double s = 0.0; for ( int j = 0;(j < n);j++) {if ( (((1 << j) & mask) != 0)) s += a[j][i]; }ans += ((pPair * p) * s); } }dp[mask] = ans; }for ( int i = 0;(i < n);i++) {out.print(dp[(1 << i)]); out.print(' '); }in.close(); out.close(); } static StringTokenizer st ; static BufferedReader in ; static PrintWriter out ; static int nextInt()throws IOException { return Integer.parseInt(nextString());} static double nextDouble()throws IOException { return Double.parseDouble(nextString());} static String nextString()throws IOException { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(in.readLine()); }return st.nextToken();} }
6	public class CF1238E extends PrintWriter{ CF1238E(){ super(System.out,true); } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1238E o = new CF1238E(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; void main(){ int n = sc.nextInt();  int m = sc.nextInt();  byte[] cc = sc.next().getBytes();  int[] kk = new int[(1 << m)]; for ( int i = 1;(i < n);i++) { int a = (cc[(i - 1)] - 'a');  int b = (cc[i] - 'a'); kk[((1 << a) | (1 << b))]++; }for ( int h = 0;(h < m);h++) for ( int b = 0;(b < (1 << m));b++) if ( ((b & (1 << h)) == 0)) kk[(b | (1 << h))] += kk[b];  int[] dp = new int[(1 << m)];  int m_ = ((1 << m) - 1); for ( int b = 1;(b < (1 << m));b++) { int k = (((n - 1) - kk[b]) - kk[(m_ ^ b)]);  int x = INF; for ( int h = 0;(h < m);h++) if ( ((b & (1 << h)) != 0)) { int b_ = (b ^ (1 << h)); x = Math.min(x,dp[b_]); } dp[b] = ((x == INF)?INF:(x + k)); }println(dp[m_]); } }
3	public class P1196D2{ static boolean multipleIndependent = true; void run(){ int n = in.nextInt();  int k = in.nextInt();  char[] s = in.next().toCharArray();  int[] dp = new int[3];  char[] c = {'R','G','B'};  int min = Integer.MAX_VALUE; for ( int i = 0;(i < k);i++) {dp[0] += ((s[i] == c[((i + 0) % 3)])?0:1); dp[1] += ((s[i] == c[((i + 1) % 3)])?0:1); dp[2] += ((s[i] == c[((i + 2) % 3)])?0:1); }min = Math.min(Math.min(Math.min(dp[0],dp[1]),dp[2]),min); for ( int i = k;(i < n);i++) {dp[0] += (((s[i] == c[((i + 0) % 3)])?0:1) - ((s[(i - k)] == c[(((i - k) + 0) % 3)])?0:1)); dp[1] += (((s[i] == c[((i + 1) % 3)])?0:1) - ((s[(i - k)] == c[(((i - k) + 1) % 3)])?0:1)); dp[2] += (((s[i] == c[((i + 2) % 3)])?0:1) - ((s[(i - k)] == c[(((i - k) + 2) % 3)])?0:1)); min = Math.min(Math.min(Math.min(dp[0],dp[1]),dp[2]),min); }System.out.println(min); } static InputReader in = new InputReader(System.in); public static void main( String[] args){ P1196D2 p = new P1196D2();  int q = (multipleIndependent?in.nextInt():1); while((q-- > 0)){p.run(); }} <R> long binarySearch( long lowerBound, long upperBound, R value, Function<Long,R> generatorFunction, Comparator<R> comparator){ if ( (lowerBound <= upperBound)) { long mid = ((lowerBound + upperBound) / 2);  int compare = comparator.compare(generatorFunction.apply(mid),value); if ( (compare == 0)) {return mid;} else if ( (compare < 0)) {return binarySearch((mid + 1),upperBound,value,generatorFunction,comparator);} else {return binarySearch(lowerBound,(mid - 1),value,generatorFunction,comparator);}} else {return -1;}} void reorder( Integer[] indices, Object[] arr){ if ( (indices.length != arr.length)) {throw (new RuntimeException("Arrays must have equals lengths"));} int n = arr.length;  Object[] copy = new Object[n]; for ( int i = 0;(i < n);i++) {copy[i] = arr[indices[i]]; }System.arraycopy(copy,0,arr,0,n); } int prodMod( int a, int b, int mod){ return (int)(((long)a * b) % mod);} long prodMod( long a, long b, long mod){ long res = 0; a %= mod; b %= mod; while((b > 0)){if ( ((b & 1) > 0)) {res = ((res + a) % mod); } a = ((a << 1) % mod); b >>= 1; }return res;} long sumMod( int[] b, long mod){ long res = 0; for ( int i = 0;(i < b.length);i++) {res = ((res + (b[i] % mod)) % mod); }return res;} long sumMod( long[] a, long mod){ long res = 0; for ( int i = 0;(i < a.length);i++) {res = ((res + (a[i] % mod)) % mod); }return res;} int[] toPrimitive( Integer[] arr){ int[] res = new int[arr.length]; for ( int i = 0;(i < arr.length);i++) {res[i] = arr[i]; }return res;} int[][] toPrimitive( Integer[][] arr){ int[][] res = new int[arr.length][]; for ( int i = 0;(i < arr.length);i++) {res[i] = toPrimitive(arr[i]); }return res;} long[] toPrimitive( Long[] arr){ long[] res = new long[arr.length]; for ( int i = 0;(i < arr.length);i++) {res[i] = arr[i]; }return res;} long[][] toPrimitive( Long[][] arr){ long[][] res = new long[arr.length][]; for ( int i = 0;(i < arr.length);i++) {res[i] = toPrimitive(arr[i]); }return res;} Integer[] toWrapper( int[] arr){ Integer[] res = new Integer[arr.length]; for ( int i = 0;(i < arr.length);i++) {res[i] = arr[i]; }return res;} Integer[][] toWrapper( int[][] arr){ Integer[][] res = new Integer[arr.length][]; for ( int i = 0;(i < arr.length);i++) {res[i] = toWrapper(arr[i]); }return res;} Long[] toWrapper( long[] arr){ Long[] res = new Long[arr.length]; for ( int i = 0;(i < arr.length);i++) {res[i] = arr[i]; }return res;} Long[][] toWrapper( long[][] arr){ Long[][] res = new Long[arr.length][]; for ( int i = 0;(i < arr.length);i++) {res[i] = toWrapper(arr[i]); }return res;} 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());} public long nextLong(){ return Long.parseLong(next());} public int[] nextIntArray( int n){ int[] arr = new int[n]; for ( int i = 0;(i < n);i++) {arr[i] = nextInt(); }return arr;} public <T> T[] nextIntArray( int n, Function<Integer,T> function, Class<T> c){ T[] arr = (T[])Array.newInstance(c,n); for ( int i = 0;(i < n);i++) {arr[i] = function.apply(nextInt()); }return arr;} public long[] nextLongArray( int n){ long[] arr = new long[n]; for ( int i = 0;(i < n);i++) {arr[i] = nextLong(); }return arr;} public <T> T[] nextLongArray( int n, Function<Long,T> function, Class<T> c){ T[] arr = (T[])Array.newInstance(c,n); for ( int i = 0;(i < n);i++) {arr[i] = function.apply(nextLong()); }return arr;} public <T> T read( Class<T> c){ throw (new UnsupportedOperationException("To be implemented"));} } }
2	public class Div1_503B{ 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)));  int N = Integer.parseInt(reader.readLine()); printer.println("? 1"); printer.flush(); int v1 = Integer.parseInt(reader.readLine()); printer.println(("? " + (1 + (N / 2)))); printer.flush(); int v2 = Integer.parseInt(reader.readLine()); if ( (((v1 + v2) % 2) != 0)) {printer.println("! -1"); printer.close(); return ;} if ( (v1 == v2)) {printer.println("! 1"); printer.close(); return ;} boolean less = (v1 < v2);  int low = 1;  int high = (1 + (N / 2)); while((low != high)){ int mid = ((low + high) >> 1); printer.println(("? " + mid)); printer.flush(); int r1 = Integer.parseInt(reader.readLine());  int q2 = (mid + (N / 2)); if ( (q2 > N)) {q2 -= N; } printer.println(("? " + q2)); printer.flush(); int r2 = Integer.parseInt(reader.readLine()); if ( (r1 == r2)) {printer.println(("! " + mid)); printer.close(); return ;} if ( ((r1 < r2) == less)) {low = (mid + 1); } else {high = (mid - 1); }}printer.println(("! " + low)); printer.close(); return ;} }
5	public class Main{ public static void main( String[] args)throws Exception { Parserdoubt3 s = new Parserdoubt3(System.in);  int n = s.nextInt();  long k = s.nextInt();  Long a[] = new Long[n];  TreeSet<Long> tree = new TreeSet<Long>(); for ( int i = 0;(i < a.length);i++) {a[i] = s.nextLong(); tree.add(a[i]); }Arrays.sort(a); int ans = 0; for ( int i = 0;(i < a.length);i++) {if ( tree.contains(a[i])) {ans++; long next = (a[i] * k); if ( tree.contains(next)) tree.remove(next); } }System.out.println(ans); } } class Parserdoubt3{ private final int BUFFER_SIZE = (1 << 17); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ,bytesRead ; public Parserdoubt3( InputStream in){ din = new DataInputStream(in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public int nextInt()throws Exception { int ret = 0;  byte c = read(); while((c <= ' '))c = read(); boolean neg = (c == '-'); if ( neg) c = read(); do {ret = (((ret * 10) + c) - '0'); c = read(); }while((c > ' '));if ( neg) return -ret; return ret;} public long nextLong()throws Exception { long ret = 0;  byte c = read(); while((c <= ' '))c = read(); boolean neg = (c == '-'); if ( neg) c = read(); do {ret = (((ret * 10) + c) - '0'); c = read(); }while((c > ' '));if ( neg) return -ret; return ret;} private void fillBuffer()throws Exception { bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) buffer[0] = -1; } private byte read()throws Exception { if ( (bufferPointer == bytesRead)) fillBuffer(); return buffer[bufferPointer++];} }
0	public class A{ private BufferedReader in ; private StringTokenizer st ; void solve()throws IOException { int n = nextInt(); System.out.println(((3 * n) / 2)); } A()throws IOException{ in = new BufferedReader(new InputStreamReader(System.in)); eat(""); solve(); } private void eat( String str){ st = new StringTokenizer(str); } String next()throws IOException { while(!st.hasMoreTokens()){ String line = in.readLine(); if ( (line == null)) {return null;} eat(line); }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} public static void main( String[] args)throws IOException { new A(); } int gcd( int a, int b){ if ( (b > a)) return gcd(b,a); if ( (b == 0)) return a; return gcd(b,(a % b));} }
0	public class Main{ public static void main( String[] args){ Scanner input = new Scanner(System.in);  int n = input.nextInt(); System.out.println(((n * 6) / 4)); } }
4	public class Main{ public static void main( String[] args)throws IOException { InputStreamReader in = new InputStreamReader(System.in);  BufferedReader br = new BufferedReader(in);  int t = Integer.parseInt(br.readLine());  int A = 10000000;  int[] convert = new int[(A + 1)]; for ( int a = 1;(a <= A);a++) {convert[a] = a; }for ( int a = 2;(a <= (A / a));a++) { int sq = (a * a); for ( int b = sq;(b <= A);b += sq) {while(((convert[b] % sq) == 0)){convert[b] /= sq; }}} int[] prevIndex = new int[(A + 1)]; for ( int i = 0;(i <= A);i++) {prevIndex[i] = -1; }for ( int c = 0;(c < t);c++) { StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int k = Integer.parseInt(st.nextToken());  int[] a = new int[n];  int maxA = 0; st = new StringTokenizer(br.readLine()); for ( int i = 0;(i < n);i++) {a[i] = convert[Integer.parseInt(st.nextToken())]; maxA = Math.max(maxA,a[i]); } int[] partitions = new int[(k + 1)];  int[] partIndex = new int[(k + 1)]; for ( int i = 0;(i < n);i++) { int cur = a[i]; for ( int j = k;(j >= 0);j--) {if ( (prevIndex[cur] >= partIndex[j])) {partitions[j]++; partIndex[j] = i; } if ( ((j > 0) && ((partitions[(j - 1)] < partitions[j]) || ((partitions[(j - 1)] == partitions[j]) && (partIndex[(j - 1)] > partIndex[j]))))) {partitions[j] = partitions[(j - 1)]; partIndex[j] = partIndex[(j - 1)]; } }prevIndex[cur] = i; }System.out.println((partitions[k] + 1)); for ( int i = 0;(i < n);i++) { int cur = a[i]; prevIndex[cur] = -1; }}} }
6	public class Fish{ static double[][] prob = new double[18][18]; static double[][] dp = new double[2][(1 << 18)]; static ArrayList<Integer>[] adj = new ArrayList[(1 << 18)]; static int n ; public static void init(){ for ( int i = 0;(i < (1 << 18));i++) adj[i] = new ArrayList<Integer>(); for ( int i = 0;(i < (1 << 18));i++) for ( int j = 0;(j < 18);j++) if ( (((i >> j) & 1) == 1)) adj[i].add((i ^ (1 << j))); } public static double value( int cur, int next){ int i = 0;  int z = (cur ^ next);  double p = 0;  int alive = Integer.bitCount(cur); while(((z >> i) != 1))i++; for ( int k = 0;(k < n);k++) if ( (((next >> k) & 1) == 1)) p += prob[k][i]; p /= ((alive * (alive - 1)) / 2); return p;} public static void main( String[] args)throws Exception { Scanner scan = new Scanner(System.in); init(); n = scan.nextInt(); int m = ((1 << n) - 1); for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) prob[i][j] = scan.nextDouble(); dp[0][m] = 1; for ( int i = 0;(i < (n - 1));i++) {for ( int j = 0;(j <= m);j++) if ( (dp[(i % 2)][j] > 0)) for ( Integer next :adj[j]) dp[((i + 1) % 2)][next] += (value(j,next) * dp[(i % 2)][j]); Arrays.fill(dp[(i % 2)],0); }for ( int i = 0;(i < n);i++) {if ( (i != 0)) System.out.print(" "); System.out.printf("%.6f",dp[((n - 1) % 2)][(1 << i)]); }} }
2	public class Main{ public static void main( String[] args){ Scanner sca = new Scanner(System.in);  long k ,n ;  long ans ;  long[] pw = new long[33]; pw[1] = 4; pw[0] = 1; for ( int i = 2;(i <= 31);i++) pw[i] = (pw[(i - 1)] << 2); int t ; t = sca.nextInt(); for ( int cas = 1;(cas <= t);cas++) {n = sca.nextLong(); k = sca.nextLong(); ans = n; long last ,path = 1; for ( int i = 0;;i++) {if ( (((pw[(i + 1)] - 1) / 3) > k)) {ans -= i; last = (k - ((pw[i] - 1) / 3)); break;} path *= 2; } long sp = ((path * 2) - 1); if ( ((ans < 0) || ((ans == 0) && (last > 0)))) {System.out.println("NO"); continue;} BigInteger sq = BigInteger.valueOf(path).multiply(BigInteger.valueOf(path)).subtract(BigInteger.valueOf(sp)); if ( (((ans == 1) && (sq.compareTo(BigInteger.valueOf(last)) == -1)) && (last < sp))) {System.out.println("NO"); continue;} else if ( ((ans == 1) && (last >= sp))) {ans--; } System.out.println(("YES " + ans)); }} }
4	public class B{ static int n ,t[] ,g[] ,MOD = ((int)1e9 + 7); static int[][][] memo1 ,memo2[] ,memo3[] ; static int dp1( int idx, int remCnt, int remSum){ if ( (remCnt == 0)) return ((remSum == 0)?1:0); if ( ((remSum == 0) || (idx == n))) return 0; if ( (memo1[idx][remCnt][remSum] != -1)) return memo1[idx][remCnt][remSum]; int ans = dp1((idx + 1),remCnt,remSum); if ( ((g[idx] == 0) && (t[idx] <= remSum))) {ans += dp1((idx + 1),(remCnt - 1),(remSum - t[idx])); if ( (ans >= MOD)) ans -= MOD; } return memo1[idx][remCnt][remSum] = ans;} static int dp2( int idx, int remCnt1, int remCnt2, int remSum){ int all = (remCnt1 + remCnt2); if ( (all == 0)) return ((remSum == 0)?1:0); if ( ((idx == n) || (remSum == 0))) return 0; if ( (memo2[idx][remCnt1][remCnt2][remSum] != -1)) return memo2[idx][remCnt1][remCnt2][remSum]; int ans = dp2((idx + 1),remCnt1,remCnt2,remSum); if ( (t[idx] <= remSum)) {if ( ((g[idx] == 1) && (remCnt1 > 0))) ans += dp2((idx + 1),(remCnt1 - 1),remCnt2,(remSum - t[idx])); else if ( ((g[idx] == 2) && (remCnt2 > 0))) ans += dp2((idx + 1),remCnt1,(remCnt2 - 1),(remSum - t[idx])); } return memo2[idx][remCnt1][remCnt2][remSum] = ans;} static private int dp3( int cnt0, int cnt1, int cnt2, int last){ if ( (((cnt0 + cnt1) + cnt2) == 0)) return 1; if ( (memo3[last][cnt0][cnt1][cnt2] != -1)) return memo3[last][cnt0][cnt1][cnt2]; long ans = 0; if ( ((cnt0 > 0) && (last != 0))) ans += dp3((cnt0 - 1),cnt1,cnt2,0); if ( ((cnt1 > 0) && (last != 1))) ans += dp3(cnt0,(cnt1 - 1),cnt2,1); if ( ((cnt2 > 0) && (last != 2))) ans += dp3(cnt0,cnt1,(cnt2 - 1),2); return memo3[last][cnt0][cnt1][cnt2] = (int)(ans % MOD);} public static void main( String[] args)throws IOException { Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out); n = sc.nextInt(); int[] fac = new int[(n + 1)]; t = new int[n]; g = new int[n]; int[] cnt = new int[3]; fac[0] = 1; for ( int i = 1;(i <= n);i++) fac[i] = (int)(((i * 1L) * fac[(i - 1)]) % MOD); int T = sc.nextInt(); for ( int i = 0;(i < n);i++) {t[i] = sc.nextInt(); g[i] = (sc.nextInt() - 1); cnt[g[i]]++; }memo1 = new int[n][(cnt[0] + 1)][(T + 1)]; memo2 = new int[n][(cnt[1] + 1)][(cnt[2] + 1)][(T + 1)]; memo3 = new int[4][(cnt[0] + 1)][(cnt[1] + 1)][(cnt[2] + 1)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= cnt[0]);j++) Arrays.fill(memo1[i][j],-1); for ( int j = 0;(j <= cnt[1]);j++) for ( int k = 0;(k <= cnt[2]);k++) Arrays.fill(memo2[i][j][k],-1); }for ( int i = 0;(i < 4);i++) for ( int j = 0;(j <= cnt[0]);j++) for ( int k = 0;(k <= cnt[1]);k++) Arrays.fill(memo3[i][j][k],-1); int ans = 0; for ( int cnt0 = 0;(cnt0 <= cnt[0]);cnt0++) for ( int sum0 = 0;(sum0 <= T);sum0++) for ( int cnt1 = 0;(cnt1 <= cnt[1]);cnt1++) for ( int cnt2 = 0;(cnt2 <= cnt[2]);cnt2++) { long ways = (((dp1(0,cnt0,sum0) * 1L) * dp2(0,cnt1,cnt2,(T - sum0))) % MOD); ways = ((ways * dp3(cnt0,cnt1,cnt2,3)) % MOD); ways *= fac[cnt0]; ways %= MOD; ways *= fac[cnt1]; ways %= MOD; ways *= fac[cnt2]; ways %= MOD; ans += ways; if ( (ans >= MOD)) ans -= MOD; }out.println(ans); out.close(); } static class Scanner{ BufferedReader br ; StringTokenizer st ; Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } Scanner( String fileName)throws FileNotFoundException{ br = new BufferedReader(new FileReader(fileName)); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} boolean ready()throws IOException { return br.ready();} } }
6	public class P111C{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); double EPS = 1e-9; int h ,w ; void run(){ h = sc.nextInt(); w = sc.nextInt(); solve(); } void shuffle( int[] is){ Random rand = new Random(); for ( int i = (is.length - 1);(i >= 1);i--) { int j = rand.nextInt((i + 1));  int t = is[i]; is[i] = is[j]; is[j] = t; }} void solve(){ n = (w * h); g = new long[n]; int[] dx = {0,0,-1,1};  int[] dy = {-1,1,0,0};  int[] _ = new int[n]; for ( int i = 0;(i < n);i++) {_[i] = i; }shuffle(_); HashMap<Integer,Integer> map = new HashMap<Integer,Integer>(); for ( int i = 0;(i < n);i++) {map.put(_[i],i); }for ( int y = 0;(y < h);y++) {for ( int x = 0;(x < w);x++) {for ( int k = 0;(k < 4);k++) { int x2 = (x + dx[k]);  int y2 = (y + dy[k]); if ( ((((x2 >= 0) && (x2 < w)) && (y2 >= 0)) && (y2 < h))) {g[map.get(((y * w) + x))] |= (1L << map.get(((y2 * w) + x2))); } }}}mds = ((1L << n) - 1); mds(0,0,0); println(((n - Long.bitCount(mds)) + "")); } int n ; long[] g ; long mds ; long[] candidate ; void mds( long choosed, long removed, long covered){ if ( (Long.bitCount(choosed) >= Long.bitCount(mds))) return ; if ( (covered == ((1L << n) - 1))) {if ( (Long.bitCount(choosed) < Long.bitCount(mds))) mds = choosed; return ;} int k = -1; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); if ( (((covered >>> i) & 1) == 1)) {if ( (Long.bitCount((g[i] & ~covered)) == 0)) {mds(choosed,(removed | (1L << i)),covered); return ;} else if ( ((Long.bitCount((g[i] & ~covered)) == 1) && (((g[i] & ~covered) & ~removed) != 0))) {mds(choosed,(removed | (1L << i)),covered); return ;} } else {if ( (Long.bitCount((g[i] & ~removed)) == 0)) {mds((choosed | (1L << i)),(removed | (1L << i)),((covered | (1L << i)) | g[i])); return ;} else if ( ((Long.bitCount((g[i] & ~removed)) == 1) && (((g[i] & ~removed) | (g[i] & ~covered)) == (g[i] & ~removed)))) { int j = Long.numberOfTrailingZeros((g[i] & ~removed)); mds((choosed | (1L << j)),((removed | (1L << i)) | (1L << j)),((covered | (1L << j)) | g[j])); return ;} }if ( ((k == -1) || (Long.bitCount((g[i] & ~covered)) > Long.bitCount((g[k] & ~covered))))) k = i; if ( false) {} }if ( (k == -1)) return ; mds((choosed | (1L << k)),(removed | (1L << k)),((covered | (1L << k)) | g[k])); mds(choosed,(removed | (1L << k)),covered); } void println( String s){ System.out.println(s); } void print( String s){ System.out.print(s); } public static void main( String[] args){ Locale.setDefault(Locale.US); new P111C().run(); } }
3	public class cf908G{ static final int MOD = 1_000_000_007; public static void main( String[] argv){ cf908G pro = new cf908G();  InputStream fin = null; if ( (System.getProperty("ONLINE_JUDGE") == null)) {try{fin = new FileInputStream("input.txt"); }catch (FileNotFoundException e){ e.printStackTrace(); } } else {fin = System.in; }pro.solve(new Scanner(fin),System.out); } private void solve( Scanner scanner, PrintStream out){ long ans = 0;  String X = scanner.next(); for ( int x = 0;(x < 9);x++) {ans = ((ans + solve2(x,X)) % MOD); }out.println((((ans % MOD) + MOD) % MOD)); } private long solve2( int x, String X){ int[][][] f = new int[(X.length() + 1)][(X.length() + 1)][2]; f[0][0][1] = 1; int n = X.length(); for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= n);j++) {for ( int u = 0;(u < 2);u++) { int val = f[i][j][u]; if ( (val == 0)) continue; for ( int num = 0;(num < 10);num++) { int Xi = (X.charAt(i) - '0'); if ( ((u == 1) && (num > Xi))) break; int _i = (i + 1);  int _j = ((num <= x)?(j + 1):j);  int _u = (((u == 1) && (num == Xi))?1:0); f[_i][_j][_u] = ((f[_i][_j][_u] + val) % MOD); }}}} long base = 1;  long ret = 0; for ( int i = n;(i > 0);i--) { long t = 0; for ( int j = 0;(j < i);j++) {t = (((t + f[n][j][0]) + f[n][j][1]) % MOD); }ret = ((ret + (base * t)) % MOD); base = ((base * 10) % MOD); }return ret;} }
4	public class C429{ static InputStream is ; static int[] counts ; static int[] sufsum ; static long mod = (long)(1e9 + 7); static long[][] choose ; static long[][] memo ; public static void main( String[] args)throws IOException { is = System.in; int n = ni();  int[] a = na(n);  long[] fact = new long[(n + 2)]; fact[0] = 1; for ( int i = 1;(i < fact.length);i++) {fact[i] = ((fact[(i - 1)] * i) % mod); } HashMap<Integer,ArrayList<Integer>> hm = new HashMap<>(); for ( int i = 0;(i < a.length);i++) { int cp = a[i];  int sfree = 1; for ( int p = 2;(((p * p) <= a[i]) && (cp > 1));p++) { int count = 0; while(((cp % p) == 0)){cp /= p; count++; }if ( ((count % 2) == 1)) sfree *= p; }if ( (cp != 1)) sfree *= cp; if ( !hm.containsKey(sfree)) hm.put(sfree,new ArrayList<Integer>()); hm.get(sfree).add(a[i]); }counts = new int[hm.size()]; int dex = 0;  long bigmult = 1; for ( Integer key :hm.keySet()) { ArrayList<Integer> list = hm.get(key); counts[dex++] = list.size(); bigmult = ((bigmult * fact[list.size()]) % mod); }Arrays.sort(counts); sufsum = new int[counts.length]; for ( int i = (counts.length - 2);(i >= 0);i--) {sufsum[i] = (sufsum[(i + 1)] + counts[(i + 1)]); }choose = new long[((2 * n) + 3)][((2 * n) + 3)]; for ( int i = 0;(i < choose.length);i++) {choose[i][0] = 1; for ( int j = 1;(j <= i);j++) {choose[i][j] = ((choose[(i - 1)][j] + choose[(i - 1)][(j - 1)]) % mod); }}memo = new long[counts.length][700]; for ( int i = 0;(i < memo.length);i++) {Arrays.fill(memo[i],-1); }System.out.println(((bigmult * dp((counts.length - 2),(counts[(counts.length - 1)] - 1))) % mod)); } static long dp( int dex, int need){ if ( (dex == -1)) {if ( (need == 0)) return 1; return 0;} if ( (memo[dex][need] != -1)) return memo[dex][need]; int numspots = (sufsum[dex] + 1);  long ret = 0;  int c = counts[dex]; for ( int numdivs = 1;(numdivs <= c);numdivs++) { long toadd = 0; for ( int gotoneed = 0;((gotoneed <= need) && (gotoneed <= numdivs));gotoneed++) { long temp = choose[need][gotoneed]; temp *= choose[(numspots - need)][(numdivs - gotoneed)]; temp %= mod; temp *= dp((dex - 1),(((need - gotoneed) + c) - numdivs)); temp %= mod; toadd += temp; toadd %= mod; }toadd *= choose[(c - 1)][(numdivs - 1)]; toadd %= mod; ret += toadd; ret %= mod; }return memo[dex][need] = ret;} static private byte[] inbuf = new byte[1024]; public static int lenbuf = 0,ptrbuf = 0; static 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++];} static private boolean isSpaceChar( int c){ return ((c >= 33) && (c <= 126));} static private int skip(){ int b ; while((((b = readByte()) != -1) && isSpaceChar(b)));return b;} static private String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(b)){sb.appendCodePoint(b); b = readByte(); }return sb.toString();} static 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));} static private int[] na( int n){ int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = ni(); return a;} static 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(); }} }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskD solver = new TaskD(); solver.solve(1,in,out); out.close(); } } class TaskD{ int[] lo ; int[] hi ; long[][][][][] dp ; long[] posVal ; long go( int pos, int isAGreaterLo, int isALessHi, int isBGreaterLo, int isBLessHi){ if ( (pos == 63)) {return 0;} if ( (dp[pos][isAGreaterLo][isALessHi][isBGreaterLo][isBLessHi] != -1)) {return dp[pos][isAGreaterLo][isALessHi][isBGreaterLo][isBLessHi];} int ua = 0;  int va = 1; if ( ((isALessHi == 0) && (hi[pos] == 0))) {va = 0; } if ( ((isAGreaterLo == 0) && (lo[pos] == 1))) {ua = 1; } int ub = 0;  int vb = 1; if ( ((isBLessHi == 0) && (hi[pos] == 0))) {vb = 0; } if ( ((isBGreaterLo == 0) && (lo[pos] == 1))) {ub = 1; } long res = 0; dp[pos][isAGreaterLo][isALessHi][isBGreaterLo][isBLessHi] = 0; for ( int i = ua;(i <= va);++i) { int newIsAGreaterLo = isAGreaterLo;  int newIsALessHi = isALessHi; if ( (i < hi[pos])) newIsALessHi = 1; if ( (i > lo[pos])) newIsAGreaterLo = 1; for ( int j = ub;(j <= vb);++j) { int newIsBGreaterLo = isBGreaterLo;  int newIsBLessHi = isBLessHi; if ( (j < hi[pos])) newIsBLessHi = 1; if ( (j > lo[pos])) newIsBGreaterLo = 1;  long val = 0; if ( (i != j)) val = posVal[pos]; val += go((pos + 1),newIsAGreaterLo,newIsALessHi,newIsBGreaterLo,newIsBLessHi); res = Math.max(res,val); }}dp[pos][isAGreaterLo][isALessHi][isBGreaterLo][isBLessHi] = res; return res;} public void solve( int testNumber, InputReader in, OutputWriter out){ lo = new int[63]; hi = new int[63]; long a = in.readLong();  long b = in.readLong(); Binary.convertBinary(a,lo); Binary.convertBinary(b,hi); posVal = new long[63]; posVal[62] = 1; for ( int i = 61;(i >= 0);--i) {posVal[i] = (posVal[(i + 1)] * 2); }dp = new long[65][2][2][2][2]; for ( long[][][][] a1 :dp) {for ( long[][][] a2 :a1) {for ( long[][] a3 :a2) {for ( long[] a4 :a3) {Arrays.fill(a4,-1); }}}} long res = go(0,0,0,0,0); out.printLine(res); } } class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } public int read(){ if ( (numChars == -1)) throw (new UnknownError()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = stream.read(buf); }catch (IOException e){ throw (new UnknownError());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} 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 static boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(outputStream); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } }
0	public class sample{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(); System.out.println((n + (n / 2))); } }
5	public class A{ public static void main( String[] ar)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String s1[] = br.readLine().split(" ");  int n = Integer.parseInt(s1[0]);  long x = Long.parseLong(s1[1]);  long y = Long.parseLong(s1[2]);  long S = 0;  long mod = 1000000007;  B a[] = new B[n];  TreeMap<Long,Long> tm = new TreeMap<Long,Long>();  long ans[] = new long[n]; for ( int i = 0;(i < n);i++) { String s2[] = br.readLine().split(" ");  long l = Long.parseLong(s2[0]);  long r = Long.parseLong(s2[1]);  B b1 = new B(l,r); a[i] = b1; }Arrays.sort(a,new The_Comp()); for ( int i = 0;(i < n);i++) { long l = a[i].x;  long r = a[i].y; if ( (tm.floorKey((l - 1)) != null)) { long u = tm.floorKey((l - 1));  long v = l; if ( (((v - u) * y) < x)) {ans[i] = (((r - u) * y) % mod); if ( (tm.get(u) > 1)) tm.put(u,(tm.get(u) - 1)); else tm.remove(u); } else {ans[i] = ((x + ((r - l) * y)) % mod); }} else ans[i] = ((x + ((r - l) * y)) % mod); S = ((S + ans[i]) % mod); if ( tm.containsKey(r)) tm.put(r,(1 + tm.get(r))); else tm.put(r,(long)1); }System.out.println(S); } } class The_Comp implements Comparator<B>{ } class B{ long x = (long)1; long y = (long)1; public B( long l1, long l2){ x = l1; y = l2; } }
1	public class Ideone{ public static void main( String[] args)throws java.lang.Exception { Scanner sc = new Scanner(System.in);  String a = sc.next();  String b = sc.next();  int m = a.length();  int n = b.length();  int[] zero = new int[n];  int[] one = new int[n]; for ( int i = 0;(i < n);i++) {if ( (i == 0)) {if ( (b.charAt(i) == '0')) zero[i]++; else one[i]++; } else {zero[i] = zero[(i - 1)]; one[i] = one[(i - 1)]; if ( (b.charAt(i) == '0')) zero[i]++; else one[i]++; }} long res = 0; for ( int i = 0;(i < m);i++) { int x = ((n - m) + i); if ( (a.charAt(i) == '0')) res += one[x]; else res += zero[x]; if ( (i > 0)) {if ( (a.charAt(i) == '0')) res -= one[(i - 1)]; else res -= zero[(i - 1)]; } }System.out.println(res); } }
2	public class Solution{ public static void main( String[] args){ Solution solution = new Solution(); solution.solve(); } private void solve(){ Scanner in = new Scanner(System.in);  int t = in.nextInt(); while((t-- > 0)){ long n = in.nextLong();  long k = in.nextLong(); System.out.println(solve(n,k)); }} private String solve( long n, long k){ if ( (n > 31)) return ("YES " + (n - 1)); if ( (k > f(n))) return "NO"; long square = 1;  long splitDone = 0;  long size = n;  long splitLeft = 0; while((((splitDone + square) <= k) && (size > 0))){splitDone += square; --size; splitLeft += (((square * 2) - 1) * f(size)); square = ((square * 2) + 1); }if ( (k > (splitDone + splitLeft))) return "NO"; else return ("YES " + size);} private long f( long x){ return (((1L << (2 * x)) - 1) / 3);} }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,dd ,bb ; int[] uu ,vv ,uv ,cost ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; dd = new int[n_]; bb = new int[n_]; qq = new int[nq]; iq = new boolean[n_]; uu = new int[m_]; vv = new int[m_]; uv = new int[m_]; cost = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; uv[h] = (u ^ v); cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } int[] qq ; int nq = (1 << 20),head ,cnt ; boolean[] iq ; void enqueue( int v){ if ( iq[v]) return ; if ( ((head + cnt) == nq)) {if ( ((cnt * 2) <= nq)) System.arraycopy(qq,head,qq,0,cnt); else { int[] qq_ = new int[nq *= 2]; System.arraycopy(qq,head,qq_,0,cnt); qq = qq_; }head = 0; } qq[(head + cnt++)] = v; iq[v] = true; } int dequeue(){ int u = qq[head++]; cnt--; iq[u] = false; return u;} boolean spfa( int s, int t){ Arrays.fill(pi,INF); pi[s] = 0; head = cnt = 0; enqueue(s); while((cnt > 0)){ int u = dequeue();  int d = (dd[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost[h]:-cost[h]));  int v = (u ^ uv[h]); if ( ((pi[v] > p) || ((pi[v] == p) && (dd[v] > d)))) {pi[v] = p; dd[v] = d; bb[v] = h_; enqueue(v); } } }return (pi[t] != INF);} void push1( int s, int t){ for ( int u = t,h_ ,h ;(u != s);u ^= uv[h]) {h = ((h_ = bb[u]) >> 1); cc[h_]--; cc[(h_ ^ 1)]++; }} int edmonds_karp( int s, int t){ while(spfa(s,t))push1(s,t); int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
5	public class D{ static final boolean stdin = true; static final String filename = ""; static FastScanner br ; static PrintWriter pw ; public static void main( String[] args)throws IOException { if ( stdin) {br = new FastScanner(); pw = new PrintWriter(new OutputStreamWriter(System.out)); } else {br = new FastScanner((filename + ".in")); pw = new PrintWriter(new FileWriter((filename + ".out"))); } Solver solver = new Solver(); solver.solve(br,pw); } static class Solver{ static long mod = (long)1e10; public void solve( FastScanner br, PrintWriter pw)throws IOException { int n = br.ni();  Integer[] in = br.nIa(n);  TreeSet<Integer> ts = new TreeSet<Integer>(); for ( int i = 0;(i < n);i++) {ts.add(in[i]); } String twoSol = ""; for ( int i = 0;(i <= 30);i++) {for ( int j :in) {if ( ts.contains((j + (int)Math.pow(2,i)))) {if ( ts.contains((j - (int)Math.pow(2,i)))) {pw.println(3); pw.println(((((j + " ") + (j + (int)Math.pow(2,i))) + " ") + (j - (int)Math.pow(2,i)))); pw.close(); System.exit(0); } else {twoSol = ((j + " ") + (j + (int)Math.pow(2,i))); }} }}if ( twoSol.isEmpty()) {pw.println(1); pw.println(in[0]); } else {pw.println(2); pw.println(twoSol); }pw.close(); } static long gcd( long a, long b){ if ( (a > b)) return gcd(b,a); if ( (a == 0)) return b; return gcd((b % a),a);} static long pow( long a, long b){ if ( (b == 0)) return 1L; long val = pow(a,(b / 2)); if ( ((b % 2) == 0)) return ((val * val) % mod); else return ((((val * val) % mod) * a) % mod);} } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( String s){ try{br = new BufferedReader(new FileReader(s)); }catch (FileNotFoundException e){ e.printStackTrace(); } } public FastScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } Integer[] nIa( int n){ Integer[] arr = new Integer[n]; for ( int i = 0;(i < n);i++) {arr[i] = ni(); }return arr;} String nt(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int ni(){ return Integer.parseInt(nt());} long nl(){ return Long.parseLong(nt());} } }
4	public class C2{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni();  int[] a = na(n); for ( int i = 0;(i < n);i++) { int v = a[i]; for ( int j = 2;((j * j) <= v);j++) {while(((v % (j * j)) == 0)){v /= (j * j); }}a[i] = v; }Arrays.sort(a); int[] f = new int[n];  int p = 0; for ( int i = 0;(i < n);i++) {if ( ((i > 0) && (a[i] != a[(i - 1)]))) {p++; } f[p]++; }f = Arrays.copyOf(f,(p + 1)); int mod = 1000000007;  int[][] fif = enumFIF(1000,mod);  long[] res = countSameNeighborsSequence(f,fif,mod);  long ans = res[0]; for ( int v :f) {ans = ((ans * fif[0][v]) % mod); }out.println(ans); } public static int[][] enumFIF( int n, int mod){ int[] f = new int[(n + 1)];  int[] invf = new int[(n + 1)]; f[0] = 1; for ( int i = 1;(i <= n);i++) {f[i] = (int)(((long)f[(i - 1)] * i) % mod); } long a = f[n];  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)); }invf[n] = (int)((p < 0)?(p + mod):p); for ( int i = (n - 1);(i >= 0);i--) {invf[i] = (int)(((long)invf[(i + 1)] * (i + 1)) % mod); }return new int[][]{f,invf};} public static long[] countSameNeighborsSequence( int[] a, int[][] fif, int mod){ int n = a.length;  int bef = a[0];  int aft = a[0];  long[] dp = new long[bef]; dp[(bef - 1)] = 1; for ( int u = 1;(u < n);u++) { int v = a[u]; aft += v; long[][] ldp = new long[bef][aft]; for ( int i = 0;(i < dp.length);i++) {ldp[i][0] = dp[i]; }for ( int i = 0;(i < v);i++) { long[][] ndp = new long[bef][aft]; for ( int j = 0;(j < bef);j++) {for ( int k = 0;((j + k) < aft);k++) {if ( (ldp[j][k] == 0)) continue; if ( (j > 0)) {ndp[(j - 1)][k] += (ldp[j][k] * j); ndp[(j - 1)][k] %= mod; } ndp[j][(k + 1)] += (ldp[j][k] * ((2 * i) - k)); ndp[j][(k + 1)] %= mod; ndp[j][k] += (ldp[j][k] * (((((bef + i) + 1) - j) - k) - (2 * (i - k)))); ndp[j][k] %= mod; }}ldp = ndp; }dp = new long[aft]; for ( int j = 0;(j < bef);j++) {for ( int k = 0;((j + k) < aft);k++) {dp[(j + k)] += ldp[j][k]; }}for ( int j = 0;(j < aft);j++) dp[j] = (((dp[j] % mod) * fif[1][v]) % mod); bef = aft; }return dp;} 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 C2().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
6	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);  E1RotateColumnsEasyVersion solver = new E1RotateColumnsEasyVersion(); solver.solve(1,in,out); out.close(); } static class E1RotateColumnsEasyVersion{ int n ; int m ; int[][] arr ; int[][] mskValue ; int[][] memo ; public void solve( int testNumber, Scanner sc, PrintWriter pw){ int q = sc.nextInt(); while((q-- > 0)){n = sc.nextInt(); m = sc.nextInt(); arr = new int[n][m]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < m);j++) arr[i][j] = sc.nextInt(); int[][] temp = new int[m][n]; for ( int i = 0;(i < m);i++) for ( int j = 0;(j < n);j++) temp[i][j] = arr[j][i]; Arrays.sort(temp,(a,b)->(getMax(b) - getMax(a))); for ( int i = 0;(i < m);i++) for ( int j = 0;(j < n);j++) arr[j][i] = temp[i][j]; mskValue = new int[n][(1 << n)]; for ( int i = 0;(i < Math.min(n,m));i++) {for ( int j = 0;(j < (1 << n));j++) { int max = 0; for ( int shift = 0;(shift < n);shift++) { int sum = 0; for ( int k = 0;(k < n);k++) if ( ((j & (1 << k)) != 0)) sum += arr[((k + shift) % n)][i]; max = Math.max(max,sum); }mskValue[i][j] = max; }}memo = new int[Math.min(n,m)][(1 << n)]; for ( int[] x :memo) Arrays.fill(x,-1); pw.println(dp(0,0)); }} private int getMax( int[] a){ int max = 0; for ( int x :a) max = Math.max(max,x); return max;} private int dp( int idx, int msk){ if ( (msk == ((1 << n) - 1))) return 0; if ( (idx == Math.min(n,m))) return (int)-1e9; int max = Integer.MIN_VALUE; if ( (memo[idx][msk] != -1)) return memo[idx][msk]; int availableBits = (msk ^ ((1 << n) - 1)); for ( int colMask = availableBits;(colMask != 0);colMask = ((colMask - 1) & availableBits)) {max = Math.max(max,(mskValue[idx][colMask] + dp((idx + 1),(msk | colMask)))); }return memo[idx][msk] = max;} } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( FileReader r){ br = new BufferedReader(r); } public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
4	public class CF387D{ static class A{ ArrayList<Integer> list = new ArrayList<>(); int u ,v ,d ; } static int INF = Integer.MAX_VALUE; static boolean bfs( A[] aa, int n){ LinkedList<Integer> queue = new LinkedList<>(); for ( int u = 1;(u <= n);u++) if ( (aa[u].v > 0)) aa[u].d = INF; else {aa[u].d = 0; queue.addLast(u); }aa[0].d = INF; while(!queue.isEmpty()){ int u = queue.removeFirst(); if ( ((aa[u].d + 1) == aa[0].d)) break; for ( int v :aa[u].list) { int w = aa[v].u; if ( (aa[w].d == INF)) {aa[w].d = (aa[u].d + 1); queue.addLast(w); } }}return (aa[0].d != INF);} static boolean dfs( A[] aa, int n, int u){ if ( (u == 0)) return true; for ( int v :aa[u].list) { int w = aa[v].u; if ( ((aa[w].d == (aa[u].d + 1)) && dfs(aa,n,w))) {aa[u].v = v; aa[v].u = u; return true;} }aa[u].d = INF; return false;} static int matchings( A[] aa, int n){ int cnt = 0; while(bfs(aa,n))for ( int u = 1;(u <= n);u++) if ( ((aa[u].v == 0) && dfs(aa,n,u))) cnt++; return cnt;} public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int m = Integer.parseInt(st.nextToken());  int[] eu = new int[m];  int[] ev = new int[m]; for ( int j = 0;(j < m);j++) {st = new StringTokenizer(br.readLine()); eu[j] = Integer.parseInt(st.nextToken()); ev[j] = Integer.parseInt(st.nextToken()); } A[] aa = new A[(n + 1)];  int min = (m + (n * 3)); for ( int ctr = 1;(ctr <= n);ctr++) { boolean loop = false;  boolean[] ci = new boolean[(n + 1)];  boolean[] co = new boolean[(n + 1)]; for ( int i = 0;(i <= n);i++) aa[i] = new A(); int m_ = 0; for ( int j = 0;(j < m);j++) { int u = eu[j];  int v = ev[j]; if ( ((u == ctr) && (v == ctr))) loop = true; else if ( ((u == ctr) && (v != ctr))) ci[v] = true; else if ( ((u != ctr) && (v == ctr))) co[u] = true; else {aa[u].list.add(v); m_++; }} int cnt = (loop?0:1); for ( int i = 1;(i <= n);i++) if ( (i != ctr)) {if ( !ci[i]) cnt++; if ( !co[i]) cnt++; } int m2 = matchings(aa,n); cnt += ((m_ - m2) + ((n - 1) - m2)); if ( (min > cnt)) min = cnt; }System.out.println(min); } }
6	public class B{ static int ourLevel ; public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int k = Integer.parseInt(st.nextToken()); ourLevel = Integer.parseInt(st.nextToken()); State[] list = new State[n]; for ( int i = 0;(i < n);i++) {st = new StringTokenizer(br.readLine()); list[i] = new State(Integer.parseInt(st.nextToken()),(Integer.parseInt(st.nextToken()) / 10)); }System.out.println(solve(list,0,k)); } public static double solve( State[] s, int index, int left){ if ( (index == s.length)) return prob(s); double ret = 0; for ( int c = 0;((c <= left) && ((s[index].prob + c) <= 10));c++) {s[index].prob += c; ret = Math.max(ret,solve(s,(index + 1),(left - c))); s[index].prob -= c; }return ret;} public static double prob( State[] s){ double win = 1; for ( int i = 0;(i < (1 << s.length));i++) { int numLose = (s.length - Integer.bitCount(i)); if ( ((2 * numLose) >= s.length)) { int level = 0;  double p = 1; for ( int j = 0;(j < s.length);j++) {if ( ((i & (1 << j)) == 0)) {p *= ((10 - s[j].prob) / 10.); level += s[j].level; } else {p *= (s[j].prob / 10.); }} double lose = ((level * 1.0) / (ourLevel + level)); win -= (p * lose); } }return win;} static class State{ public int level ,prob ; public State( int a, int b){ level = a; prob = b; } } }
6	public class C{ static int[] nm ; static int ans = 0; static int rows ,cols ; static boolean[][] cae ; static int[][] ca ; public static void main( String[] args)throws IOException { nm = readIntArray(); rows = Math.max(nm[0],nm[1]); cols = Math.min(nm[0],nm[1]); long s = System.currentTimeMillis(); cae = new boolean[1000][50]; ca = new int[1000][50]; StringBuilder sb = new StringBuilder(); for ( int i = 0;(i < cols);i++) {sb.append('1'); } int startingState = Integer.parseInt(sb.toString(),3); ans = solve(startingState,0); System.out.println(((nm[0] * nm[1]) - ans)); } static int solve( int state, int row){ if ( (row == rows)) {return 0;} if ( cae[state][row]) {return ca[state][row];} int ans = Integer.MAX_VALUE; for ( int i = 0;(i < Math.pow(3,cols));i++) { boolean isCover = covers(i,state); if ( (isCover && ((row < (rows - 1)) || coversTotally(i,state)))) { int p = placed(i);  int s = solve(i,(row + 1)); ans = Math.min(ans,(s + p)); } }cae[state][row] = true; ca[state][row] = ans; return ans;} static private boolean coversTotally( int i, int state){ String bottom = decode(i); for ( int j = 0;(j < bottom.length());j++) {if ( (bottom.charAt(j) == '0')) {return false;} }return true;} static private boolean covers( int i, int state){ String top = decode(state);  String bottom = decode(i); for ( int j = 0;(j < top.length());j++) {if ( ((top.charAt(j) == '0') && (bottom.charAt(j) != '2'))) {return false;} if ( ((top.charAt(j) == '2') && (bottom.charAt(j) == '0'))) {return false;} }for ( int j = 0;(j < top.length());j++) {if ( ((bottom.charAt(j) == '1') && (((top.charAt(j) != '2') && ((j > 0) && (bottom.charAt((j - 1)) == '2'))) && ((j < (top.length() - 1)) && (bottom.charAt((j + 1)) == '2'))))) {return false;} }return true;} static private int placed( int i){ String s = decode(i);  int cnt = 0; for ( int j = 0;(j < s.length());j++) {if ( (s.charAt(j) == '2')) {cnt++; } }return cnt;} static private String decode( int state){ String tmp = Integer.toString(state,3); if ( (tmp.length() < cols)) { StringBuilder sb = new StringBuilder(); for ( int i = 0;(i < (cols - tmp.length()));i++) {sb.append('0'); }sb.append(tmp); return sb.toString();} else {return tmp;}} static InputStreamReader isr = new InputStreamReader(System.in); static BufferedReader br = new BufferedReader(isr); static int[] readIntArray()throws IOException { String[] v = br.readLine().split(" ");  int[] ans = new int[v.length]; for ( int i = 0;(i < ans.length);i++) {ans[i] = Integer.valueOf(v[i]); }return ans;} }
4	public class Main{ static long MOD = 1_000_000_007L; static long inv2 = ((MOD + 1) / 2); static int[][] dir = new int[][]{{1,0},{0,1},{-1,0},{0,-1}}; static long lMax = 0x3f3f3f3f3f3f3f3fL; static int iMax = 0x3f3f3f3f; static HashMap<Long,Long> memo = new HashMap(); static MyScanner sc = new MyScanner(); static int nn = 300000; static long[] pow2 ; static long[] fac ; static long[] pow ; static long[] inv ; static long[] facInv ; static int[] base ; static int[] numOfDiffDiv ; static int[] numOfDiv ; static ArrayList<Integer> primes ; static int ptr = 0; static boolean[] isPrime ; public static PrintWriter out ; public static void main( String[] args){ out = new PrintWriter(new BufferedOutputStream(System.out)); int t = 1,tt = 0; for ( int i = 1;(i < 40000);i++) squares.add((i * i)); while((tt++ < t)){ boolean res = solve(); }out.close(); } static HashSet<Integer> squares = new HashSet(); static boolean solve(){ long res = 0;  int n = sc.ni();  long m = sc.nl();  long[][][] dp = new long[2][5][5];  long[][][] dp2 = new long[2][5][5]; dp[0][2][1] = dp[1][2][2] = dp2[0][1][1] = 1L; for ( int i = 3;(i <= n);i++) { long[][] bef = dp[0];  long[][] aft = dp[1];  long[][] nbef = new long[(i + 3)][(i + 3)];  long[][] naft = new long[(i + 3)][(i + 3)]; for ( int len = 1;(len <= i);len++) {for ( int ind = 1;(ind <= len);ind++) {nbef[(len + 1)][1] += bef[len][ind]; nbef[(len + 1)][(ind + 1)] -= bef[len][ind]; naft[(len + 1)][(ind + 1)] += bef[len][ind]; naft[(len + 1)][(ind + 1)] += aft[len][ind]; nbef[(len + 1)][1] += (dp2[0][len][ind] + dp2[1][len][ind]); }}for ( int len = 1;(len <= i);len++) {for ( int ind = 1;(ind <= len);ind++) {nbef[len][ind] = (((nbef[len][ind] + nbef[len][(ind - 1)]) + (10000000L * m)) % m); naft[len][ind] = (((naft[len][ind] + naft[len][(ind - 1)]) + (10000000L * m)) % m); }}dp2 = dp; dp = new long[][][]{nbef,naft}; }for ( long[] row :dp[0]) for ( long i :row) res += i; for ( long[] row :dp[1]) for ( long i :row) res += i; out.println((res % m)); return false;} public static int[][] packU( int n, int[] from, int[] to){ return packU(n,from,to,from.length);} public static int[][] packU( int n, int[] from, int[] to, int sup){ int[][] g = new int[n][];  int[] p = new int[n]; for ( int i = 0;(i < sup);i++) p[from[i]]++; for ( int i = 0;(i < sup);i++) p[to[i]]++; for ( int i = 0;(i < n);i++) g[i] = new int[p[i]]; for ( int i = 0;(i < sup);i++) {g[from[i]][--p[from[i]]] = to[i]; g[to[i]][--p[to[i]]] = from[i]; }return g;} public static int lowerBound( int[] a, int v){ return lowerBound(a,0,a.length,v);} public static int lowerBound( int[] a, int l, int r, int v){ if ( (((l > r) || (l < 0)) || (r > a.length))) throw (new IllegalArgumentException()); int low = (l - 1),high = r; while(((high - low) > 1)){ int h = ((high + low) >>> 1); if ( (a[h] >= v)) {high = h; } else {low = h; }}return high;} public static long quickPOW( long n, long m){ long ans = 1l; while((m > 0)){if ( ((m % 2) == 1)) ans = ((ans * n) % MOD); n = ((n * n) % MOD); m >>= 1; }return ans;} public static long quickPOW( long n, long m, long mod){ long ans = 1l; while((m > 0)){if ( ((m % 2) == 1)) ans = ((ans * n) % mod); n = ((n * n) % mod); m >>= 1; }return ans;} public static int gcd( int a, int b){ if ( ((a % b) == 0)) return b; return gcd(b,(a % b));} public static long gcd( long a, long b){ if ( ((a % b) == 0)) return b; return gcd(b,(a % b));} static class RandomWrapper{ private Random random ; public static final RandomWrapper INSTANCE = new RandomWrapper(new Random()); public RandomWrapper(){ this(new Random()); } public RandomWrapper( Random random){ this.random = random; } public int nextInt( int l, int r){ return (random.nextInt(((r - l) + 1)) + l);} } public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int ni(){ return Integer.parseInt(next());} long nl(){ return Long.parseLong(next());} } }
0	public class Main{ static Scanner in = new Scanner(); static PrintWriter out = new PrintWriter(System.out); public static void main( String[] args)throws IOException { long n = in.nextLong(),m = in.nextLong(); out.print(((m / n) + (((m % n) == 0)?0:1))); out.close(); } static class Scanner{ BufferedReader br ; StringTokenizer st ; public Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); } public String next()throws IOException { if ( !st.hasMoreTokens()) st = new StringTokenizer(br.readLine()); return st.nextToken();} public long nextLong()throws IOException { return Long.parseLong(next());} } }
3	public class GB2017C{ static int n ,r ; static int[] x ; static Map<Integer,Double> horo ; public static void main( String[] args){ FastScanner sc = new FastScanner();  StringBuilder sb = new StringBuilder(); n = sc.nextInt(); r = sc.nextInt(); x = new int[n]; horo = new HashMap<Integer,Double>(); for ( int x = 0;(x <= (r * 2));x++) { double y = (2.0 * Math.sqrt(((r * r) - ((r - (x / 2.0)) * (r - (x / 2.0)))))); horo.put(x,y); }for ( int i = 0;(i < n);i++) {x[i] = sc.nextInt(); } List<Double> y = new ArrayList<Double>(); for ( int i = 0;(i < n);i++) { double max = r; for ( int j = 0;(j < y.size());j++) { int dx = intersects(i,j); if ( (dx >= 0)) { double dy = horo.get(dx); max = Math.max(max,(dy + y.get(j))); } }y.add(max); }for ( int i = 0;(i < n);i++) {sb.append((y.get(i) + " ")); }System.out.println(sb); } static int intersects( int i, int j){ if ( (Math.abs((x[i] - x[j])) <= (2 * r))) {return ((2 * r) - Math.abs((x[i] - x[j])));} else return -1;} public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( Reader in){ br = new BufferedReader(in); } public FastScanner(){ this(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } }
3	public class Solution2{ private void solve()throws IOException { int n = in.nextInt();  double r = in.nextDouble();  List<Double> xes = new ArrayList<>(n);  List<Double> yes = new ArrayList<>(n); for ( int i = 0;(i < n);i++) {xes.add(in.nextDouble()); }for ( int i = 0;(i < n);i++) { double max = r; for ( int j = 0;(j < i);j++) { double x = xes.get(j);  double y = yes.get(j); if ( ((xes.get(i) <= (x + (2 * r))) && (xes.get(i) >= (x - (2 * r))))) {max = Math.max(max,(y + Math.sqrt((((4 * r) * r) - (Math.abs((x - xes.get(i))) * Math.abs((x - xes.get(i)))))))); } }yes.add(max); }for ( double y :yes) {System.out.print((y + " ")); }System.out.println(); System.out.flush(); } static private String filename = ""; private PrintWriter out ; private MyScanner in ; private void run()throws IOException { in = new MyScanner(); out = new PrintWriter(System.out); solve(); in.close(); out.close(); } private class MyScanner{ private BufferedReader br ; private StringTokenizer st ; MyScanner()throws IOException{ this.br = new BufferedReader(new InputStreamReader(System.in)); } public MyScanner( String fileTitle)throws IOException{ this.br = new BufferedReader(new FileReader(fileTitle)); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String s = br.readLine(); if ( (s == null)) {return "-1";} st = new StringTokenizer(s); }return st.nextToken();} public Integer nextInt()throws IOException { return Integer.parseInt(this.next());} public Double nextDouble()throws IOException { return Double.parseDouble(this.next());} void close()throws IOException { this.br.close(); } } public static void main( String[] args)throws IOException { Locale.setDefault(Locale.US); new Solution2().run(); } }
0	public class p472a{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); if ( ((n % 2) == 0)) {System.out.println(("8 " + (n - 8))); } else {System.out.println(("9 " + (n - 9))); }} }
3	public class NewYearAndCurling{ public static void main( String[] args)throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  StringTokenizer t = new StringTokenizer(in.readLine());  int N = Integer.parseInt(t.nextToken());  int R = Integer.parseInt(t.nextToken());  int[] x = new int[N]; t = new StringTokenizer(in.readLine()); for ( int i = 0;(i < N);++i) x[i] = Integer.parseInt(t.nextToken()); double[] y = new double[N]; for ( int i = 0;(i < N);++i) { double max = R; for ( int j = 0;(j < i);++j) { int xDiff = Math.abs((x[i] - x[j])); if ( (xDiff <= (2 * R))) max = Math.max(max,(y[j] + Math.sqrt((((4 * R) * R) - (xDiff * xDiff))))); }y[i] = max; }out.print(y[0]); for ( int i = 1;(i < N);++i) out.print((" " + y[i])); out.println(); in.close(); out.close(); } }
2	public class test_round_B{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  BigInteger k = sc.nextBigInteger();  BigInteger i = new BigInteger("0");  int d = 0;  BigInteger a = new BigInteger("0"); while((i.compareTo(k) != 1)){if ( (i.compareTo(k) == 0)) {break;} else {d++; BigInteger temp = new BigInteger("0"); for ( int j = 0;(j < d);j++) {temp = temp.multiply(new BigInteger("10")).add(new BigInteger("9")); }i = i.add(new BigInteger(Integer.toString(d)).multiply(temp.subtract(a))); a = temp; }} BigInteger b = a.divide(new BigInteger("10"));  BigInteger t = b;  BigInteger l = t;  int dig = 0; if ( b.equals(new BigInteger("0"))) {dig = 0; } else {while((b.compareTo(new BigInteger("0")) == 1)){dig++; b = b.divide(new BigInteger("10")); }} int flag = (dig + 1);  BigInteger num = new BigInteger("0"); b = t; while((b.compareTo(new BigInteger("0")) == 1)){ BigInteger rev = b.divide(new BigInteger("10")); num = num.add(new BigInteger(Integer.toString(dig)).multiply(b.subtract(rev))); b = b.divide(new BigInteger("10")); dig--; } BigInteger net = k.subtract(num);  BigInteger div = net.divide(new BigInteger(Integer.toString(flag)));  int q ; if ( net.mod(new BigInteger(Integer.toString(flag))).equals(new BigInteger("0"))) {q = 0; t = t.add(div); System.out.println(t.mod(new BigInteger("10"))); } else { BigInteger r = div.multiply(new BigInteger(Integer.toString(flag))); r = net.subtract(r); t = t.add(div.add(new BigInteger("1"))); l = t; int pig = 0; while((t.compareTo(new BigInteger("0")) == 1)){pig++; t = t.divide(new BigInteger("10")); } BigInteger p = new BigInteger(Integer.toString(pig));  BigInteger rem = p.subtract(r); while((rem.compareTo(new BigInteger("0")) == 1)){l = l.divide(new BigInteger("10")); rem = rem.subtract(new BigInteger("1")); }System.out.println(l.mod(new BigInteger("10"))); }} }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  CChessboard solver = new CChessboard(); solver.solve(1,in,out); out.close(); } static class CChessboard{ int[] nextPermutation( int[] array){ int i = (array.length - 1); while(((i > 0) && (array[(i - 1)] >= array[i]))){i--; }if ( (i <= 0)) {return null;} int j = (array.length - 1); while((array[j] <= array[(i - 1)])){j--; } int temp = array[(i - 1)]; array[(i - 1)] = array[j]; array[j] = temp; j = (array.length - 1); while((i < j)){temp = array[i]; array[i] = array[j]; array[j] = temp; i++; j--; }return array;} public void solve( int testNumber, InputReader in, OutputWriter out){ int n = in.nextInt();  int arr[][][] = new int[4][n][n];  int sum[] = new int[4]; for ( int k = 0;(k < 4);k++) {for ( int i = 0;(i < n);i++) { String str = in.next(); for ( int j = 0;(j < n);j++) {arr[k][i][j] = (str.charAt(j) - '0'); }}}for ( int k = 0;(k < 4);k++) {for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {if ( (((i + j) % 2) == arr[k][i][j])) sum[k]++; }}} int perm[] = new int[4]; for ( int i = 0;(i < 4);i++) perm[i] = i; int min = Integer.MAX_VALUE; while(true){perm = nextPermutation(perm); if ( (perm == null)) break; int sm = 0; for ( int j = 0;(j < 4);j++) {if ( ((j % 2) == 0)) {sm += sum; } else {sm += ((n * n) - sum[perm[j]]); }}min = Math.min(min,sm); sm = 0; for ( int j = 0;(j < 4);j++) {if ( ((j % 2) == 0)) {sm += ((n * n) - sum[perm[j]]); } else {sm += sum; }}min = Math.min(sm,min); }out.printLine(min); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void close(){ writer.close(); } public void printLine( int i){ writer.println(i); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } public int read(){ if ( (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 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 & 15); c = read(); }while(!isSpaceChar(c));return (res * sgn);} 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 boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
6	public class BetaRound81_B implements Runnable{ BufferedReader in ; PrintWriter out ; StringTokenizer tok = new StringTokenizer(""); public static void main( String[] args){ new Thread(null,new BetaRound81_B(),"",(256 * (1L << 20))).start(); } String readString()throws IOException { while(!tok.hasMoreTokens()){tok = new StringTokenizer(in.readLine()); }return tok.nextToken();} int readInt()throws IOException { return Integer.parseInt(readString());} int n ,k ,A ; int[] b ,l ,c ; void solve()throws IOException { n = readInt(); k = readInt(); A = readInt(); b = new int[n]; l = new int[n]; for ( int i = 0;(i < n);i++) {b[i] = readInt(); l[i] = readInt(); }c = new int[n]; rec(0,0); out.printf("%.12f\n",ans); } double ans = 0; void rec( int sum, int i){ if ( (i > n)) return ; if ( (sum > k)) return ; if ( (i == n)) {ans = max(ans,p()); return ;} if ( ((l[i] + (c[i] * 10)) <= 100)) { int can = min((k - sum),((100 - (l[i] + (c[i] * 10))) / 10)); for ( int set = can;(set >= 0);set--) {c[i] += set; rec((sum + set),(i + 1)); c[i] -= set; }} } double p(){ int n = c.length;  int need = ((n / 2) + 1);  int[] L = new int[n]; for ( int i = 0;(i < n);i++) {L[i] = (l[i] + (c[i] * 10)); if ( (L[i] > 100)) {throw (new RuntimeException());} } double p = 0; for ( int mask = 0;(mask < (1 << n));mask++) { double q = 1; for ( int i = 0;(i < n);i++) {if ( (((1 << i) & mask) != 0)) {q *= (L[i] / 100.0); } else {q *= (1 - (L[i] / 100.0)); }}if ( (q == 0)) continue; if ( (Integer.bitCount(mask) >= need)) {p += q; } else { int B = 0; for ( int i = 0;(i < n);i++) {if ( (((1 << i) & mask) == 0)) {B += b[i]; } } double q2 = ((double)A / (A + B)); p += (q * q2); }}return p;} }
3	public class Solution1 implements Runnable{ static final int MAX = 1000000007; 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 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 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 interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } public static void main( String[] args)throws Exception { new Thread(null,new Solution1(),"Solution1",(1 << 26)).start(); } public static int gcd( int a, int b){ if ( (a == 0)) return b; return gcd((b % a),a);} static int max = -1; }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,dd ,bb ; int[] uu ,vv ,uv ,cost ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; dd = new int[n_]; bb = new int[n_]; qq = new int[nq]; iq = new boolean[n_]; uu = new int[m_]; vv = new int[m_]; uv = new int[m_]; cost = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; uv[h] = (u ^ v); cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } int[] qq ; int nq = (1 << 20),head ,cnt ; boolean[] iq ; void enqueue( int v){ if ( iq[v]) return ; if ( ((head + cnt) == nq)) {if ( ((cnt * 4) <= nq)) System.arraycopy(qq,head,qq,0,cnt); else { int[] qq_ = new int[nq *= 2]; System.arraycopy(qq,head,qq_,0,cnt); qq = qq_; }head = 0; } qq[(head + cnt++)] = v; iq[v] = true; } int dequeue(){ int u = qq[head++]; cnt--; iq[u] = false; return u;} boolean spfa( int s, int t){ Arrays.fill(pi,INF); pi[s] = 0; head = cnt = 0; enqueue(s); while((cnt > 0)){ int u = dequeue();  int d = (dd[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost[h]:-cost[h]));  int v = (u ^ uv[h]); if ( ((pi[v] > p) || ((pi[v] == p) && (dd[v] > d)))) {pi[v] = p; dd[v] = d; bb[v] = h_; enqueue(v); } } }return (pi[t] != INF);} void push1( int s, int t){ for ( int u = t,h_ ,h ;(u != s);u ^= uv[h]) {h = ((h_ = bb[u]) >> 1); cc[h_]--; cc[(h_ ^ 1)]++; }} int edmonds_karp( int s, int t){ while(spfa(s,t))push1(s,t); int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
3	public class C{ public static void main( String[] args){ Scanner qwe = new Scanner(System.in);  int n = qwe.nextInt();  double r = qwe.nextDouble();  double[] fy = new double[n]; Arrays.fill(fy,r); double[] xs = new double[n]; for ( int i = 0;(i < xs.length);i++) {xs[i] = qwe.nextDouble(); }for ( int i = 0;(i < n);i++) {for ( int j = (i + 1);(j < n);j++) { double dx = (xs[j] - xs[i]); if ( (Math.abs(dx) > (2 * r))) continue; fy[j] = Math.max(fy[j],(Math.sqrt((((4 * r) * r) - (dx * dx))) + fy[i])); }} StringBuilder stb = new StringBuilder(); for ( int i = 0;(i < xs.length);i++) {stb.append((fy[i] + " ")); }System.out.println(stb); } }
0	public class A{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  int n = scan.nextInt(); if ( ((n % 2) == 0)) {System.out.println(((4 + " ") + (n - 4))); } else {System.out.println(((9 + " ") + (n - 9))); }} }
6	public class Main{ static private StreamTokenizer in ; static private PrintWriter out ; {in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); }static private int nextInt()throws Exception { in.nextToken(); return (int)in.nval;} public static void main( String[] args)throws Exception { int n = nextInt(),k = nextInt(),A = nextInt(),r = ((n + k) - 1);  int[][] s = new int[n][]; for ( int i = 0;(i < n);i++) {s[i] = new int[]{nextInt(),nextInt()}; } double max = 0;  int[] prb = new int[n]; for ( int u = (1 << r);(u >= 0);u--) { int ones = 0; for ( int i = 0;(i < r);i++) {if ( ((u & (1 << i)) != 0)) {ones++; } }if ( (ones != (n - 1))) {continue;} ones = 0; int p = 0; for ( int i = 0;(i < r);i++) {if ( ((u & (1 << i)) == 0)) {ones++; } else {prb[p] = (ones * 10); p++; ones = 0; }}prb[p] = (ones * 10); p++; ones = 0; double sum = 0; for ( int i = 0;(i < n);i++) {if ( (prb[i] > (100 - s[i][1]))) prb[i] = (100 - s[i][1]); s[i][1] = (prb[i] + s[i][1]); }for ( int i = ((1 << n) - 1);(i >= 0);i--) { double prob = 1;  int lvl = 0;  int kill = 0; for ( int j = 0;(j < n);j++) {if ( ((i & (1 << j)) != 0)) {prob *= (s[j][1] / 100.0); kill--; } else {lvl += s[j][0]; prob *= (1 - (s[j][1] / 100.0)); kill++; }}if ( (kill >= 0)) {sum += (prob * ((double)A / (A + lvl))); } else {sum += prob; }}for ( int i = 0;(i < n);i++) {s[i][1] = (-prb[i] + s[i][1]); }max = Math.max(max,sum); }out.println(max); out.flush(); } }
6	public class ProblemE_16{ final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null); BufferedReader in ; PrintWriter out ; StringTokenizer tok = new StringTokenizer(""); void init()throws FileNotFoundException { 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());} double readDouble()throws IOException { return Double.parseDouble(readString());} public static void main( String[] args){ new ProblemE_16().run(); } 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); } } void solve()throws IOException { int n = readInt();  double[][] a = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {a[i][j] = readDouble(); }} double[] d = new double[(1 << n)]; d[((1 << n) - 1)] = 1; for ( int i = ((1 << n) - 1);(i > 0);i--) { ArrayList<Integer> list = new ArrayList<Integer>(); for ( int j = 0;(j < n);j++) {if ( ((i & (1 << j)) != 0)) list.add(j); } double s = 0; for ( int j = 0;(j < list.size());j++) {s = 0; for ( int k = 0;(k < list.size());k++) {s += a[list.get(k)][list.get(j)]; }d[(i ^ (1 << list.get(j)))] += ((((s * d[i]) * 2) / list.size()) / (list.size() - 1)); }}for ( int i = 0;(i < n);i++) {out.printf(Locale.US,"%.9f",d[(1 << i)]); out.print(" "); }} static int[][] step8 = {{-1,0},{1,0},{0,-1},{0,1},{-1,-1},{1,-1},{-1,1},{1,1}}; static int[][] stepKnight = {{-2,-1},{-2,1},{-1,-2},{-1,2},{1,-2},{1,2},{2,-1},{2,1}}; static long gcd( long a, long b){ if ( (a == 0)) return b; return gcd((b % a),a);} static long lcm( long a, long b){ return ((a / gcd(a,b)) * b);} static long[] gcdPlus( long a, long b){ long[] d = new long[3]; if ( (a == 0)) {d[0] = b; d[1] = 0; d[2] = 1; } else {d = gcdPlus((b % a),a); long r = d[1]; d[1] = (d[2] - ((b / a) * d[1])); d[2] = r; }return d;} static long binpow( long a, int n){ if ( (n == 0)) return 1; if ( ((n & 1) == 0)) { long b = binpow(a,(n / 2)); return (b * b);} else return (binpow(a,(n - 1)) * a);} static long binpowmod( long a, int n, long m){ if ( (m == 1)) return 0; if ( (n == 0)) return 1; if ( ((n & 1) == 0)) { long b = binpowmod(a,(n / 2),m); return ((b * b) % m);} else return ((binpowmod(a,(n - 1),m) * a) % m);} static long f( long n, int x, int k){ if ( (n == 0)) return 1; long b = binpow(10,(x - 1));  long c = (n / b); return ((((c < k)?c:k) * binpow(k,(x - 1))) + (((c < k)?1:0) * f((n % b),(x - 1),k)));} static long fib( int n){ if ( (n == 0)) return 0; if ( ((n & 1) == 0)) { long f1 = fib(((n / 2) - 1));  long f2 = fib(((n / 2) + 1)); return ((f2 * f2) - (f1 * f1));} else { long f1 = fib((n / 2));  long f2 = fib(((n / 2) + 1)); return ((f1 * f1) + (f2 * f2));}} static BigInteger BigFib( int n){ if ( (n == 0)) return BigInteger.ZERO; if ( ((n & 1) == 0)) { BigInteger f1 = BigFib(((n / 2) - 1)); f1 = f1.multiply(f1); BigInteger f2 = BigFib(((n / 2) + 1)); f2 = f2.multiply(f2); return f2.subtract(f1);} else { BigInteger f1 = BigFib((n / 2)); f1 = f1.multiply(f1); BigInteger f2 = BigFib(((n / 2) + 1)); f2 = f2.multiply(f2); return f2.add(f1);}} static double d2( Point p1, Point p2){ return (((p1.x - p2.x) * (p1.x - p2.x)) + ((p1.y - p2.y) * (p1.y - p2.y)));} public static double d2( PointD p1, PointD p2){ return (((p1.x - p2.x) * (p1.x - p2.x)) + ((p1.y - p2.y) * (p1.y - p2.y)));} static int[] Sieve( int n){ boolean[] b = new boolean[(n + 1)]; Arrays.fill(b,true); b[0] = false; b[1] = false; long nLong = n;  int j = 0; for ( int i = 1;(i <= n);i++) {if ( b[i]) {j++; if ( (((long)i * i) <= nLong)) {for ( int k = (i * i);(k <= n);k += i) {b[k] = false; }} } } int[] p = new int[j]; Arrays.fill(p,0); j = 0; for ( int i = 2;(i <= n);i++) {if ( b[i]) {p[j] = i; j++; } }return p;} public static class Fraction implements Comparable<Fraction>,Cloneable{ public final Fraction FRACTION_ZERO = new Fraction(); public final Fraction FRACTION_ONE = new Fraction(1); public long numerator = 0; public long denominator = 1; public Fraction(){ numerator = 0; denominator = 1; } public Fraction( long numerator){ this.numerator = numerator; denominator = 1; } public Fraction( long numerator, long denominator){ this.numerator = numerator; this.denominator = denominator; Cancellation(); } public Fraction( double numerator, double denominator, int accuracy){ this.numerator = (long)(numerator * pow(10,accuracy)); this.denominator = (long)(denominator * pow(10,accuracy)); Cancellation(); } public Fraction( String s){ if ( (s.charAt(0) == '-')) {denominator = -1; s = s.substring(1); } if ( (s.indexOf("/") != -1)) {denominator *= Integer.parseInt(s.substring((s.indexOf("/") + 1))); } if ( (s.indexOf(" ") != -1)) {numerator = ((Integer.parseInt(s.substring(0,s.indexOf(" "))) * abs(denominator)) + Integer.parseInt(s.substring((s.indexOf(" ") + 1),s.indexOf("/")))); } else {if ( (s.indexOf("/") != -1)) {numerator = Integer.parseInt(s.substring(0,s.indexOf("/"))); } else {numerator = (Integer.parseInt(s) * abs(denominator)); }}this.Cancellation(); } void Cancellation(){ long g = gcd(abs(numerator),abs(denominator)); numerator /= g; denominator /= g; if ( (denominator < 0)) {numerator *= -1; denominator *= -1; } } public String toString(){ String s = ""; if ( (numerator == 0)) {return "0";} if ( (numerator < 0)) {s += "-"; } if ( (abs(numerator) >= denominator)) {s += (Long.toString((abs(numerator) / denominator)) + " "); } if ( ((abs(numerator) % denominator) != 0)) {s += Long.toString((abs(numerator) % denominator)); } else {s = s.substring(0,(s.length() - 1)); }if ( (denominator != 1)) {s += ("/" + Long.toString(denominator)); } return s;} public Fraction add( Fraction f){ Fraction fResult = new Fraction(); fResult.denominator = lcm(denominator,f.denominator); fResult.numerator = (((numerator * fResult.denominator) / denominator) + ((f.numerator * fResult.denominator) / f.denominator)); fResult.Cancellation(); return fResult;} public Fraction subtract( Fraction f){ Fraction fResult = new Fraction(); fResult.denominator = lcm(denominator,f.denominator); fResult.numerator = (((numerator * fResult.denominator) / denominator) - ((f.numerator * fResult.denominator) / f.denominator)); fResult.Cancellation(); return fResult;} public Fraction multiply( Fraction f){ Fraction fResult = new Fraction(); fResult.numerator = (numerator * f.numerator); fResult.denominator = (denominator * f.denominator); fResult.Cancellation(); return fResult;} public Fraction clone(){ Fraction fResult = new Fraction(numerator,denominator); return fResult;} public Fraction ceil(){ Fraction fResult = this.clone(); fResult.numerator = (((fResult.numerator / fResult.denominator) + 1) * fResult.denominator); return fResult;} public Fraction binpow( int n){ if ( (n == 0)) return FRACTION_ONE; if ( ((n & 1) == 0)) { Fraction f = this.binpow((n / 2)); return f.multiply(f);} else return binpow((n - 1)).multiply(this);} } }
5	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, InputReader in, OutputWriter out){ int n = in.nextInt();  long k = in.nextInt(); if ( (k == 1)) {out.println(n); return ;} long[] a = in.nextLongArray(n); ArrayUtils.safeSort(a); Map<Long,Integer> map = new TreeMap<Long,Integer>(); for ( int i = 0;(i < n);i++) {map.put(a[i],i); } int answer = 0;  boolean[] visited = new boolean[n]; for ( int i = 0;(i < n);i++) {if ( !visited[i]) {visited[i] = true; int count = 1;  long cur = a[i]; while(true){cur *= k; Integer index = map.get(cur); if ( (index == null)) break; visited[index] = true; count++; }answer += NumberUtils.upDiv(count,2); } }out.println(answer); } } class InputReader{ private InputStream stream ; private byte[] buf = new byte[(1 << 16)]; private int curChar ; private int 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 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 & 15); c = read(); }while(!isSpaceChar(c));return (res * sgn);} public static boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} 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 & 15); c = read(); }while(!isSpaceChar(c));return (res * sgn);} public long[] nextLongArray( int count){ long[] result = new long[count]; for ( int i = 0;(i < count);i++) {result[i] = nextLong(); }return result;} } class OutputWriter{ private PrintWriter writer ; public OutputWriter( OutputStream stream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void println( int i){ writer.println(i); } public void close(){ writer.close(); } }
2	public class D{ public static void main( String[] args){ Scanner s = new Scanner(System.in);  long l = s.nextLong();  long r = s.nextLong();  long a = (l ^ r);  long b = a; while((b != 0)){a = b; b = ((b - 1) & b); }if ( (a != 0)) {a = ((a << 1) - 1); } System.out.println(a); } }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputScanner in = new InputScanner(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, InputScanner in, PrintWriter out){ int[] arr = in.readIntArr();  int n = arr[0];  int r = arr[1];  int[] x = in.readIntArr(); for ( int i = 0;(i < n);i++) {x[i] += 999; } double[] h = new double[n];  int dsk[] = new int[3000]; Arrays.fill(dsk,-1); for ( int i = 0;(i < r);i++) {dsk[(x[0] + i)] = 0; dsk[((x[0] - i) - 1)] = 0; } int rs = ((4 * r) * r); h[0] = r; for ( int i = 1;(i < n);i++) { double ch = r; for ( int j = 0;(j < r);j++) {if ( (dsk[(x[i] + j)] != -1)) { int ind = dsk[(x[i] + j)];  int diff = (x[ind] - x[i]);  int diffs = (diff * diff);  int hs = (rs - diffs); ch = Math.max(ch,(h[ind] + Math.sqrt(hs))); } if ( (dsk[((x[i] - j) - 1)] != -1)) { int ind = dsk[((x[i] - j) - 1)];  int diff = (x[ind] - x[i]);  int diffs = (diff * diff);  int hs = (rs - diffs); ch = Math.max(ch,(h[ind] + Math.sqrt(hs))); } }if ( ((x[i] + r) < 3000)) {if ( (dsk[(x[i] + r)] != -1)) {ch = Math.max(ch,h[dsk[(x[i] + r)]]); } } if ( (((x[i] - r) - 1) > 0)) {if ( (dsk[((x[i] - r) - 1)] != -1)) {ch = Math.max(ch,h[dsk[((x[i] - r) - 1)]]); } } for ( int j = 0;(j < r);j++) {dsk[(x[i] + j)] = i; dsk[((x[i] - j) - 1)] = i; }h[i] = ch; }for ( int i = 0;(i < n);i++) {out.print((h[i] + " ")); }out.println(); } } static class InputScanner{ BufferedReader br ; public InputScanner( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); } String readLine(){ String line = null; try{line = br.readLine(); }catch (IOException e){ e.printStackTrace(); } return line;} public String[] readStringArr(){ return readLine().split(" ");} public int[] readIntArr(){ String[] str = readStringArr();  int arr[] = new int[str.length]; for ( int i = 0;(i < arr.length);i++) arr[i] = Integer.parseInt(str[i]); return arr;} } }
5	public class Main{ public static void main( String[] args){ Scanner input = new Scanner(System.in);  int n = input.nextInt();  long k = input.nextInt();  long[] nums = new long[n]; for ( int i = 0;(i < n);i++) {nums[i] = input.nextInt(); }Arrays.sort(nums); Set<Long> wrong = new TreeSet<Long>();  long ans = 0; for ( int i = 0;(i < n);i++) {if ( !wrong.contains(nums[i])) {try{wrong.add((nums[i] * k)); }catch (Exception e){ } ans++; } }System.out.println(ans); } }
6	public class cf16e{ static int n ; static double[][] prob ; static double[] memo ; public static void main( String[] args){ Scanner in = new Scanner(System.in); n = in.nextInt(); prob = new double[n][n]; memo = new double[(1 << n)]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) prob[i][j] = in.nextDouble(); memo[((1 << n) - 1)] = 1; for ( int k = ((1 << n) - 1);(k > 0);k--) { int numWays = Integer.bitCount(k); numWays = ((numWays * (numWays - 1)) / 2); for ( int first = 0;(first < n);first++) {if ( !isSet(k,first)) continue; for ( int second = (first + 1);(second < n);second++) {if ( !isSet(k,second)) continue; memo[reset(k,first)] += ((prob[second][first] * memo[k]) / numWays); memo[reset(k,second)] += ((prob[first][second] * memo[k]) / numWays); }}}for ( int i = 0;(i < n);i++) System.out.printf("%.6f ",memo[set(0,i)]); System.out.println(); } static boolean isSet( int x, int p){ return ((x & (1 << p)) != 0);} static int set( int x, int p){ return (x | (1 << p));} static int reset( int x, int p){ return (x & (1 << p));} }
2	public class A{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); double EPS = 1e-9; int mod = ((int)1e9 + 9); long n ,m ,k ; void run(){ n = sc.nextLong(); m = sc.nextLong(); k = sc.nextLong(); solve(); } void solve(){ long ans = 0;  long s = (n - m);  long remain = max((n - (s * k)),0); ans = (m - remain); long r = (remain % k); ans = ((ans + r) % mod); remain -= r; long a = (remain / k);  long add = (((((powMod(2,a,mod) - 1) * k) % mod) * 2) % mod); ans = ((ans + add) % mod); println((ans + "")); } long powMod( long x, long k, long mod){ if ( (k == 0)) {return (1 % mod);} else if ( ((k % 2) == 0)) {return powMod(((x * x) % mod),(k / 2),mod);} else {return ((x * powMod(x,(k - 1),mod)) % mod);}} void println( String s){ System.out.println(s); } void print( String s){ System.out.print(s); } public static void main( String[] args){ Locale.setDefault(Locale.US); new A().run(); } }
3	public class C{ static int n ; static double sqr( double v){ return (v * v);} static double sqrt( double v){ return Math.sqrt(v);} static double r ,x[] ,res[] ; static void MainMethod()throws Exception { n = reader.nextInt(); r = reader.nextDouble(); int i ,j ; x = new double[n]; res = new double[n]; for ( i = 0;(i < n);i++) x[i] = reader.nextDouble(); res[0] = r; for ( i = 1;(i < n);i++) {res[i] = r; for ( j = 0;(j < i);j++) {if ( (Math.abs((x[i] - x[j])) <= (2 * r))) {res[i] = Math.max(res[i],(sqrt((sqr((2 * r)) - sqr((x[i] - x[j])))) + res[j])); } }}for ( i = 0;(i < n);i++) printer.print((res[i] + " ")); } public static void main( String[] args)throws Exception { MainMethod(); printer.close(); } static PrintWriter printer = new PrintWriter(new OutputStreamWriter(System.out)); }
3	public class MainG{ static StdIn in = new StdIn(); static PrintWriter out = new PrintWriter(System.out); static long M = ((long)1e9 + 7); public static void main( String[] args){ char[] cs = in.next().toCharArray();  int n = cs.length;  int[] x = new int[n]; for ( int i = 0;(i < n);++i) x[i] = (cs[i] - '0'); long[] dp1 = new long[(n + 1)]; for ( int i = 0;(i < n);++i) dp1[(i + 1)] = ((x[i] + (dp1[i] * 10)) % M); long ans = 0; for ( int d1 = 1;(d1 <= 9);++d1) { long[][] dp2 = new long[2][(n + 1)]; for ( int i = 0;(i < n);++i) {dp2[0][(i + 1)] = ((x[i] >= d1)?(((10 * dp2[0][i]) + 1) % M):dp2[0][i]); dp2[1][(i + 1)] = ((x[i] >= d1)?(((10 * dp2[1][i]) + dp1[i]) % M):dp2[1][i]); for ( int d2 = 0;(d2 < x[i]);++d2) dp2[1][(i + 1)] = ((((d2 >= d1)?(((10 * (dp2[0][i] + dp2[1][i])) + dp1[i]) + 1):(dp2[0][i] + dp2[1][i])) + dp2[1][(i + 1)]) % M); for ( int d2 = (x[i] + 1);(d2 <= 9);++d2) dp2[1][(i + 1)] = ((((d2 >= d1)?((10 * dp2[1][i]) + dp1[i]):dp2[1][i]) + dp2[1][(i + 1)]) % M); }ans += (dp2[0][n] + dp2[1][n]); }out.println((ans % M)); out.close(); } interface Input{ public String next(); ; public int nextInt(); public long nextLong(); ; } static class StdIn implements Input{ private final int BUFFER_SIZE = (1 << 16); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ,bytesRead ; public StdIn(){ din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public StdIn( InputStream in){ try{din = new DataInputStream(in); }catch (Exception e){ throw (new RuntimeException());} buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String next(){ int c ; while((((c = read()) != -1) && (((c == ' ') || (c == '\n')) || (c == '\r')))); StringBuilder s = new StringBuilder(); while((c != -1)){if ( (((c == ' ') || (c == '\n')) || (c == '\r'))) break; s.append((char)c); c = read(); }return s.toString();} public int nextInt(){ 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(){ 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;} private void fillBuffer()throws IOException { bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) buffer[0] = -1; } private byte read(){ try{if ( (bufferPointer == bytesRead)) fillBuffer(); return buffer[bufferPointer++]; }catch (IOException e){ throw (new RuntimeException());} } public void close()throws IOException { if ( (din == null)) return ; din.close(); } } }
4	public class Round568G{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni(),T = ni();  int mod = 1000000007;  int[][] a = new int[3][n];  int[] ap = new int[3]; for ( int i = 0;(i < n);i++) { int t = ni();  int k = (ni() - 1); a[k][ap[k]++] = t; }for ( int i = 0;(i < 3);i++) a[i] = Arrays.copyOf(a[i],ap[i]); long[][][][] com = new long[3][(ap[0] + 2)][(ap[1] + 2)][(ap[2] + 2)]; com[0][1][0][0] = com[1][0][1][0] = com[2][0][0][1] = 1; for ( int i = 0;(i <= ap[0]);i++) {for ( int j = 0;(j <= ap[1]);j++) {for ( int k = 0;(k <= ap[2]);k++) {for ( int u = 0;(u < 3);u++) {if ( (u != 0)) {com[0][(i + 1)][j][k] += com[u][i][j][k]; if ( (com[0][(i + 1)][j][k] >= mod)) com[0][(i + 1)][j][k] -= mod; } if ( (u != 1)) {com[1][i][(j + 1)][k] += com[u][i][j][k]; if ( (com[1][i][(j + 1)][k] >= mod)) com[1][i][(j + 1)][k] -= mod; } if ( (u != 2)) {com[2][i][j][(k + 1)] += com[u][i][j][k]; if ( (com[2][i][j][(k + 1)] >= mod)) com[2][i][j][(k + 1)] -= mod; } }}}} int[][] fif = enumFIF(200,mod);  long[][][] dp = new long[3][][]; for ( int i = 0;(i < 3);i++) { int s = 0; for ( int v :a[i]) s += v; dp[i] = new long[(ap[i] + 1)][(s + 1)]; dp[i][0][0] = 1; for ( int v :a[i]) {for ( int j = (ap[i] - 1);(j >= 0);j--) {for ( int k = (s - v);(k >= 0);k--) {dp[i][(j + 1)][(k + v)] += dp[i][j][k]; if ( (dp[i][(j + 1)][(k + v)] >= mod)) dp[i][(j + 1)][(k + v)] -= mod; }}}} long[][][] con = new long[(ap[0] + 1)][(ap[1] + 1)][2501]; for ( int i = 0;(i <= ap[0]);i++) {for ( int j = 0;(j <= ap[1]);j++) {for ( int k = 0;(k < dp[0][i].length);k++) {if ( (dp[0][i][k] == 0)) continue; for ( int l = 0;(l < dp[1][j].length);l++) {con[i][j][(k + l)] += (dp[0][i][k] * dp[1][j][l]); con[i][j][(k + l)] %= mod; }}}} long ans = 0; for ( int i = 0;(i <= ap[0]);i++) {for ( int j = 0;(j <= ap[1]);j++) {for ( int k = 0;(k <= ap[2]);k++) { long base = ((((((((com[0][i][j][k] + com[1][i][j][k]) + com[2][i][j][k]) * fif[0][i]) % mod) * fif[0][j]) % mod) * fif[0][k]) % mod);  long ls = 0; for ( int l = 0;(l <= T);l++) {if ( ((T - l) < dp[2][k].length)) {ls += (con[i][j][l] * dp[2][k][(T - l)]); ls %= mod; } }ans += (base * ls); ans %= mod; }}}out.println(ans); } public static int[][] enumFIF( int n, int mod){ int[] f = new int[(n + 1)];  int[] invf = new int[(n + 1)]; f[0] = 1; for ( int i = 1;(i <= n);i++) {f[i] = (int)(((long)f[(i - 1)] * i) % mod); } long a = f[n];  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)); }invf[n] = (int)((p < 0)?(p + mod):p); for ( int i = (n - 1);(i >= 0);i--) {invf[i] = (int)(((long)invf[(i + 1)] * (i + 1)) % mod); }return new int[][]{f,invf};} 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 Round568G().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
2	public class P_1177B{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  long k = scan.nextLong();  long k2 = (k - 10);  int cont = 1,pos ;  String out ; if ( (k <= 9)) System.out.println(k); else {cont++; while((k2 >= (cont * (long)(Math.pow(10,cont) - Math.pow(10,(cont - 1)))))){k2 -= (cont * (long)(Math.pow(10,cont) - Math.pow(10,(cont - 1)))); cont++; }pos = (int)(k2 % cont); k2 /= cont; k2 += (long)Math.pow(10,(cont - 1)); out = String.valueOf(k2); System.out.println(out.charAt(pos)); }} }
0	public class A{ public static void main( String[] args){ System.out.println(25); } }
4	public class Main{ static FastScanner fs = new FastScanner(); static class FastScanner{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next(){ while(!st.hasMoreElements())try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } return st.nextToken();} int Int(){ return Integer.parseInt(next());} long Long(){ return Long.parseLong(next());} String Str(){ return next();} } public static void main( String[] args)throws java.lang.Exception { PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  int T = 1; for ( int t = 0;(t < T);t++) { int n = Int(),m = Int();  Solution sol = new Solution(out); sol.solution(n,m); }out.close(); } public static int Int(){ return fs.Int();} public static long Long(){ return fs.Long();} public static String Str(){ return fs.Str();} } class Solution{ PrintWriter out ; public Solution( PrintWriter out){ this.out = out; } public void solution( int n, int mod){ long res = 0;  long ncr[][] = new long[501][501];  long pow[] = new long[501]; pow[0] = 1; for ( int i = 1;(i < pow.length);i++) {pow[i] = ((pow[(i - 1)] * 2) % mod); }ncr[0][0] = 1; for ( int i = 1;(i < ncr.length);i++) {ncr[i][0] = 1; for ( int j = 1;(j < ncr[0].length);j++) {ncr[i][j] = ((ncr[(i - 1)][j] + ncr[(i - 1)][(j - 1)]) % mod); }} long dp[][] = new long[(n + 1)][(n + 1)]; for ( int i = 1;(i < dp.length);i++) {dp[i][i] = pow[(i - 1)]; for ( int j = 1;(j < i);j++) {for ( int k = 1;(k < i);k++) {if ( ((((i - k) - 1) >= 1) && (j >= k))) {dp[i][j] = (dp[i][j] + (dp[((i - k) - 1)][(j - k)] * ((ncr[j][k] * pow[(k - 1)]) % mod))); dp[i][j] %= mod; } }}}for ( int i = 1;(i <= n);i++) {res += dp[n][i]; res %= mod; }out.println(res); } }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader inp = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  Solver solver = new Solver(); solver.solve(inp,out); out.close(); } static class Solver{ class Node implements Comparable<Node>{ int i ; int cnt ; Node( int i, int cnt){ this.i = i; this.cnt = cnt; } } public int findSet( int i, int[] par){ int x = i;  boolean flag = false; while((par[i] >= 0)){flag = true; i = par[i]; }if ( flag) par[x] = i; return i;} public long pow( long a, long b, long MOD){ if ( (b == 0)) {return 1;} if ( (b == 1)) {return a;} long val = pow(a,(b / 2),MOD); if ( ((b % 2) == 0)) {return ((val * val) % MOD);} else {return ((val * ((val * a) % MOD)) % MOD);}} public void remove( ArrayList<Integer>[] al, int x){ for ( int i = 0;(i < al.length);i++) {for ( int j = 0;(j < al[i].size());j++) {if ( (al[i].get(j) == x)) al[i].remove(j); }}} public long gcd( long a, long b){ if ( (a == 0)) return b; return gcd((b % a),a);} public static long constructSegment( long[] seg, long[] arr, int low, int high, int pos){ if ( (low == high)) {seg[pos] = arr[low]; return seg[pos];} int mid = ((low + high) / 2);  long t1 = constructSegment(seg,arr,low,mid,((2 * pos) + 1));  long t2 = constructSegment(seg,arr,(mid + 1),high,((2 * pos) + 2)); seg[pos] = (t1 + t2); return seg[pos];} public static long querySegment( long[] seg, int low, int high, int qlow, int qhigh, int pos){ if ( ((qlow <= low) && (qhigh >= high))) {return seg[pos];} else if ( ((qlow > high) || (qhigh < low))) {return 0;} else { long ans = 0;  int mid = ((low + high) / 2); ans += querySegment(seg,low,mid,qlow,qhigh,((2 * pos) + 1)); ans += querySegment(seg,(mid + 1),high,qlow,qhigh,((2 * pos) + 2)); return ans;}} public static int lcs( char[] X, char[] Y, int m, int n){ if ( ((m == 0) || (n == 0))) return 0; if ( (X[(m - 1)] == Y[(n - 1)])) return (1 + lcs(X,Y,(m - 1),(n - 1))); else return Integer.max(lcs(X,Y,m,(n - 1)),lcs(X,Y,(m - 1),n));} public static long recursion( long start, long end, long[] cnt, int a, int b){ long min = 0;  long count = 0;  int ans1 = -1;  int ans2 = -1;  int l = 0;  int r = (cnt.length - 1); while((l <= r)){ int mid = ((l + r) / 2); if ( (cnt[mid] >= start)) {ans1 = mid; r = (mid - 1); } else {l = (mid + 1); }}l = 0; r = (cnt.length - 1); while((l <= r)){ int mid = ((l + r) / 2); if ( (cnt[mid] <= end)) {ans2 = mid; l = (mid + 1); } else {r = (mid - 1); }}if ( (((ans1 == -1) || (ans2 == -1)) || (ans2 < ans1))) {min = a; return a;} else {min = ((b * ((end - start) + 1)) * ((ans2 - ans1) + 1)); }if ( (start == end)) {return min;} long mid = ((end + start) / 2); min = Long.min(min,(recursion(start,mid,cnt,a,b) + recursion((mid + 1),end,cnt,a,b))); return min;} public int dfs_util( ArrayList<Integer>[] al, boolean[] vis, int x, int[] s, int[] lvl){ vis[x] = true; int cnt = 1; for ( int i = 0;(i < al[x].size());i++) {if ( !vis[al[x].get(i)]) {lvl[al[x].get(i)] = (lvl[x] + 1); cnt += dfs_util(al,vis,al[x].get(i),s,lvl); } }s[x] = cnt; return s[x];} private void solve( InputReader inp, PrintWriter out1){ int n = inp.nextInt();  int m = inp.nextInt();  long k = inp.nextLong();  long arr[] = new long[n]; for ( int i = 0;(i < n);i++) {arr[i] = inp.nextLong(); } long ans = 0; for ( int i = 0;(i < m);i++) { long sum = 0; for ( int j = i;(j < n);j++) {if ( ((j % m) == i)) {if ( (sum < 0)) {sum = 0; } sum -= k; } sum += arr[j]; ans = Math.max(ans,sum); }}System.out.println(ans); } } static class InputReader{ BufferedReader reader ; StringTokenizer tokenizer ; InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream),32768); tokenizer = null; } 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());} public long nextLong(){ return Long.parseLong(next());} } }
4	public class B{ static int n ,t[] ,g[] ,MOD = ((int)1e9 + 7); static int[][][] memo1 ,memo2[] ,memo3[] ; static int dp1( int idx, int remCnt, int remSum){ if ( (idx == n)) return (((remSum == 0) && (remCnt == 0))?1:0); if ( ((remCnt < 0) || (remSum < 0))) return 0; if ( (memo1[idx][remCnt][remSum] != -1)) return memo1[idx][remCnt][remSum]; int ans = dp1((idx + 1),remCnt,remSum); if ( (g[idx] == 0)) {ans += dp1((idx + 1),(remCnt - 1),(remSum - t[idx])); if ( (ans >= MOD)) ans -= MOD; } return memo1[idx][remCnt][remSum] = ans;} static int dp2( int idx, int remCnt1, int remCnt2, int remSum){ if ( (idx == n)) return ((((remSum == 0) && (remCnt1 == 0)) && (remCnt2 == 0))?1:0); if ( (((remSum < 0) || (remCnt1 < 0)) || (remCnt2 < 0))) return 0; if ( (memo2[idx][remCnt1][remCnt2][remSum] != -1)) return memo2[idx][remCnt1][remCnt2][remSum]; int ans = dp2((idx + 1),remCnt1,remCnt2,remSum); if ( (g[idx] == 1)) ans += dp2((idx + 1),(remCnt1 - 1),remCnt2,(remSum - t[idx])); else if ( (g[idx] == 2)) ans += dp2((idx + 1),remCnt1,(remCnt2 - 1),(remSum - t[idx])); if ( (ans >= MOD)) ans -= MOD; return memo2[idx][remCnt1][remCnt2][remSum] = ans;} static private int dp3( int cnt0, int cnt1, int cnt2, int last){ if ( (((cnt0 < 0) || (cnt1 < 0)) || (cnt2 < 0))) return 0; if ( (((cnt0 + cnt1) + cnt2) == 0)) return 1; if ( (memo3[last][cnt0][cnt1][cnt2] != -1)) return memo3[last][cnt0][cnt1][cnt2]; long ans = 0; if ( (last != 0)) ans += dp3((cnt0 - 1),cnt1,cnt2,0); if ( (last != 1)) ans += dp3(cnt0,(cnt1 - 1),cnt2,1); if ( (last != 2)) ans += dp3(cnt0,cnt1,(cnt2 - 1),2); return memo3[last][cnt0][cnt1][cnt2] = (int)(ans % MOD);} public static void main( String[] args)throws IOException { Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out); n = sc.nextInt(); int[] fac = new int[(n + 1)]; t = new int[n]; g = new int[n]; int[] cnt = new int[3]; fac[0] = 1; for ( int i = 1;(i <= n);i++) fac[i] = (int)(((i * 1L) * fac[(i - 1)]) % MOD); int T = sc.nextInt(); for ( int i = 0;(i < n);i++) {t[i] = sc.nextInt(); g[i] = (sc.nextInt() - 1); cnt[g[i]]++; }memo1 = new int[n][(cnt[0] + 1)][(T + 1)]; memo2 = new int[n][(cnt[1] + 1)][(cnt[2] + 1)][(T + 1)]; memo3 = new int[4][(cnt[0] + 1)][(cnt[1] + 1)][(cnt[2] + 1)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= cnt[0]);j++) Arrays.fill(memo1[i][j],-1); for ( int j = 0;(j <= cnt[1]);j++) for ( int k = 0;(k <= cnt[2]);k++) Arrays.fill(memo2[i][j][k],-1); }for ( int i = 0;(i < 4);i++) for ( int j = 0;(j <= cnt[0]);j++) for ( int k = 0;(k <= cnt[1]);k++) Arrays.fill(memo3[i][j][k],-1); int ans = 0; for ( int cnt0 = 0;(cnt0 <= cnt[0]);cnt0++) for ( int sum0 = 0;(sum0 <= T);sum0++) for ( int cnt1 = 0;(cnt1 <= cnt[1]);cnt1++) for ( int cnt2 = 0;(cnt2 <= cnt[2]);cnt2++) { long ways = (((dp1(0,cnt0,sum0) * 1L) * dp2(0,cnt1,cnt2,(T - sum0))) % MOD); ways = ((ways * dp3(cnt0,cnt1,cnt2,3)) % MOD); ways *= fac[cnt0]; ways %= MOD; ways *= fac[cnt1]; ways %= MOD; ways *= fac[cnt2]; ways %= MOD; ans += ways; if ( (ans >= MOD)) ans -= MOD; }out.println(ans); out.close(); } static class Scanner{ BufferedReader br ; StringTokenizer st ; Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } Scanner( String fileName)throws FileNotFoundException{ br = new BufferedReader(new FileReader(fileName)); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} boolean ready()throws IOException { return br.ready();} } }
1	public class NickAndArray{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int array[] = new int[n];  int max = Integer.MAX_VALUE;  int index = 0; for ( int i = 0;(i < n);i++) { int k = sc.nextInt(); array[i] = k; if ( (array[i] >= 0)) {array[i] = (-array[i] - 1); } if ( (array[i] < max)) {max = array[i]; index = i; } }if ( ((n % 2) != 0)) {array[index] = (-array[index] - 1); } for ( int i = 0;(i < n);i++) {System.out.print((array[i] + " ")); }} }
4	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ static private final int MOD = ((int)1e9 + 7); public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  int[] primes = getPrimes(40_000);  int[][] a = new int[n][]; for ( int i = 0;(i < n);++i) { int x = in.nextInt();  IntList divs = new IntList(); for ( int j :primes) {if ( ((j * j) > x)) {break;} int cnt = 0; while(((x % j) == 0)){cnt++; x /= j; }if ( ((cnt % 2) == 1)) {divs.add(j); } }if ( (x > 1)) {divs.add(x); } a[i] = divs.toArray(); } Comparator<int[]> cmp = (o1,o2)->{for ( int i = 0;((i < o1.length) && (i < o2.length));++i) {if ( (o1[i] < o2[i])) {return -1;} else if ( (o2[i] < o1[i])) {return 1;} }return Integer.compare(o1.length,o2.length);}; Arrays.sort(a,cmp); IntList freqsList = new IntList();  int cnt = 1; for ( int i = 1;(i < n);++i) {if ( (cmp.compare(a[i],a[(i - 1)]) == 0)) {cnt++; } else {freqsList.add(cnt); cnt = 1; }}freqsList.add(cnt); int[][] comb = new int[((2 * n) + 1)][((2 * n) + 1)]; for ( int i = 0;(i < comb.length);++i) {comb[i][0] = 1; for ( int j = 1;(j <= i);++j) {comb[i][j] = ((comb[(i - 1)][j] + comb[(i - 1)][(j - 1)]) % MOD); }} int[] dp = new int[n];  int[] ndp = new int[n]; dp[0] = 1; int total = 0;  int ans = 1; for ( int x :freqsList.toArray()) {Arrays.fill(ndp,0); for ( int bad = 0;(bad < n);++bad) {if ( (dp[bad] == 0)) {continue;} for ( int putSeparately = 1;(putSeparately <= x);++putSeparately) {for ( int breakEq = 0;(breakEq <= putSeparately);++breakEq) { int nState = (((bad + x) - putSeparately) - breakEq); if ( ((nState < 0) || (nState >= n))) {continue;} int rem = ((total + 1) - bad);  int notBreak = (putSeparately - breakEq); if ( ((breakEq > bad) || (notBreak > rem))) {continue;} int add = (int)(((((((long)comb[bad][breakEq] * comb[rem][notBreak]) % MOD) * comb[(x - 1)][(putSeparately - 1)]) % MOD) * dp[bad]) % MOD); ndp[nState] += add; ndp[nState] %= MOD; }}}total += x; int[] aux = dp; dp = ndp; ndp = aux; ans = (int)(((long)ans * fact(x)) % MOD); }ans = (int)(((long)ans * dp[0]) % MOD); out.println(ans); } private int fact( int n){ int res = 1; for ( int i = 2;(i <= n);++i) {res = (int)(((long)res * i) % MOD); }return res;} private int[] getPrimes( int n){ boolean[] isPrime = new boolean[(n + 1)]; Arrays.fill(isPrime,2,isPrime.length,true); for ( int i = 2;((i * i) <= n);++i) {if ( isPrime[i]) {for ( int j = (i * i);(j <= n);j += i) {isPrime[j] = false; }} } IntList primes = new IntList(); for ( int i = 2;(i <= n);++i) {if ( isPrime[i]) {primes.add(i); } }return primes.toArray();} } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } public int read(){ if ( (numChars == -1)) throw (new UnknownError()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = stream.read(buf); }catch (IOException e){ throw (new UnknownError());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} public int nextInt(){ return Integer.parseInt(next());} public String next(){ 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));} } static interface IntIterator extends Iterator<Integer>{ } static class IntList implements Iterable<Integer>{ int[] elem ; int size ; public IntList(){ this(0,0,1); } public IntList( int size){ this(size,0,Math.max(1,size)); } public IntList( int size, int value){ this(size,value,Math.max(1,size)); } public IntList( int size, int value, int capacity){ elem = new int[capacity]; Arrays.fill(elem,0,size,value); this.size = size; } private IntList( int... e){ elem = e.clone(); size = e.length; } public void add( int e){ if ( ((size + 1) > elem.length)) {increaseCapacity(); } elem[size++] = e; } private void increaseCapacity(){ changeCapacity((((3 * elem.length) / 2) + 1)); } private void changeCapacity( int newCapacity){ int[] nElem = new int[newCapacity]; System.arraycopy(elem,0,nElem,0,Math.min(elem.length,newCapacity)); elem = nElem; } public int[] toArray(){ return Arrays.copyOf(elem,size);} } }
6	public class E2{ PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer tok ; public void go()throws IOException { StringTokenizer tok = new StringTokenizer(in.readLine());  int zzz = Integer.parseInt(tok.nextToken()); for ( int zz = 0;(zz < zzz);zz++) {ntok(); int n = ipar();  int m = ipar();  int[][] mat = new int[m][(n + 1)]; for ( int i = 0;(i < n);i++) {ntok(); for ( int e = 0;(e < m);e++) {mat[e][i] = ipar(); }}for ( int i = 0;(i < m);i++) {for ( int e = 0;(e < n);e++) {mat[i][n] = Math.max(mat[i][n],mat[i][e]); }} ArrayList<int[]> list = new ArrayList<>(); for ( int i = 0;(i < m);i++) {list.add(mat[i]); }Collections.sort(list,(a,b)->{return -Integer.compare(a[n],b[n]);}); for ( int i = 0;(i < m);i++) {mat[i] = list.get(i); }m = Math.min(m,n); int[][] dp = new int[(1 << n)][(m + 1)]; for ( int i = (m - 1);(i >= 0);i--) { int[] temp = new int[(1 << n)]; for ( int r = 0;(r < n);r++) {for ( int j = 0;(j < (1 << n));j++) {temp[j] = dp[j][(i + 1)]; }for ( int j = 0;(j < n);j++) { int val = mat[i][((j + r) % n)]; for ( int k = 0;(k < (1 << n));k++) {if ( ((k & (1 << j)) == 0)) {temp[(k | (1 << j))] = Math.max(temp[(k | (1 << j))],(temp[k] + val)); } }}for ( int j = 0;(j < (1 << n));j++) {dp[j][i] = Math.max(dp[j][i],temp[j]); }}}out.println(dp[((1 << n) - 1)][0]); }out.flush(); in.close(); } public void ntok()throws IOException { tok = new StringTokenizer(in.readLine()); } public int ipar(){ return Integer.parseInt(tok.nextToken());} public long lpar(){ return Long.parseLong(tok.nextToken());} public static void main( String[] args)throws IOException { new E2().go(); } }
2	public class DigitQueries{ public static void main( String[] args)throws IOException { FastReader in = new FastReader();  int q = 1; while((q-- > 0)){ long k ; k = in.nextLong(); Query(k); }} static void Query( long k){ long x = 0;  long sum = 0; while((sum < k)){sum += ((9 * Math.pow(10,x)) * (x + 1)); if ( (sum > k)) {sum -= ((9 * Math.pow(10,x)) * (x + 1)); break;} x++; } long y = (k - sum);  long last = 0; last = (((long)Math.pow(10,x) + ((long)y / (x + 1))) - 1); long z = (y % (x + 1)); if ( (z != 0)) {last = ((long)(last + 1) / (long)Math.pow(10,((x + 1) - z))); } System.out.println((last % 10)); } static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} long nextLong(){ return Long.parseLong(next());} } }
6	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);  TaskE solver = new TaskE(); solver.solve(1,in,out); out.close(); } } class TaskE{ private int n ; private double[] dp ; private double[][] p ; public void solve( int testNumber, InputReader in, PrintWriter out){ n = in.nextInt(); p = new double[n][n]; for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < n);++j) {p[i][j] = in.nextDouble(); }}dp = new double[(1 << n)]; Arrays.fill(dp,-1); for ( int i = 0;(i < n);++i) {out.printf("%.6f ",rec((1 << i))); }out.println(); } private double rec( int mask){ if ( (mask == ((1 << n) - 1))) return 1; if ( (dp[mask] > -0.5)) return dp[mask]; double res = 0;  int nn = Integer.bitCount(mask);  int total = ((nn * (nn + 1)) / 2); for ( int i = 0;(i < n);++i) if ( BitUtils.checkBit(mask,i)) for ( int j = 0;(j < n);++j) if ( !BitUtils.checkBit(mask,j)) {res += (rec(BitUtils.setBit(mask,j)) * p[i][j]); } res /= total; dp[mask] = res; return res;} } class InputReader{ private BufferedReader reader ; private StringTokenizer stt ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); } public String nextLine(){ try{return reader.readLine().trim(); }catch (IOException e){ return null;} } public String nextString(){ while(((stt == null) || !stt.hasMoreTokens())){stt = new StringTokenizer(nextLine()); }return stt.nextToken();} public int nextInt(){ return Integer.parseInt(nextString());} public double nextDouble(){ return Double.parseDouble(nextString());} }
0	public class a{ public static void main( String[] args){ Scanner input = new Scanner(System.in);  int n = input.nextInt(); if ( ((n % 2) == 0)) System.out.println(((4 + " ") + (n - 4))); else System.out.println(((9 + " ") + (n - 9))); } }
1	public class Main{ Main()throws IOException{ String a = nextLine();  String b = nextLine();  long ans = 0;  int s = 0; for ( int i = 0;(i < (b.length() - a.length()));++i) {s += ((b.charAt(i) == '1')?1:0); }for ( int i = 0;(i < a.length());++i) {s += ((b.charAt(((i + b.length()) - a.length())) == '1')?1:0); ans += ((a.charAt(i) == '1')?(((b.length() - a.length()) + 1) - s):s); s -= ((b.charAt(i) == '1')?1:0); }out.println(ans); } PrintWriter out = new PrintWriter(System.out,false); BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer stok = null; String nextLine()throws IOException { while(((stok == null) || !stok.hasMoreTokens())){stok = new StringTokenizer(in.readLine()); }return stok.nextToken();} public static void main( String[] args)throws IOException { if ( (args.length > 0)) {setIn(new FileInputStream((args[0] + ".inp"))); setOut(new PrintStream((args[0] + ".out"))); } Main solver = new Main(); solver.out.flush(); } }
4	public class template{ public static void main( String[] args)throws Exception { new template().run(); } long MOD = 1_000_000_007; public void run()throws Exception { FastScanner f = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int n = f.nextInt(),m = f.nextInt();  int[] t = new int[n],g = new int[n],c = new int[3]; for ( int i = 0;(i < n);i++) {t[i] = f.nextInt(); c[g[i] = (f.nextInt() - 1)]++; } long[][] dp1 = new long[(c[0] + 1)][(m + 1)];  long[][][] dp2 = new long[(c[1] + 1)][(c[2] + 1)][(m + 1)]; dp1[0][0] = 1; dp2[0][0][0] = 1; for ( int i = 0;(i < n);i++) {if ( (g[i] == 0)) {for ( int j = (dp1.length - 2);(j >= 0);j--) for ( int k = (m - t[i]);(k >= 0);k--) dp1[(j + 1)][(k + t[i])] = ((dp1[(j + 1)][(k + t[i])] + dp1[j][k]) % MOD); } else if ( (g[i] == 1)) {for ( int j = (dp2.length - 2);(j >= 0);j--) for ( int k = (dp2[j].length - 1);(k >= 0);k--) for ( int l = (m - t[i]);(l >= 0);l--) dp2[(j + 1)][k][(l + t[i])] = ((dp2[(j + 1)][k][(l + t[i])] + dp2[j][k][l]) % MOD); } else {for ( int j = (dp2.length - 1);(j >= 0);j--) for ( int k = (dp2[j].length - 2);(k >= 0);k--) for ( int l = (m - t[i]);(l >= 0);l--) dp2[j][(k + 1)][(l + t[i])] = ((dp2[j][(k + 1)][(l + t[i])] + dp2[j][k][l]) % MOD); }} long[][][][] combo = new long[(c[0] + 1)][(c[1] + 1)][(c[2] + 1)][3]; if ( (c[0] != 0)) combo[1][0][0][0] = 1; if ( (c[1] != 0)) combo[0][1][0][1] = 1; if ( (c[2] != 0)) combo[0][0][1][2] = 1; for ( int i = 0;(i <= c[0]);i++) {for ( int j = 0;(j <= c[1]);j++) {for ( int k = 0;(k <= c[2]);k++) {for ( int a = 0;(a < 3);a++) {if ( ((a != 0) && (i < c[0]))) combo[(i + 1)][j][k][0] = ((combo[(i + 1)][j][k][0] + ((combo[i][j][k][a] * (i + 1)) % MOD)) % MOD); if ( ((a != 1) && (j < c[1]))) combo[i][(j + 1)][k][1] = ((combo[i][(j + 1)][k][1] + ((combo[i][j][k][a] * (j + 1)) % MOD)) % MOD); if ( ((a != 2) && (k < c[2]))) combo[i][j][(k + 1)][2] = ((combo[i][j][(k + 1)][2] + ((combo[i][j][k][a] * (k + 1)) % MOD)) % MOD); }}}} long ans = 0; for ( int s = 0;(s <= m);s++) {for ( int x = 0;(x <= c[0]);x++) for ( int y = 0;(y <= c[1]);y++) for ( int z = 0;(z <= c[2]);z++) {ans = ((ans + ((((dp1[x][s] * dp2[y][z][(m - s)]) % MOD) * (((combo[x][y][z][0] + combo[x][y][z][1]) + combo[x][y][z][2]) % MOD)) % MOD)) % MOD); }}out.println(ans); out.flush(); } static class FastScanner{ public BufferedReader reader ; public StringTokenizer tokenizer ; public FastScanner(){ reader = new BufferedReader(new InputStreamReader(System.in),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());} } }
6	public class B{ BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; int[] level ; int[] loyal ; double ans ; int n ,k ,plLev ,needVotes ; double check(){ double res = 0; for ( int mask = 0;(mask < (1 << n));mask++) { double prob = 1;  int vote = 0;  int kill = 0; for ( int i = 0;(i < n);i++) if ( (((mask >> i) & 1) == 1)) {prob *= (loyal[i] / 100.0); vote++; } else {prob *= (1 - (loyal[i] / 100.0)); kill += level[i]; }if ( (vote >= needVotes)) res += prob; else res += ((prob * plLev) / (kill + plLev)); }return res;} void go( int ind, int candy){ if ( (ind == n)) {ans = Math.max(ans,check()); return ;} for ( int i = 0;(i <= candy);i++) {loyal[ind] += (10 * i); if ( (loyal[ind] > 100)) {loyal[ind] -= (10 * i); break;} go((ind + 1),(candy - i)); loyal[ind] -= (10 * i); }} void solve()throws IOException { n = nextInt(); k = nextInt(); plLev = nextInt(); needVotes = ((n / 2) + 1); ans = 0; level = new int[n]; loyal = new int[n]; for ( int i = 0;(i < n);i++) {level[i] = nextInt(); loyal[i] = nextInt(); }go(0,k); out.printf("%.12f",ans); } void inp()throws IOException { Locale.setDefault(Locale.US); br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.close(); } public static void main( String[] args)throws IOException { new B().inp(); } String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ eof = true; return "0";} }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
6	public class Solution implements Runnable{ public static BufferedReader br ; public static PrintWriter out ; public static StringTokenizer stk ; public static boolean isStream = true; public static void main( String[] args)throws IOException { if ( isStream) {br = new BufferedReader(new InputStreamReader(System.in)); } else {br = new BufferedReader(new FileReader("in.txt")); }out = new PrintWriter(System.out); new Thread(new Solution()).start(); } public void loadLine(){ try{stk = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } } public Integer nextInt(){ while(((stk == null) || !stk.hasMoreTokens()))loadLine(); return Integer.valueOf(stk.nextToken());} }
3	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();  int r = in.nextInt();  int[] xs = new int[n]; for ( int i = 0;(i < n);i++) xs[i] = in.nextInt(); double[] ys = new double[n]; for ( int i = 0;(i < n);i++) { int x = xs[i];  double y = r; for ( int j = 0;(j < i);j++) {y = Math.max(y,calc(xs[j],ys[j],x,r)); }ys[i] = y; }for ( int i = 0;(i < n);i++) {out.printf("%.10f ",ys[i]); }out.println(); } private double calc( int x, double y, int x1, int r){ int dx = Math.abs((x - x1)); if ( (dx > (2 * r))) return 0; double dy = Math.sqrt((((4 * r) * r) - (dx * dx))); return (y + dy);} } static class Scanner{ BufferedReader br ; StringTokenizer st ; public Scanner( InputStream in){ br = new BufferedReader(new InputStreamReader(in),32768); } public String nextLine(){ try{return br.readLine(); }catch (IOException e){ return null;} } public boolean hasNext(){ while(((st == null) || !st.hasMoreTokens())){ String s = nextLine(); if ( (s == null)) return false; st = new StringTokenizer(s); }return true;} public String next(){ hasNext(); return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
5	public class Main{ static Input in ; static Output out ; public static void main( String[] args)throws IOException { in = new Input(System.in); out = new Output(System.out); run(); out.close(); System.exit(0); } static private void run()throws IOException { int n = in.nextInt(),k = in.nextInt();  int[] A = new int[n]; for ( int i = 0;(i < n);i++) {A[i] = in.nextInt(); }Arrays.sort(A); int count = n;  boolean[] hash = new boolean[n]; for ( int i = (n - 1);(i > 0);i--) {if ( !hash[i]) { int a = A[i]; if ( ((a % k) == 0)) { int p = (a / k);  int j = Arrays.binarySearch(A,p); if ( ((j >= 0) && (j < i))) {hash[j] = true; count--; } } } }out.print(count); } } class Input{ final int SIZE = 8192; private InputStream in ; private byte[] buf = new byte[SIZE]; private int last ,current ,total ; public Input( InputStream stream)throws IOException{ in = stream; last = read(); } private int read()throws IOException { if ( (total == -1)) return -1; if ( (current >= total)) {current = 0; total = in.read(buf); if ( (total <= 0)) return -1; } return buf[current++];} private void advance()throws IOException { while(true){if ( (last == -1)) return ; if ( !isValidChar(last)) last = read(); else break;}} private boolean isValidChar( int c){ return ((c > 32) && (c < 127));} public String nextString()throws IOException { advance(); if ( (last == -1)) throw (new EOFException()); StringBuilder s = new StringBuilder(); while(true){s.appendCodePoint(last); last = read(); if ( !isValidChar(last)) break; }return s.toString();} public String nextLine()throws IOException { if ( (last == -1)) throw (new EOFException()); StringBuilder s = new StringBuilder(); while(true){s.appendCodePoint(last); last = read(); if ( ((last == '\n') || (last == -1))) break; }return s.toString();} public String nextLine( boolean ignoreIfEmpty)throws IOException { if ( !ignoreIfEmpty) return nextLine(); String s = nextLine(); while((s.trim().length() == 0))s = nextLine(); return s;} public int nextInt()throws IOException { advance(); if ( (last == -1)) throw (new EOFException()); int n = 0,s = 1; if ( (last == '-')) {s = -1; last = read(); if ( (last == -1)) throw (new EOFException()); } while(true){n = (((n * 10) + last) - '0'); last = read(); if ( !isValidChar(last)) break; }return (n * s);} public void close()throws IOException { in.close(); in = null; } } class Output{ final int SIZE = 8192; private Writer out ; private char cb[] = new char[SIZE]; private int nChars = SIZE,nextChar = 0; private char lineSeparator = '\n'; public Output( OutputStream stream){ out = new OutputStreamWriter(stream); } void flushBuffer()throws IOException { if ( (nextChar == 0)) return ; out.write(cb,0,nextChar); nextChar = 0; } void write( int c)throws IOException { if ( (nextChar >= nChars)) flushBuffer(); cb[nextChar++] = (char)c; } void write( String s, int off, int len)throws IOException { int b = off,t = (off + len); while((b < t)){ int a = (nChars - nextChar),a1 = (t - b);  int d = ((a < a1)?a:a1); s.getChars(b,(b + d),cb,nextChar); b += d; nextChar += d; if ( (nextChar >= nChars)) flushBuffer(); }} void write( String s)throws IOException { write(s,0,s.length()); } public void print( Object obj)throws IOException { write(String.valueOf(obj)); } public void close()throws IOException { flushBuffer(); out.close(); out = null; } }
4	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskG2 solver = new TaskG2(); solver.solve(1,in,out); out.close(); } static class TaskG2{ static final int MOD = (1000000000 + 7); static final int MAXN = 51; int getWays( int i, int j, int k, int l, int[][][][] ways, boolean[][][][] cached){ if ( (((i + j) + k) == 0)) return ((l == -1)?1:0); if ( (l < 0)) return 0; if ( cached[i][j][k][l]) return ways[i][j][k][l]; int s = ((i + j) + k);  long value = 0; if ( ((l == 0) && (i != 0))) {for ( int x = -1;(x < 3);x++) if ( (x != l)) {value += getWays((i - 1),j,k,x,ways,cached); } } if ( ((l == 1) && (j != 0))) {for ( int x = -1;(x < 3);x++) if ( (x != l)) {value += getWays(i,(j - 1),k,x,ways,cached); } } if ( ((l == 2) && (k != 0))) {for ( int x = -1;(x < 3);x++) if ( (x != l)) {value += getWays(i,j,(k - 1),x,ways,cached); } } ways[i][j][k][l] = (int)(value % MOD); cached[i][j][k][l] = true; return ways[i][j][k][l];} int totalWays( int i, int j, int k, int[][][][] ways, boolean[][][][] cached, int[] factorial){ long ret = 0; for ( int l = 0;(l < 3);l++) ret += getWays(i,j,k,l,ways,cached); ret *= factorial[i]; ret %= MOD; ret *= factorial[j]; ret %= MOD; ret *= factorial[k]; ret %= MOD; return (int)ret;} int add( int type, int value, int[] sizes, int sum, int[][][][] dp){ sizes[type]++; if ( (type == 0)) {for ( int s = (sum + value);(s >= value);s--) {for ( int i = 1;(i <= sizes[0]);i++) for ( int j = 0;(j <= sizes[1]);j++) for ( int k = 0;(k <= sizes[2]);k++) {dp[i][j][k][s] += dp[(i - 1)][j][k][(s - value)]; if ( (dp[i][j][k][s] >= MOD)) dp[i][j][k][s] -= MOD; }}} if ( (type == 1)) {for ( int s = (sum + value);(s >= value);s--) {for ( int i = 0;(i <= sizes[0]);i++) for ( int j = 1;(j <= sizes[1]);j++) for ( int k = 0;(k <= sizes[2]);k++) {dp[i][j][k][s] += dp[i][(j - 1)][k][(s - value)]; if ( (dp[i][j][k][s] >= MOD)) dp[i][j][k][s] -= MOD; }}} if ( (type == 2)) {for ( int s = (sum + value);(s >= value);s--) {for ( int i = 0;(i <= sizes[0]);i++) for ( int j = 0;(j <= sizes[1]);j++) for ( int k = 1;(k <= sizes[2]);k++) {dp[i][j][k][s] += dp[i][j][(k - 1)][(s - value)]; if ( (dp[i][j][k][s] >= MOD)) dp[i][j][k][s] -= MOD; }}} return (sum + value);} public void solve( int testNumber, InputReader in, OutputWriter out){ int[][][][] ways = new int[MAXN][MAXN][MAXN][3];  boolean[][][][] cached = new boolean[MAXN][MAXN][MAXN][3];  int n = in.nextInt(),T = in.nextInt();  ArrayList<Integer>[] ar = new ArrayList[3]; for ( int i = 0;(i < 3);i++) ar[i] = new ArrayList<Integer>(); int total_sum = 0; for ( int i = 0;(i < n);i++) { int t = in.nextInt(),g = in.nextInt(); ar[(g - 1)].add(t); total_sum += t; }if ( (T > total_sum)) {out.println(0); return ;} int min_index = 0,mn = 100000000; for ( int i = 0;(i < 3);i++) {if ( (ar[i].size() < mn)) {mn = ar[i].size(); min_index = i; } } int[][][][] dp = new int[(ar[((1 + min_index) % 3)].size() + 1)][(ar[((2 + min_index) % 3)].size() + 1)][1][(total_sum + 1)];  int[][][][] dp2 = new int[1][1][(mn + 1)][(total_sum + 1)]; dp[0][0][0][0] = dp2[0][0][0][0] = 1; int[] sizes = {0,0,0};  int sum = 0;  int[] order = {((min_index + 1) % 3),((min_index + 2) % 3)};  int type = 0; for ( int i :order) {for ( int v :ar[i]) sum = add(type,v,sizes,sum,dp); type++; }sum = 0; sizes[0] = sizes[1] = sizes[2] = 0; for ( int i :ar[min_index]) sum = add(2,i,sizes,sum,dp2); int[] factorial = new int[MAXN]; factorial[0] = 1; for ( int i = 1;(i < MAXN);i++) factorial[i] = (int)(((factorial[(i - 1)] * 1L) * i) % MOD); long answer = 0; for ( int i = 0;(i < dp.length);i++) for ( int j = 0;(j < dp[0].length);j++) for ( int k = 0;(k <= mn);k++) for ( int s = 0;(s <= T);s++) { long x = (((dp[i][j][0][s] * 1L) * totalWays(i,j,k,ways,cached,factorial)) % MOD); x *= dp2[0][0][k][(T - s)]; x %= MOD; answer += x; }out.println((answer % MOD)); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputReader.SpaceCharFilter filter ; 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 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 boolean isSpaceChar( int c){ if ( (filter != null)) {return filter.isSpaceChar(c);} return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void println( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }writer.print('\n'); } public void close(){ writer.close(); } } }
4	public class Main{ public static void main( String[] args){ InputStream inputstream = System.in;  OutputStream outputstream = System.out;  InputReader in = new InputReader(inputstream);  OutputWriter out = new OutputWriter(outputstream);  mysolver mysol = new mysolver(); mysol.solve(in,out); out.close(); } } class mysolver{ public long mod = 1000000007; int M ,N ; boolean bpm( boolean[][] bpGraph, int u, boolean[] seen, int[] matchR){ for ( int v = 0;(v < N);v++) {if ( (bpGraph[u][v] && !seen[v])) {seen[v] = true; if ( ((matchR[v] < 0) || bpm(bpGraph,matchR[v],seen,matchR))) {matchR[v] = u; return true;} } }return false;} int maxBPM( boolean[][] bpGraph){ int matchR[] = new int[N]; Arrays.fill(matchR,-1); int result = 0; for ( int u = 0;(u < M);u++) { boolean seen[] = new boolean[N]; if ( bpm(bpGraph,u,seen,matchR)) result++; }return result;} public void solve( InputReader in, OutputWriter out){ PrintWriter pout = new PrintWriter(new BufferedOutputStream(System.out));  int n = in.readInt();  int m = in.readInt();  boolean eg[][] = new boolean[n][n]; for ( int i = 0;(i < n);i++) {Arrays.fill(eg[i],false); }for ( int i = 0;(i < m);i++) { int x = (in.readInt() - 1);  int y = (in.readInt() - 1); eg[x][y] = true; } int minimum = Integer.MAX_VALUE; for ( int i = 0;(i < n);i++) { int ct = 0;  int addedges = 0; if ( (eg[i][i] == false)) {addedges++; } else {ct++; }for ( int j = 0;(j < n);j++) {if ( ((j != i) && (eg[i][j] == false))) {addedges++; } else if ( ((j != i) && (eg[i][j] == true))) {ct++; } if ( ((j != i) && (eg[j][i] == false))) {addedges++; } else if ( ((j != i) && (eg[j][i] == true))) {ct++; } } boolean row[] = new boolean[n];  boolean col[] = new boolean[n]; for ( int j = 0;(j < n);j++) {row[j] = eg[i][j]; col[j] = eg[j][i]; eg[i][j] = false; eg[j][i] = false; }N = n; M = n; int matching = maxBPM(eg); addedges += ((((n - 1) + m) - ct) - (2 * matching)); minimum = Math.min(minimum,addedges); for ( int j = 0;(j < n);j++) {eg[i][j] = row[j]; eg[j][i] = col[j]; }}System.out.println(minimum); pout.close(); } } class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private SpaceCharFilter filter ; 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 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 isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void close(){ writer.close(); } }
0	public class A{ public static void main( String[] args)throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  String s = bf.readLine(); out.println(25); out.flush(); out.close(); } }
2	public class B{ static StringTokenizer st ; static BufferedReader br ; static PrintWriter pw ; public static void main( String[] args)throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int n = nextInt();  int left = 0,right = n;  int x1 = 0,y1 = 0,x2 = 0,y2 = 0,x3 = 0,y3 = 0,x4 = 0,y4 = 0; while(((right - left) > 1)){ int mid = ((left + right) >> 1); System.out.println(((((((("? " + 1) + " ") + 1) + " ") + mid) + " ") + n)); int ans = nextInt(); if ( (ans == 2)) right = mid; else left = mid; }x4 = right; left = 0; right = n; while(((right - left) > 1)){ int mid = ((left + right) >> 1); System.out.println(((((((("? " + 1) + " ") + 1) + " ") + mid) + " ") + n)); int ans = nextInt(); if ( (ans >= 1)) right = mid; else left = mid; }x2 = right; left = 1; right = (n + 1); while(((right - left) > 1)){ int mid = ((left + right) >> 1); System.out.println(((((((("? " + mid) + " ") + 1) + " ") + n) + " ") + n)); int ans = nextInt(); if ( (ans >= 1)) left = mid; else right = mid; }x3 = left; left = 1; right = (n + 1); while(((right - left) > 1)){ int mid = ((left + right) >> 1); System.out.println(((((((("? " + mid) + " ") + 1) + " ") + n) + " ") + n)); int ans = nextInt(); if ( (ans >= 2)) left = mid; else right = mid; }x1 = left; left = 0; right = n; while(((right - left) > 1)){ int mid = ((left + right) >> 1); System.out.println(((((((("? " + 1) + " ") + 1) + " ") + n) + " ") + mid)); int ans = nextInt(); if ( (ans >= 2)) right = mid; else left = mid; }y4 = right; left = 0; right = n; while(((right - left) > 1)){ int mid = ((left + right) >> 1); System.out.println(((((((("? " + 1) + " ") + 1) + " ") + n) + " ") + mid)); int ans = nextInt(); if ( (ans >= 1)) right = mid; else left = mid; }y2 = right; left = 1; right = (n + 1); while(((right - left) > 1)){ int mid = ((left + right) >> 1); System.out.println(((((((("? " + 1) + " ") + mid) + " ") + n) + " ") + n)); int ans = nextInt(); if ( (ans >= 1)) left = mid; else right = mid; }y3 = left; left = 1; right = (n + 1); while(((right - left) > 1)){ int mid = ((left + right) >> 1); System.out.println(((((((("? " + 1) + " ") + mid) + " ") + n) + " ") + n)); int ans = nextInt(); if ( (ans >= 2)) left = mid; else right = mid; }y1 = left; if ( ((y3 <= y2) && (x3 <= x2))) {System.out.println(((((((((((((((("! " + x3) + " ") + y3) + " ") + x2) + " ") + y2) + " ") + x1) + " ") + y1) + " ") + x4) + " ") + y4)); return ;} System.out.println(((((((("? " + x1) + " ") + y1) + " ") + x2) + " ") + y2)); int ans1 = nextInt(); System.out.println(((((((("? " + x3) + " ") + y3) + " ") + x4) + " ") + y4)); int ans2 = nextInt(); if ( ((ans1 == 1) && (ans2 == 1))) {System.out.println(((((((((((((((("! " + x1) + " ") + y1) + " ") + x2) + " ") + y2) + " ") + x3) + " ") + y3) + " ") + x4) + " ") + y4)); return ;} System.out.println(((((((("? " + x1) + " ") + y3) + " ") + x2) + " ") + y4)); ans1 = nextInt(); System.out.println(((((((("? " + x3) + " ") + y1) + " ") + x4) + " ") + y2)); ans2 = nextInt(); if ( ((ans1 == 1) && (ans2 == 1))) {System.out.println(((((((((((((((("! " + x1) + " ") + y3) + " ") + x2) + " ") + y4) + " ") + x3) + " ") + y1) + " ") + x4) + " ") + y2)); return ;} System.out.println(((((((("? " + x1) + " ") + y1) + " ") + x4) + " ") + y2)); ans1 = nextInt(); System.out.println(((((((("? " + x3) + " ") + y3) + " ") + x2) + " ") + y4)); ans2 = nextInt(); if ( ((ans1 == 1) && (ans2 == 1))) {System.out.println(((((((((((((((("! " + x1) + " ") + y1) + " ") + x4) + " ") + y2) + " ") + x3) + " ") + y3) + " ") + x2) + " ") + y4)); return ;} System.out.println(((((((("? " + x1) + " ") + y3) + " ") + x2) + " ") + y2)); ans1 = nextInt(); System.out.println(((((((("? " + x3) + " ") + y1) + " ") + x4) + " ") + y4)); ans2 = nextInt(); if ( ((ans1 == 1) && (ans2 == 1))) {System.out.println(((((((((((((((("! " + x1) + " ") + y3) + " ") + x2) + " ") + y2) + " ") + x3) + " ") + y1) + " ") + x4) + " ") + y4)); return ;} pw.close(); } static private int nextInt()throws IOException { return Integer.parseInt(next());} static private String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} }
0	public class CodeForces{ public static void main( String[] args){ Scanner input = new Scanner(new BufferedReader(new InputStreamReader(System.in))); System.out.println(((input.nextInt() / 2) + 1)); } }
2	public class Main{ static class Task{ int NN = 1000001; int MOD = 1000000007; int INF = 2000000000; long INFINITY = 2000000000000000000L; public void solve( InputReader in, PrintWriter out){ long k = in.nextLong(); for ( long mul = 1,d = 1;;mul *= 10,++d) {if ( (k > ((9 * mul) * d))) {k -= ((9 * mul) * d); } else {for ( long i = 1;(i <= 9);++i) {if ( (k > (mul * d))) {k -= (mul * d); } else {--k; long num = (k / d); k %= d; String str = String.valueOf(num); while((str.length() < (d - 1))){str = ("0" + str); }str = (String.valueOf(i) + str); out.println(str.charAt((int)k)); return ;}}}}} } static void prepareIO( boolean isFileIO){ Task solver = new Task(); if ( !isFileIO) { InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream); solver.solve(in,out); out.close(); } else { String IPfilePath = (System.getProperty("user.home") + "/Downloads/ip.in");  String OPfilePath = (System.getProperty("user.home") + "/Downloads/op.out");  InputReader fin = new InputReader(IPfilePath);  PrintWriter fout = null; try{fout = new PrintWriter(new File(OPfilePath)); }catch (FileNotFoundException e){ e.printStackTrace(); } solver.solve(fin,fout); fout.close(); }} public static void main( String[] args){ prepareIO(false); } static class InputReader{ public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream),32768); tokenizer = null; } public InputReader( String filePath){ File file = new File(filePath); try{reader = new BufferedReader(new FileReader(file)); }catch (FileNotFoundException e){ e.printStackTrace(); } 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 long nextLong(){ return Long.parseLong(next());} } }
2	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);  TaskD solver = new TaskD(); solver.solve(1,in,out); out.close(); } static class TaskD{ int found = 0; int queryCount = 0; int[] result = new int[8]; public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  int left = 1;  int right = (n + 1); while(((left + 1) < right)){ int middle = ((left + right) / 2);  int res = query(middle,1,n,n); if ( (res == 2)) left = middle; else if ( (res == 1)) {findSingle(middle,1,n,n); found++; break;} else {right = middle; }} int top = 1;  int bottom = (n + 1); while(((top + 1) < bottom)){ int middle = ((top + bottom) / 2);  int res = query(1,middle,n,n); if ( (res == 2)) top = middle; else if ( (res == 1)) {if ( ((found == 0) || containsRect(1,middle,n,n,result[0],result[1],result[2],result[3]))) {findSingle(1,middle,n,n); found++; } break;} else {bottom = middle; }}if ( (found < 2)) {left = 0; right = n; while(((left + 1) < right)){ int middle = ((left + right) / 2);  int res = query(1,1,middle,n); if ( (res == 2)) right = middle; else if ( (res == 1)) {if ( ((found == 0) || containsRect(1,1,middle,n,result[0],result[1],result[2],result[3]))) {findSingle(1,1,middle,n); found++; } break;} else {left = middle; }}} if ( (found < 2)) {top = 0; bottom = n; while(((top + 1) < bottom)){ int middle = ((top + bottom) / 2);  int res = query(1,1,n,middle); if ( (res == 2)) bottom = middle; else if ( (res == 1)) {if ( ((found == 0) || containsRect(1,1,n,middle,result[0],result[1],result[2],result[3]))) {findSingle(1,1,n,middle); found++; } break;} else {top = middle; }}} System.out.print("! "); for ( int i = 0;(i < 8);i++) System.out.print((result[i] + " ")); } public boolean containsRect( int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4){ if ( ((((x1 <= x3) && (y1 <= y3)) && (x2 >= x4)) && (y2 >= y4))) return true; return false;} public void findSingle( int x1, int y1, int x2, int y2){ x1 = findTopX(x1,y1,x2,y2); y1 = findTopY(x1,y1,x2,y2); x2 = findBottomX(x1,y1,x2,y2); y2 = findBottomY(x1,y1,x2,y2); result[(0 + (4 * found))] = x1; result[(1 + (4 * found))] = y1; result[(2 + (4 * found))] = x2; result[(3 + (4 * found))] = y2; } public int findTopX( int x1, int y1, int x2, int y2){ int left = x1;  int right = x2; while(((left + 1) < right)){ int mid = ((left + right) / 2); if ( (query(mid,y1,x2,y2) == 1)) {left = mid; } else {right = mid; }}while((query(right,y1,x2,y2) == 0))right--; return right;} public int findTopY( int x1, int y1, int x2, int y2){ int left = y1;  int right = y2; while(((left + 1) < right)){ int mid = ((left + right) / 2); if ( (query(x1,mid,x2,y2) == 1)) {left = mid; } else {right = mid; }}while((query(x1,right,x2,y2) == 0))right--; return right;} public int findBottomX( int x1, int y1, int x2, int y2){ int left = x1;  int right = x2; while(((left + 1) < right)){ int mid = ((left + right) / 2); if ( (query(x1,y1,mid,y2) == 1)) {right = mid; } else {left = mid; }}while((query(x1,y1,left,y2) == 0))left++; return left;} public int findBottomY( int x1, int y1, int x2, int y2){ int left = y1;  int right = y2; while(((left + 1) < right)){ int mid = ((left + right) / 2); if ( (query(x1,y1,x2,mid) == 1)) {right = mid; } else {left = mid; }}while((query(x1,y1,x2,left) == 0))left++; return left;} public int query( int x1, int y1, int x2, int y2){ queryCount++; System.out.println(((((((("? " + x1) + " ") + y1) + " ") + x2) + " ") + y2)); System.out.flush(); Scanner sc = new Scanner(System.in); return sc.nextInt();} } static class InputReader{ static private BufferedReader in ; static private StringTokenizer tok ; public InputReader( InputStream in){ this.in = new BufferedReader(new InputStreamReader(in)); } public int nextInt(){ return Integer.parseInt(next());} public String next(){ try{while(((tok == null) || !tok.hasMoreTokens())){tok = new StringTokenizer(in.readLine()); } }catch (IOException ex){ System.err.println(("An IOException was caught :" + ex.getMessage())); } return tok.nextToken();} } }
0	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);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, Scanner in, PrintWriter out){ long n = in.nextLong(); if ( (n == 1)) out.println("1"); else if ( (n == 2)) out.println("2"); else if ( ((n % 2) == 1)) out.println(((n * (n - 1)) * (n - 2))); else if ( ((n % 6) == 0)) out.println((((n - 1) * (n - 2)) * (n - 3))); else out.println(((n * (n - 1)) * (n - 3))); } }
4	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{ final int MOD = (int)(1e9 + 7); long[][] C ; long[] fact ; public void solve( int testNumber, FastScanner in, PrintWriter out){ int n = in.nextInt(); precalc(n); int[] a = new int[n]; for ( int i = 0;(i < n);i++) {a[i] = in.nextInt(); a[i] = removeSquares(a[i]); } int[] g = getGroupSizes(a);  long ans = solve(g); for ( int x :g) {ans = ((ans * fact[x]) % MOD); }out.println(ans); } private long solve( int[] a){ long[] d = new long[1]; d[0] = 1; int totalPositions = 1; for ( int x :a) { long[] nd = new long[((d.length + x) + 1)]; for ( int s = 0;(s < d.length);s++) {if ( (d[s] == 0)) {continue;} for ( int m = 1;(m <= x);m++) {for ( int p = 0;((p <= s) && (p <= m));p++) { long cur = d[s]; cur = ((cur * C[s][p]) % MOD); cur = ((cur * C[(totalPositions - s)][(m - p)]) % MOD); cur = ((cur * f(x,m)) % MOD); int ns = (((s + x) - m) - p); if ( ((ns >= 0) && (ns < nd.length))) {nd[ns] += cur; if ( (nd[ns] >= MOD)) {nd[ns] -= MOD; } } }}}if ( (totalPositions == 1)) {totalPositions = (x + 1); } else {totalPositions += x; }d = nd; }return d[0];} private long f( int n, int k){ if ( (n < k)) {return 0;} n -= k; return C[((n + k) - 1)][(k - 1)];} private void precalc( int n){ fact = new long[(n + 1)]; fact[0] = 1; for ( int i = 1;(i < fact.length);i++) {fact[i] = ((i * fact[(i - 1)]) % MOD); }C = new long[1000][1000]; C[0][0] = 1; for ( int i = 1;(i < C.length);i++) {C[i][0] = 1; for ( int j = 1;(j < C.length);j++) {C[i][j] = (C[(i - 1)][(j - 1)] + C[(i - 1)][j]); if ( (C[i][j] >= MOD)) {C[i][j] -= MOD; } }}} private int[] getGroupSizes( int[] a){ Arrays.sort(a); List<Integer> res = new ArrayList<>(); for ( int i = 0;(i < a.length);) { int j = i; while(((j < a.length) && (a[i] == a[j]))){++j; }res.add((j - i)); i = j; } int[] r = new int[res.size()]; for ( int i = 0;(i < r.length);i++) {r[i] = res.get(i); }return r;} private int removeSquares( int n){ int res = 1; for ( int d = 2;((d * d) <= n);d++) {if ( ((n % d) == 0)) { int cur = 0; while(((n % d) == 0)){n /= d; ++cur; }if ( ((cur % 2) == 1)) {res *= d; } } }if ( (n > 1)) {res *= n; } return res;} } static class FastScanner{ private BufferedReader in ; private StringTokenizer st ; public FastScanner( InputStream stream){ in = new BufferedReader(new InputStreamReader(stream)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
6	public class P111C{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); double EPS = 1e-9; int h ,w ; void run(){ h = sc.nextInt(); w = sc.nextInt(); solve(); } void solve(){ n = (w * h); g = new long[n]; int[] dx = {0,0,-1,1};  int[] dy = {-1,1,0,0}; for ( int y = 0;(y < h);y++) {for ( int x = 0;(x < w);x++) {for ( int k = 0;(k < 4);k++) { int x2 = (x + dx[k]);  int y2 = (y + dy[k]); if ( ((((x2 >= 0) && (x2 < w)) && (y2 >= 0)) && (y2 < h))) {g[((y * w) + x)] |= (1L << ((y2 * w) + x2)); } }}}candidate = new int[n]; xs = new Xorshift(); mds = ((1L << n) - 1); mds(0,0,0); println(((n - Long.bitCount(mds)) + "")); } int n ; long[] g ; long mds ; int[] candidate ; Xorshift xs ; void mds( long choosed, long removed, long covered){ if ( (Long.bitCount(choosed) >= Long.bitCount(mds))) return ; if ( (covered == ((1L << n) - 1))) {if ( (Long.bitCount(choosed) < Long.bitCount(mds))) mds = choosed; return ;} { long s = covered; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); s |= ((1L << i) | g[i]); }if ( (s != ((1L << n) - 1))) {return ;} } int index = 0;  int k = -1; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); if ( (((covered >>> i) & 1) == 1)) {if ( (Long.bitCount((g[i] & ~covered)) == 0)) {mds(choosed,(removed | (1L << i)),covered); return ;} else if ( ((Long.bitCount((g[i] & ~covered)) == 1) && (((g[i] & ~covered) & ~removed) != 0))) {mds(choosed,(removed | (1L << i)),covered); return ;} } else {if ( (Long.bitCount((g[i] & ~removed)) == 0)) {mds((choosed | (1L << i)),(removed | (1L << i)),((covered | (1L << i)) | g[i])); return ;} else if ( ((Long.bitCount((g[i] & ~removed)) == 1) && (((g[i] & ~removed) | (g[i] & ~covered)) == (g[i] & ~removed)))) { int j = Long.numberOfTrailingZeros((g[i] & ~removed)); mds((choosed | (1L << j)),((removed | (1L << i)) | (1L << j)),((covered | (1L << j)) | g[j])); return ;} }if ( ((k == -1) || (Long.bitCount((g[i] & ~covered)) > Long.bitCount((g[k] & ~covered))))) {index = 0; candidate[index++] = i; k = i; } else if ( (Long.bitCount((g[i] & ~covered)) == Long.bitCount((g[k] & ~covered)))) {candidate[index++] = i; } }if ( (k == -1)) return ; k = candidate[xs.nextInt(index)]; mds((choosed | (1L << k)),(removed | (1L << k)),((covered | (1L << k)) | g[k])); mds(choosed,(removed | (1L << k)),covered); } class Xorshift{ int x ,y ,z ,w ; public Xorshift(){ x = 123456789; y = 362436069; z = 521288629; w = 88675123; } public Xorshift( int seed){ x = _(seed,0); y = _(x,1); z = _(y,2); w = _(z,3); } int _( int s, int i){ return (((1812433253 * (s ^ (s >>> 30))) + i) + 1);} public int nextInt(){ int t = (x ^ (x << 11)); x = y; y = z; z = w; return w = (((w ^ (w >>> 19)) ^ t) ^ (t >>> 8));} public int nextInt( int n){ return (int)(n * nextDouble());} public double nextDouble(){ int a = (nextInt() >>> 5),b = (nextInt() >>> 6); return (((a * 67108864.0) + b) * (1.0 / (1L << 53)));} } void println( String s){ System.out.println(s); } void print( String s){ System.out.print(s); } public static void main( String[] args){ Locale.setDefault(Locale.US); new P111C().run(); } }
5	public class Main{ public static void main( String[] args){ new Main().run(); } void run(){ InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt(),k = in.nextInt();  int[] a = new int[n]; for ( int i = 0;(i < n);++i) a[i] = in.nextInt(); Arrays.sort(a); int ret = 0,it = 0; for ( int i = 0;(i < n);++i) { int val = (((a[i] % k) == 0)?(a[i] / k):-1); while(((it < i) && (a[it] < val)))++it; if ( ((it == i) || (a[it] != val))) {++ret; } else {a[i] = 0; }}out.println(ret); out.close(); } } class InputReader{ BufferedReader buff ; StringTokenizer tokenizer ; InputReader( InputStream stream){ buff = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } boolean hasNext(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens()))try{tokenizer = new StringTokenizer(buff.readLine()); }catch (Exception e){ return false;} return true;} String next(){ if ( !hasNext()) throw (new RuntimeException()); return tokenizer.nextToken();} int nextInt(){ return Integer.parseInt(next());} }
0	public class CF{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  long n = scan.nextLong();  TaskA t = new TaskA(); System.out.println(t.solve(n)); } } class TaskA{ public long solve( long n){ if ( (n < 3)) return n; else if ( ((n % 2) == 1)) return ((n * (n - 1)) * (n - 2)); else if ( ((n % 3) != 0)) return ((n * (n - 1)) * (n - 3)); else return (((n - 1) * (n - 2)) * (n - 3));} }
0	public class A{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long n = sc.nextLong(); if ( (n == 0)) System.out.println(0); else if ( ((n % 2) == 1)) System.out.println(((n + 1) / 2)); else System.out.println((n + 1)); } }
0	public class LCMChallenge{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(); if ( (n < 3)) {System.out.println(n); } else if ( ((n % 2) == 1)) {System.out.println((((long)n * (n - 1)) * (n - 2))); } else {if ( ((n % 3) != 0)) {System.out.println((((long)n * (n - 1)) * (n - 3))); } else {System.out.println((((long)(n - 1) * (n - 2)) * (n - 3))); }}} }
4	public class B{ static int n ,t[] ,g[] ,MOD = ((int)1e9 + 7); static int[][][] memo1 ,memo2[] ,memo3[] ; static int dp1( int idx, int remCnt, int remSum){ if ( (idx == n)) return (((remSum == 0) && (remCnt == 0))?1:0); if ( ((remCnt < 0) || (remSum < 0))) return 0; if ( (memo1[idx][remCnt][remSum] != -1)) return memo1[idx][remCnt][remSum]; int ans = dp1((idx + 1),remCnt,remSum); if ( (g[idx] == 0)) {ans += dp1((idx + 1),(remCnt - 1),(remSum - t[idx])); if ( (ans >= MOD)) ans -= MOD; } return memo1[idx][remCnt][remSum] = ans;} static int dp2( int idx, int remCnt1, int remCnt2, int remSum){ if ( (idx == n)) return ((((remSum == 0) && (remCnt1 == 0)) && (remCnt2 == 0))?1:0); if ( (((remSum < 0) || (remCnt1 < 0)) || (remCnt2 < 0))) return 0; if ( (memo2[idx][remCnt1][remCnt2][remSum] != -1)) return memo2[idx][remCnt1][remCnt2][remSum]; int ans = dp2((idx + 1),remCnt1,remCnt2,remSum); if ( (g[idx] == 1)) ans += dp2((idx + 1),(remCnt1 - 1),remCnt2,(remSum - t[idx])); else if ( (g[idx] == 2)) ans += dp2((idx + 1),remCnt1,(remCnt2 - 1),(remSum - t[idx])); return memo2[idx][remCnt1][remCnt2][remSum] = ans;} static private int dp3( int cnt0, int cnt1, int cnt2, int last){ if ( (((cnt0 + cnt1) + cnt2) == 0)) return 1; if ( (memo3[last][cnt0][cnt1][cnt2] != -1)) return memo3[last][cnt0][cnt1][cnt2]; long ans = 0; if ( ((cnt0 > 0) && (last != 0))) ans += dp3((cnt0 - 1),cnt1,cnt2,0); if ( ((cnt1 > 0) && (last != 1))) ans += dp3(cnt0,(cnt1 - 1),cnt2,1); if ( ((cnt2 > 0) && (last != 2))) ans += dp3(cnt0,cnt1,(cnt2 - 1),2); return memo3[last][cnt0][cnt1][cnt2] = (int)(ans % MOD);} public static void main( String[] args)throws IOException { Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out); n = sc.nextInt(); int[] fac = new int[(n + 1)]; t = new int[n]; g = new int[n]; int[] cnt = new int[3]; fac[0] = 1; for ( int i = 1;(i <= n);i++) fac[i] = (int)(((i * 1L) * fac[(i - 1)]) % MOD); int T = sc.nextInt(); for ( int i = 0;(i < n);i++) {t[i] = sc.nextInt(); g[i] = (sc.nextInt() - 1); cnt[g[i]]++; }memo1 = new int[n][(cnt[0] + 1)][(T + 1)]; memo2 = new int[n][(cnt[1] + 1)][(cnt[2] + 1)][(T + 1)]; memo3 = new int[4][(cnt[0] + 1)][(cnt[1] + 1)][(cnt[2] + 1)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= cnt[0]);j++) Arrays.fill(memo1[i][j],-1); for ( int j = 0;(j <= cnt[1]);j++) for ( int k = 0;(k <= cnt[2]);k++) Arrays.fill(memo2[i][j][k],-1); }for ( int i = 0;(i < 4);i++) for ( int j = 0;(j <= cnt[0]);j++) for ( int k = 0;(k <= cnt[1]);k++) Arrays.fill(memo3[i][j][k],-1); int ans = 0; for ( int cnt0 = 0;(cnt0 <= cnt[0]);cnt0++) for ( int sum0 = 0;(sum0 <= T);sum0++) for ( int cnt1 = 0;(cnt1 <= cnt[1]);cnt1++) for ( int cnt2 = 0;(cnt2 <= cnt[2]);cnt2++) { long ways = (((dp1(0,cnt0,sum0) * 1L) * dp2(0,cnt1,cnt2,(T - sum0))) % MOD); ways = ((ways * dp3(cnt0,cnt1,cnt2,3)) % MOD); ways *= fac[cnt0]; ways %= MOD; ways *= fac[cnt1]; ways %= MOD; ways *= fac[cnt2]; ways %= MOD; ans += ways; if ( (ans >= MOD)) ans -= MOD; }out.println(ans); out.close(); } static class Scanner{ BufferedReader br ; StringTokenizer st ; Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } Scanner( String fileName)throws FileNotFoundException{ br = new BufferedReader(new FileReader(fileName)); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} boolean ready()throws IOException { return br.ready();} } }
1	public class CF903F{ static final int INF = 0x3f3f3f3f; static void fill( int[][][][] aa, int a){ for ( int h0 = 0;(h0 <= 4);h0++) for ( int h1 = 0;(h1 <= 4);h1++) for ( int h2 = 0;(h2 <= 4);h2++) for ( int h3 = 0;(h3 <= 4);h3++) aa[h0][h1][h2][h3] = a; } public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  StringTokenizer st = new StringTokenizer(br.readLine());  int a1 = Integer.parseInt(st.nextToken());  int a2 = Integer.parseInt(st.nextToken());  int a3 = Integer.parseInt(st.nextToken());  int a4 = Integer.parseInt(st.nextToken());  int[] aa = new int[10]; aa[0] = aa[1] = aa[2] = aa[3] = a1; aa[4] = aa[5] = aa[6] = a2; aa[7] = aa[8] = a3; aa[9] = a4; int[][] ww = new int[10][4]; ww[0][0] = 1; ww[1][1] = 1; ww[2][2] = 1; ww[3][3] = 1; ww[4][0] = ww[4][1] = 2; ww[5][1] = ww[5][2] = 2; ww[6][2] = ww[6][3] = 2; ww[7][0] = ww[7][1] = ww[7][2] = 3; ww[8][1] = ww[8][2] = ww[8][3] = 3; ww[9][0] = ww[9][1] = ww[9][2] = ww[9][3] = 4; char[][] cc = new char[4][(n + 8)]; for ( int k = 0;(k < 4);k++) { char[] c_ = cc[k]; br.readLine().getChars(0,n,c_,4); c_[0] = c_[1] = c_[2] = c_[3] = c_[(n + 4)] = c_[(n + 5)] = c_[(n + 6)] = c_[(n + 7)] = '.'; } int[][][][] dp = new int[5][5][5][5];  int[][][][] dq = new int[5][5][5][5]; fill(dp,INF); dp[4][4][4][4] = 0; int[] hh = new int[4]; for ( int i = 0;(i < (n + 4));i++) {for ( int h0 = 0;(h0 <= 4);h0++) for ( int h1 = 0;(h1 <= 4);h1++) for ( int h2 = 0;(h2 <= 4);h2++) for ( int h3 = 0;(h3 <= 4);h3++) for ( int s = 0;(s < 10);s++) {hh[0] = h0; hh[1] = h1; hh[2] = h2; hh[3] = h3; for ( int k = 0;(k < 4);k++) { int h = ww[s][k]; if ( (hh[k] < h)) {while(((h < 4) && (cc[k][(i + h)] == '.')))h++; hh[k] = h; } } int x = (dp[h0][h1][h2][h3] + aa[s]); if ( (dp[hh[0]][hh[1]][hh[2]][hh[3]] > x)) dp[hh[0]][hh[1]][hh[2]][hh[3]] = x; }fill(dq,INF); for ( int h0 = 1;(h0 <= 4);h0++) {hh[0] = (((h0 < 4) || (cc[0][(i + 4)] == '*'))?(h0 - 1):4); for ( int h1 = 1;(h1 <= 4);h1++) {hh[1] = (((h1 < 4) || (cc[1][(i + 4)] == '*'))?(h1 - 1):4); for ( int h2 = 1;(h2 <= 4);h2++) {hh[2] = (((h2 < 4) || (cc[2][(i + 4)] == '*'))?(h2 - 1):4); for ( int h3 = 1;(h3 <= 4);h3++) {hh[3] = (((h3 < 4) || (cc[3][(i + 4)] == '*'))?(h3 - 1):4); int x = dp[h0][h1][h2][h3]; if ( (dq[hh[0]][hh[1]][hh[2]][hh[3]] > x)) dq[hh[0]][hh[1]][hh[2]][hh[3]] = x; }}}} int[][][][] tmp = dp; dp = dq; dq = tmp; }System.out.println(dp[4][4][4][4]); } }
2	public class Main{ InputStream is ; PrintWriter out ; String INPUT = ""; boolean local = false; int inf = 0x7FFFFFFF; int MOD = (int)(1e9 + 7); double eps = 1e-5; double PI = Math.acos(-1); void solve(){ long maxn = nl();  long L = 1,R = maxn,ans = -1; while((L <= R)){ long mid = ((L + R) / 2); if ( (ask(1,1,mid,maxn) < 1)) L = (mid + 1); else {R = (mid - 1); ans = mid; }}if ( ((ask(1,1,ans,maxn) == 1) && (ask((ans + 1),1,maxn,maxn) == 1))) { Yts1999 a1 = gao(1,1,ans,maxn);  Yts1999 a2 = gao((ans + 1),1,maxn,maxn); answer(a1,a2); } else {L = 1; R = maxn; ans = -1; while((L <= R)){ long mid = ((L + R) / 2); if ( (ask(1,1,maxn,mid) < 1)) L = (mid + 1); else {R = (mid - 1); ans = mid; }} Yts1999 a1 = gao(1,1,maxn,ans);  Yts1999 a2 = gao(1,(ans + 1),maxn,maxn); answer(a1,a2); }} void answer( Yts1999 a1, Yts1999 a2){ out.print("!"); a1.print(); a2.print(); out.flush(); } int ask( long a, long b, long c, long d){ out.printf("? %d %d %d %d",a,b,c,d); out.println(); out.flush(); return ni();} Yts1999 gao( long x1, long x2, long y1, long y2){ long a1 = 0,a2 = 0,a3 = 0,a4 = 0;  long L ,R ; L = x1; R = y1; while((L <= R)){ long mid = ((L + R) / 2); if ( (ask(mid,x2,y1,y2) == 1)) {a1 = mid; L = (mid + 1); } else R = (mid - 1); }L = x1; R = y1; while((L <= R)){ long mid = ((L + R) / 2); if ( (ask(x1,x2,mid,y2) == 1)) {a3 = mid; R = (mid - 1); } else L = (mid + 1); }L = x2; R = y2; while((L <= R)){ long mid = ((L + R) / 2); if ( (ask(x1,mid,y1,y2) == 1)) {a2 = mid; L = (mid + 1); } else R = (mid - 1); }L = x2; R = y2; while((L <= R)){ long mid = ((L + R) / 2); if ( (ask(x1,x2,y1,mid) == 1)) {a4 = mid; R = (mid - 1); } else L = (mid + 1); }return new Yts1999(a1,a2,a3,a4);} public class Yts1999 implements Comparable{ public long a ,b ,c ,d ; public Yts1999( long a, long b, long c, long d){ this.a = a; this.b = b; this.c = c; this.d = d; } public void print(){ out.printf(" %d %d %d %d",a,b,c,d); } } long[] exgcd( long a, long b){ if ( (b == 0)) return new long[]{1,0,a}; long[] res = exgcd(b,(a % b));  long t = res[0]; res[0] = res[1]; res[1] = t; res[1] -= ((a / b) * res[0]); return res;} long gcd( long a, long b){ return ((b == 0)?a:gcd(b,(a % b)));} private void run(){ is = (local?new ByteArrayInputStream(INPUT.getBytes()):System.in); 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 Main().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 void tr( Object... o){ if ( local) System.out.println(Arrays.deepToString(o)); } }
0	public class Main{ void solve( Scanner in, PrintWriter out){ out.println(25); } void run(){ Locale.setDefault(Locale.US); try(Scanner in=new Scanner(System.in);PrintWriter out=new PrintWriter(System.out)){solve(in,out); }} public static void main( String[] args){ new Main().run(); } }
4	public class G{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni(),m = ni(),K = ni(),C = ni(),D = ni();  int[] a = na(K);  int[] from = new int[m];  int[] to = new int[m]; for ( int i = 0;(i < m);i++) {from[i] = (ni() - 1); to[i] = (ni() - 1); } int[][] g = packU(n,from,to);  List<Edge> es = new ArrayList<>();  int time = 100; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < (time - 1));j++) {es.add(new Edge(((i * time) + j),(((i * time) + j) + 1),99,C)); }}for ( int i = 0;(i < n);i++) {for ( int e :g[i]) {for ( int j = 0;(j < (time - 1));j++) {for ( int k = 0;(k < n);k++) {es.add(new Edge(((i * time) + j),(((e * time) + j) + 1),1,(C + (D * ((2 * k) + 1))))); }}}} int src = (time * n),sink = (src + 1); for ( int i = 0;(i < K);i++) {es.add(new Edge(src,(((a[i] - 1) * time) + 0),1,0)); }for ( int i = 0;(i < time);i++) {es.add(new Edge(((0 * time) + i),sink,99,0)); }out.println(solveMinCostFlowWithSPFA(compileWD((sink + 1),es),src,sink,99)); } public static class Edge{ public int from ,to ; public int capacity ; public int cost ; public int flow ; public Edge complement ; public Edge( int from, int to, int capacity, int cost){ this.from = from; this.to = to; this.capacity = capacity; this.cost = cost; } } public static Edge[][] compileWD( int n, List<Edge> edges){ Edge[][] g = new Edge[n][]; for ( int i = (edges.size() - 1);(i >= 0);i--) { Edge origin = edges.get(i);  Edge clone = new Edge(origin.to,origin.from,origin.capacity,-origin.cost); clone.flow = origin.capacity; clone.complement = origin; origin.complement = clone; edges.add(clone); } int[] p = new int[n]; for ( Edge e :edges) p[e.from]++; for ( int i = 0;(i < n);i++) g[i] = new Edge[p[i]]; for ( Edge e :edges) g[e.from][--p[e.from]] = e; return g;} public static class DQ{ public int[] q ; public int n ; protected int pt ,ph ; public DQ( int n){ this.n = (Integer.highestOneBit(n) << 1); q = new int[this.n]; pt = ph = 0; } public void addLast( int x){ q[ph] = x; ph = ((ph + 1) & (n - 1)); } public int pollFirst(){ int ret = q[pt]; pt = ((pt + 1) & (n - 1)); return ret;} public int size(){ return (((ph - pt) + n) & (n - 1));} public boolean isEmpty(){ return (ph == pt);} } public static long solveMinCostFlowWithSPFA( Edge[][] g, int source, int sink, long all){ int n = g.length;  long mincost = 0; final int[] d = new int[n];  DQ q = new DQ(n);  boolean[] inq = new boolean[n]; while((all > 0)){ Edge[] inedge = new Edge[n]; Arrays.fill(d,(Integer.MAX_VALUE / 2)); d[source] = 0; q.addLast(source); while(!q.isEmpty()){ int cur = q.pollFirst(); inq[cur] = false; for ( Edge ne :g[cur]) {if ( ((ne.capacity - ne.flow) > 0)) { int nd = (d[cur] + ne.cost); if ( (d[ne.to] > nd)) {inedge[ne.to] = ne; d[ne.to] = nd; if ( !inq[ne.to]) {q.addLast(ne.to); inq[ne.to] = true; } } } }}if ( (inedge[sink] == null)) break; long minflow = all;  long sumcost = 0; for ( Edge e = inedge[sink];(e != null);e = inedge[e.from]) {if ( ((e.capacity - e.flow) < minflow)) minflow = (e.capacity - e.flow); sumcost += e.cost; }mincost += (minflow * sumcost); for ( Edge e = inedge[sink];(e != null);e = inedge[e.from]) {e.flow += minflow; e.complement.flow -= minflow; }all -= minflow; }return mincost;} static int[][] packU( int n, int[] from, int[] to){ int[][] g = new int[n][];  int[] p = new int[n]; for ( int f :from) p[f]++; for ( int t :to) p[t]++; for ( int i = 0;(i < n);i++) g[i] = new int[p[i]]; for ( int i = 0;(i < from.length);i++) {g[from[i]][--p[from[i]]] = to[i]; g[to[i]][--p[to[i]]] = from[i]; }return g;} 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 G().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
6	public class DarkAssembly extends Thread{ public DarkAssembly(){ this.input = new BufferedReader(new InputStreamReader(System.in)); this.output = new PrintWriter(System.out); this.setPriority(Thread.MAX_PRIORITY); } static class Senator{ int loyalty ; int level ; public Senator( int level, int loyalty){ this.level = level; this.loyalty = loyalty; } } static private double doIt( Senator[] senators, int A){ double probability = .0; for ( int mask = 0;(mask < (1 << senators.length));++mask) { int sum = A;  double current = 1.0; for ( int i = 0;(i < senators.length);++i) {if ( ((mask & (1 << i)) != 0)) {current *= (.01 * senators[i].loyalty); } else {current *= (.01 * (100 - senators[i].loyalty)); sum += senators[i].level; }}if ( (getOnes(mask) > (senators.length / 2))) {probability += current; } else {probability += ((current * (double)A) / sum); }}return probability;} static private double go( Senator[] senators, int candies, int A, int current){ if ( (current == senators.length)) {return doIt(senators,A);} else { double result = go(senators,candies,A,(current + 1)); if ( ((candies > 0) && (senators[current].loyalty < 100))) {senators[current].loyalty += 10; result = Math.max(result,go(senators,(candies - 1),A,current)); senators[current].loyalty -= 10; } return result;}} static int getOnes( int mask){ int result = 0; while((mask != 0)){mask &= (mask - 1); ++result; }return result;} public static void main( String[] args){ new DarkAssembly().start(); } private String nextToken()throws IOException { while(((tokens == null) || !tokens.hasMoreTokens())){tokens = new StringTokenizer(input.readLine()); }return tokens.nextToken();} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} private BufferedReader input ; private PrintWriter output ; private StringTokenizer tokens = null; }
6	public class Main{ public static void main( String[] args){ new Main().run(); } FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ out.println(work()); out.flush(); } long mod = 1000000007; long gcd( long a, long b){ return ((b == 0)?a:gcd(b,(a % b)));} long work(){ int n = in.nextInt();  int m = in.nextInt();  String str = in.next();  long[] dp = new long[(1 << m)];  long[][] cnt = new long[m][m];  long[] rec = new long[(1 << m)]; for ( int i = 1;(i < n);i++) { int n1 = (str.charAt((i - 1)) - 'a');  int n2 = (str.charAt(i) - 'a'); cnt[n1][n2]++; cnt[n2][n1]++; }for ( int i = 1;(i < (1 << m));i++) {dp[i] = 9999999999L; long v = 0;  int b = 0; for ( int j = 0;(j < m);j++) {if ( ((i & (1 << j)) > 0)) {b = j; break;} }for ( int j = 0;(j < m);j++) {if ( ((i & (1 << j)) == 0)) {v += cnt[b][j]; } else {if ( (b != j)) v -= cnt[b][j]; }}v += rec[(i - (1 << b))]; for ( int j = 0;(j < m);j++) {if ( ((i & (1 << j)) > 0)) {dp[i] = Math.min(dp[i],(dp[(i - (1 << j))] + v)); } }rec[i] = v; }return dp[((1 << m) - 1)];} } class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ if ( ((st == null) || !st.hasMoreElements())) {try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } } return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} }
0	public class Main{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n ,b = 0; n = in.nextInt(); if ( ((n % 2) == 0)) {b = (n + (n / 2)); System.out.println(b); } } }
1	public class Waw{ public static void main( String[] args)throws Exception { Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  long[] a = new long[n]; for ( int i = 0;(i < n);i++) a[i] = sc.nextLong(); long[] p = new long[n]; p[(n - 1)] = a[(n - 1)]; for ( int i = (n - 2);(i >= 0);i--) {if ( (a[i] < p[(i + 1)])) p[i] = (p[(i + 1)] - 1); else p[i] = a[i]; } long max = p[0];  long res = (p[0] - a[0]); for ( int i = 1;(i < n);i++) {if ( (max < p[i])) max = p[i]; res += (max - a[i]); }System.out.println(res); } }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,kk ,bb ; int[] uu ,vv ,uv ,cost ,cost_ ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; kk = new int[n_]; bb = new int[n_]; uu = new int[m_]; vv = new int[m_]; uv = new int[m_]; cost = new int[m_]; cost_ = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; uv[h] = (u ^ v); cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } void dijkstra( int s){ Arrays.fill(pi,INF); pi[s] = 0; TreeSet<Integer> pq = new TreeSet<>((u,v)->((pi[u] != pi[v])?(pi[u] - pi[v]):((kk[u] != kk[v])?(kk[u] - kk[v]):(u - v)))); pq.add(s); Integer first ; while(((first = pq.pollFirst()) != null)){ int u = first;  int k = (kk[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost_[h]:-cost_[h]));  int v = (u ^ uv[h]); if ( ((pi[v] > p) || ((pi[v] == p) && (kk[v] > k)))) {if ( (pi[v] < INF)) pq.remove(v); pi[v] = p; kk[v] = k; bb[v] = h_; pq.add(v); } } }} void push1( int s, int t){ for ( int u = t,h_ ,h ;(u != s);u ^= uv[h]) {h = ((h_ = bb[u]) >> 1); cc[h_]--; cc[(h_ ^ 1)]++; }} int edmonds_karp( int s, int t){ System.arraycopy(cost,0,cost_,0,m_); while(true){dijkstra(s); if ( (pi[t] == INF)) break; push1(s,t); for ( int h = 0;(h < m_);h++) { int u = uu[h],v = vv[h]; if ( ((pi[u] != INF) && (pi[v] != INF))) cost_[h] += (pi[u] - pi[v]); }} int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
3	public class TestClass{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int arr[] = new int[(n + 1)]; for ( int i = 0;(i < n);i++) arr[(i + 1)] = in.nextInt(); long sum[] = new long[(n + 1)]; for ( int i = 1;(i <= n);i++) sum[i] = (sum[(i - 1)] + arr[i]); long dp[] = new long[(n + 1)]; for ( int i = 1;(i <= n);i++) {for ( int j = i;((j > (i - m)) && (j >= 1));j--) { long val = (((sum[i] - sum[(j - 1)]) + dp[(j - 1)]) - k); dp[i] = Math.max(dp[i],val); }} long max = 0; for ( int i = 1;(i <= n);i++) max = Math.max(max,dp[i]); System.out.println(max); } }
0	public class A{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); System.out.println((((n % 2) == 0)?((4 + " ") + (n - 4)):((9 + " ") + (n - 9)))); } }
0	public class MainA{ static StringTokenizer ST ; static BufferedReader IN ; static BufferedWriter OUT ; {IN = new BufferedReader(new InputStreamReader(System.in)); OUT = new BufferedWriter(new OutputStreamWriter(System.out)); }public static void main( String[] args)throws IOException { pl("25"); cAll(); } static String nlnt()throws IOException { String l ; while((((l = IN.readLine()) != null) && ((l = l.trim()) == 0))){}return l;} static void pl( String s)throws IOException { OUT.write(s); OUT.newLine(); } static void pl( char c)throws IOException { OUT.write(c); OUT.newLine(); } static void pl( char[] s)throws IOException { OUT.write(s); OUT.newLine(); } static void pl()throws IOException { OUT.newLine(); } static void cAll()throws IOException { IN.close(); OUT.close(); } }
6	public class E{ static Scanner sc = new Scanner(System.in); static int N ; static double[][] p ; static DecimalFormat format = new DecimalFormat("0.000000"); public static void main( String[] args)throws Exception { N = sc.nextInt(); p = new double[N][N]; for ( int i = 0;(i < N);++i) {for ( int j = 0;(j < N);++j) {p[i][j] = sc.nextDouble(); }} double[] memo = new double[(1 << N)]; memo[(memo.length - 1)] = 1; for ( int i = N;(i >= 2);--i) { int[] live = new int[N]; for ( int j = 0;(j < i);++j) {live[((N - 1) - j)] = 1; }do { int n = toInt(live);  double norm = ((2.0 / i) / (i - 1)); for ( int f1 = 0;(f1 < N);++f1) {if ( (live[f1] == 0)) continue; for ( int f2 = (f1 + 1);(f2 < N);++f2) {if ( (live[f2] == 0)) continue; memo[(n - (1 << f1))] += ((memo[n] * p[f2][f1]) * norm); memo[(n - (1 << f2))] += ((memo[n] * p[f1][f2]) * norm); }}}while(nextPermutation(live));}for ( int i = 0;(i < N);++i) {System.out.print(format.format(memo[(1 << i)])); if ( (i < (N - 1))) {System.out.print(" "); } }} static int toInt( int[] a){ int ret = 0; for ( int i = 0;(i < N);++i) {ret += ((1 << i) * a[i]); }return ret;} public static boolean nextPermutation( int[] a){ for ( int i = (a.length - 1);(i > 0);--i) {if ( (a[(i - 1)] < a[i])) { int swapIndex = find(a[(i - 1)],a,i,(a.length - 1));  int temp = a[swapIndex]; a[swapIndex] = a[(i - 1)]; a[(i - 1)] = temp; Arrays.sort(a,i,a.length); return true;} }return false;} static private int find( int dest, int[] a, int s, int e){ if ( (s == e)) {return s;} int m = (((s + e) + 1) / 2); return ((a[m] <= dest)?find(dest,a,s,(m - 1)):find(dest,a,m,e));} }
2	public class A{ public static BufferedReader in ; public static PrintWriter out ; public static void main( String[] args)throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); boolean showLineError = true; if ( showLineError) {solve(); out.close(); } else {try{solve(); }catch (Exception e){ } finally{out.close(); }}} static private void solve()throws IOException { String[] line = in.readLine().split(" ");  String l = Long.toBinaryString(Long.parseLong(line[0]));  String r = Long.toBinaryString(Long.parseLong(line[1])); if ( l.equals(r)) {out.println(0); return ;} int dif = (r.length() - l.length()); for ( int i = 0;(i < dif);i++) l = ("0" + l); int index = 0; for ( ;(index < r.length());index++) {if ( (l.charAt(index) != r.charAt(index))) break; } long ret = 1; for ( int i = 0;(i < (l.length() - index));i++) ret += ret; ret--; out.println(ret); } }
2	public class Main{ static final int MAX_N = 1000010; static final int INF = 0x3f3f3f3f; static final int mod = 1000000007; public static void main( String[] args)throws IOException { initReader(System.in); solve(); pw.flush(); } public static void solve()throws IOException { while(hasNext()){ long n = (nextLong() - 1);  long k = 1,x = 9; while(((n - (k * x)) >= 0)){n -= (k * x); k += 1; x *= 10; }if ( (n == 0)) pw.println(1); else { long num = ((x / 9) + (n / k));  String s = String.valueOf(num); pw.println(s.charAt((int)(n % k))); }}} static BufferedReader reader ; static StringTokenizer tokenizer ; static PrintWriter pw ; public static void initReader( InputStream input)throws IOException { reader = new BufferedReader(new InputStreamReader(input)); tokenizer = new StringTokenizer(""); pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); } public static boolean hasNext(){ try{while(!tokenizer.hasMoreTokens()){tokenizer = new StringTokenizer(reader.readLine()); } }catch (Exception e){ return false;} return true;} public static String next()throws IOException { while(!tokenizer.hasMoreTokens()){tokenizer = new StringTokenizer(reader.readLine()); }return tokenizer.nextToken();} public static long nextLong()throws IOException { return Long.parseLong(next());} }
2	public class Digits_Sequence_Hard_Edition_Kamel{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long k = sc.nextLong(); getResult(k); sc.close(); } static void getResult( long k){ long val = 0; ; long ten = 1;  int i = 1; while(true){val = ((9l * ten) * i); if ( (k <= val)) {decompose(k,ten,i); System.exit(0); } else {k -= val; ten = (ten * 10l); i++; }}} static void decompose( long offset, long ten, int size){ long val = ((ten - 1) + (long)Math.ceil(((double)offset / size)));  int digit = ((int)(((offset % size) - 1) + size) % size);  String result = String.valueOf(val).substring(digit,(digit + 1)); System.out.print(result); } }
2	public class Main{ static final long Mod = 1000000009; static long n ,m ,k ,t ,l ,u ,ans ; static Scanner cin = new Scanner(System.in); static long multi_mod( long base, long cur){ long res = 1; while((cur > 0)){if ( ((cur % 2) == 1)) res = ((res * base) % Mod); cur >>= 1; base = ((base * base) % Mod); }return res;} public static void main( String[] args){ n = cin.nextLong(); m = cin.nextLong(); k = cin.nextLong(); l = (((k - 1) * (n / k)) + (n % k)); if ( (m <= l)) {System.out.println(m); } else {t = (n / k); u = (m - l); ans = (((0 + ((t - u) * (k - 1))) + (n % k)) % Mod); ans = ((ans + ((k * (((multi_mod(2,(u + 1)) - 2) + Mod) % Mod)) % Mod)) % Mod); System.out.println(ans); }} }
4	public class Main{ static ArrayList<Edge> graph ; static ArrayList<ArrayList<Integer>> graphForKuhn ; static int n ,m ,u = 0; static int mt[] ; static int used[] ; public static void main( String[] args){ formGraph(); System.out.println(getAnswer()); } static boolean kuhn( int start){ if ( (used[start] == u)) return false; used[start] = u; for ( int i = 0;(i < graphForKuhn.get(start).size());i++) { int to = graphForKuhn.get(start).get(i); if ( ((mt[to] == -1) || kuhn(mt[to]))) {mt[to] = start; return true;} }return false;} static private int getAnswer(){ int currentAnswer = Integer.MAX_VALUE; for ( int cur = 0;(cur < n);cur++) { int adj = 0,otheradj = 0,answer = 0; for ( int j = 0;(j < n);j++) {graphForKuhn.get(j).clear(); mt[j] = -1; }for ( int j = 0;(j < m);j++) {if ( ((graph.get(j).from == cur) || (graph.get(j).to == cur))) adj++; else {graphForKuhn.get(graph.get(j).from).add(graph.get(j).to); otheradj++; }}for ( int j = 0;(j < n);j++) {u++; kuhn(j); } int tsz = 0; for ( int j = 0;(j < n);j++) {if ( (mt[j] != -1)) tsz++; }answer = ((((((2 * (n - 1)) + 1) - adj) + otheradj) - (2 * tsz)) + (n - 1)); currentAnswer = Math.min(answer,currentAnswer); }return currentAnswer;} static private void formGraph(){ Scanner in = new Scanner(System.in); n = in.nextInt(); m = in.nextInt(); graph = new ArrayList<Edge>(m); for ( int i = 0;(i < m);i++) { int x = in.nextInt();  int y = in.nextInt(); graph.add(new Edge((x - 1),(y - 1))); }graphForKuhn = new ArrayList<ArrayList<Integer>>(n); for ( int i = 0;(i < n);i++) graphForKuhn.add(new ArrayList<Integer>(n)); mt = new int[n]; used = new int[n]; in.close(); } } class Edge{ int from ; int to ; public Edge( int from, int to){ this.from = from; this.to = to; } }
2	public class Main{ public static void main( String[] args){ for ( Scanner cin = new Scanner(System.in);cin.hasNextLong();System.out.println(Math.max(0,((Long.highestOneBit((cin.nextLong() ^ cin.nextLong())) << 1) - 1)))) ;} }
0	public class Main{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long num = in.nextLong();  long lcm = 1; if ( (num == 2)) {System.out.println(2); System.exit(0); } else if ( (((num % 2) == 0) && ((num % 3) != 0))) lcm = ((num * (num - 1)) * (num - 3)); else if ( (((num % 2) == 0) && ((num % 3) == 0))) lcm = (((num - 1) * (num - 2)) * (num - 3)); else if ( (((num % 2) != 0) && (num > 2))) lcm = ((num * (num - 1)) * (num - 2)); System.out.println(lcm); } }
6	public class E{ public static void main( String[] args){ new E(new Scanner(System.in)); } public E( Scanner in){ int N = in.nextInt();  double[][] g = new double[N][N]; for ( int j = 0;(j < N);j++) for ( int i = 0;(i < N);i++) g[i][j] = in.nextDouble(); double[] memo = new double[(1 << N)]; memo[((1 << N) - 1)] = 1.0; for ( int m = ((1 << N) - 1);(m > 0);m--) { int cnt = 0; for ( int i = 0;(i < N);i++) { int m1 = (1 << i); if ( ((m1 & m) > 0)) cnt++; } int sum = ((cnt * (cnt - 1)) / 2); for ( int i = 0;(i < N);i++) { int m1 = (1 << i); if ( ((m1 & m) == 0)) continue; for ( int j = (i + 1);(j < N);j++) { int m2 = (1 << j); if ( ((m2 & m) == 0)) continue; memo[(m - m1)] += ((g[i][j] * memo[m]) / sum); memo[(m - m2)] += ((g[j][i] * memo[m]) / sum); }}} StringBuilder sb = new StringBuilder(); for ( int i = 0;(i < N);i++) { double res = memo[(1 << i)]; sb.append(String.format("%.8f",res)); sb.append(' '); }System.out.println(sb.toString().trim()); } }
6	public class thing{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  int m = in.nextInt();  String s = in.next();  int[][] count = new int[m][m];  int[] dp = new int[(1 << m)]; Arrays.fill(dp,Integer.MAX_VALUE); dp[0] = 0; for ( int i = 1;(i < n);i++) { int a = (s.charAt(i) - 'a');  int b = (s.charAt((i - 1)) - 'a'); count[a][b]++; count[b][a]++; }for ( int i = 1;(i < (1 << m));i++) { int pos = set_bits(i); for ( int j = 0;((i >> j) != 0);j++) {if ( (((i >> j) & 1) == 0)) continue; int sum = 0; for ( int mask = i,y = 0;(y < m);mask >>= 1,y++) {if ( (y == j)) continue; if ( ((mask & 1) == 1)) sum += count[j][y]; else sum -= count[j][y]; } int calc = (dp[(i - (1 << j))] + (pos * sum)); dp[i] = Math.min(dp[i],calc); }}System.out.println(dp[((1 << m) - 1)]); } public static int set_bits( int n){ int count = 0; while((n > 0)){count += (n & 1); n >>= 1; }return count;} }
3	public class G{ static final int MOD = 1000000007; static int add( int a, int b){ int res = (a + b); return ((res >= MOD)?(res - MOD):res);} static int mul( int a, int b){ int res = (int)(((long)a * b) % MOD); return ((res < 0)?(res + MOD):res);} static int pow( int a, int e){ if ( (e == 0)) {return 1;} int r = a; for ( int i = (30 - Integer.numberOfLeadingZeros(e));(i >= 0);i--) {r = mul(r,r); if ( ((e & (1 << i)) != 0)) {r = mul(r,a); } }return r;} static int inv( int a){ return pow(a,(MOD - 2));} static void solve()throws Exception { String x = scanString();  int n = x.length();  int pows[][] = new int[10][n]; for ( int i = 0;(i < 10);i++) {pows[i][0] = 1; for ( int j = 1;(j < n);j++) {pows[i][j] = mul(pows[i][(j - 1)],i); }} int ru[] = new int[(n + 1)]; for ( int i = 1;(i <= n);i++) {ru[i] = add(1,mul(10,ru[(i - 1)])); } int facts[] = new int[n]; facts[0] = 1; for ( int i = 1;(i < n);i++) {facts[i] = mul(facts[(i - 1)],i); } int factsInv[] = new int[n]; factsInv[(n - 1)] = inv(facts[(n - 1)]); for ( int i = (n - 1);(i > 0);i--) {factsInv[(i - 1)] = mul(factsInv[i],i); } int ans = 0;  int off[] = new int[10]; for ( int i = 0;(i < n);i++) { int cd = (x.charAt(i) - '0');  int l = ((n - i) - 1); for ( int d = 1;(d < 10);d++) {for ( int p = 0;(p <= l);p++) { int mul = ((d < cd)?add(mul(d,ru[(p + off[d])]),mul((cd - d),ru[((p + off[d]) + 1)])):mul(cd,ru[(p + off[d])])); ans = add(ans,mul(mul,mul(mul(pows[d][(l - p)],pows[(10 - d)][p]),mul(facts[l],mul(factsInv[p],factsInv[(l - p)]))))); }}for ( int d = 0;(d <= cd);d++) {++off[d]; }}for ( int d = 1;(d < 10);d++) {ans = add(ans,ru[off[d]]); }out.print(ans); } static String scanString()throws IOException { while(((tok == null) || !tok.hasMoreTokens())){tok = new StringTokenizer(in.readLine()); }return tok.nextToken();} static BufferedReader in ; static PrintWriter out ; static StringTokenizer tok ; public static void main( String[] args){ try{in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); in.close(); out.close(); }catch (Throwable e){ e.printStackTrace(); exit(1); } } }
6	public class Fish extends Thread{ public Fish(){ this.input = new BufferedReader(new InputStreamReader(System.in)); this.output = new PrintWriter(System.out); this.setPriority(Thread.MAX_PRIORITY); } static int getOnes( int mask){ int result = 0; while((mask != 0)){mask &= (mask - 1); ++result; }return result;} private void solve()throws Throwable { int n = nextInt();  double[][] a = new double[n][n];  double[] dp = new double[(1 << n)]; for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < n);++j) {a[i][j] = nextDouble(); }} int limit = ((1 << n) - 1); dp[limit] = 1.0; for ( int mask = limit;(mask > 0);--mask) { int cardinality = getOnes(mask);  int probability = ((cardinality * (cardinality - 1)) / 2); for ( int first = 0;(first < n);++first) {if ( ((mask & powers[first]) != 0)) {for ( int second = (first + 1);(second < n);++second) {if ( ((mask & powers[second]) != 0)) {dp[(mask - powers[first])] += ((dp[mask] * a[second][first]) / probability); dp[(mask - powers[second])] += ((dp[mask] * a[first][second]) / probability); } }} }}for ( int i = 0;(i < n);++i) {output.printf("%.10f ",dp[powers[i]]); }} public static void main( String[] args){ new Fish().start(); } private String nextToken()throws IOException { while(((tokens == null) || !tokens.hasMoreTokens())){tokens = new StringTokenizer(input.readLine()); }return tokens.nextToken();} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} private double nextDouble()throws IOException { return Double.parseDouble(nextToken());} static final int powers[] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144}; private BufferedReader input ; private PrintWriter output ; private StringTokenizer tokens = null; }
0	public class AlexAndARhombus{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); System.out.println(((n * n) + ((n - 1) * (n - 1)))); sc.close(); } }
2	public class Code{ public Code(){ } public static void main( String[] args){ Scanner QQQ = new Scanner(System.in);  long l = QQQ.nextLong();  long r = QQQ.nextLong();  long ans = (l ^ r);  int a[] = new int[70];  int b[] = new int[70];  int n = 0,m = 0; while((l != 0)){a[m] = (int)(l % 2); l /= 2; m++; }while((r != 0)){b[n] = (int)(r % 2); r /= 2; n++; }m--; n--; long deg[] = new long[70]; deg[0] = 1; for ( int i = 1;(i <= 62);i++) deg[i] = (deg[(i - 1)] * 2); for ( int i = n;(i >= 0);i--) if ( ((b[i] == 1) && (a[i] == 0))) {System.out.println((deg[(i + 1)] - 1)); return ;} System.out.println(ans); } }
1	public class Main{ static String S ; public static void main( String[] args){ FastScanner sc = new FastScanner(System.in); S = sc.next(); System.out.println(solve()); } static int solve(){ int ans = -1;  int time = 1;  int n = S.length(); for ( int i = 1;(i < (n * 2));i++) {if ( (S.charAt(((i - 1) % n)) != S.charAt((i % n)))) {time++; } else {ans = Math.max(time,ans); time = 1; }}ans = Math.max(time,ans); if ( (ans == (n * 2))) {return n;} else {return ans;}} @SuppressWarnings("unused") static class FastScanner{ private BufferedReader reader ; private StringTokenizer tokenizer ; FastScanner( InputStream in){ reader = new BufferedReader(new InputStreamReader(in)); tokenizer = null; } String next(){ if ( ((tokenizer == null) || !tokenizer.hasMoreTokens())) {try{tokenizer = new StringTokenizer(reader.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} } return tokenizer.nextToken();} long nextLong(){ return Long.parseLong(next());} int nextInt(){ return Integer.parseInt(next());} } static int max( int... as){ int max = Integer.MIN_VALUE; for ( int a :as) max = Math.max(a,max); return max;} static int min( int... as){ int min = Integer.MAX_VALUE; for ( int a :as) min = Math.min(a,min); return min;} }
6	public class Main{ public static int n ; public static double[] dp ; public static double[][] p ; public static void main( String[] args){ Scanner in = new Scanner(System.in); n = in.nextInt(); dp = new double[(1 << n)]; p = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {p[i][j] = in.nextDouble(); }}for ( int i = 0;(i < (1 << n));i++) {dp[i] = -1; }dp[((1 << n) - 1)] = 1; DecimalFormat d = new DecimalFormat("0.000000"); System.out.print(d.format(f((1 << 0)))); for ( int i = 1;(i < n);i++) {System.out.print((" " + d.format(f((1 << i))))); }} public static double f( int mask){ if ( (dp[mask] > -0.5)) return dp[mask]; dp[mask] = 0; int vivos = 1; for ( int i = 0;(i < n);i++) if ( (((mask >> i) % 2) == 1)) vivos++;  double pares = ((vivos * (vivos - 1)) / 2); for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {if ( (((mask & (1 << i)) != 0) && ((mask & (1 << j)) == 0))) {dp[mask] += ((f((mask | (1 << j))) * p[i][j]) / pares); } }}return dp[mask];} }
6	public class cf1238e{ public static void main( String[] args)throws IOException { int n = rni(),m = ni(),cnt[][] = new int[m][m],dp[] = new int[(1 << m)],all = ((1 << m) - 1);  char[] s = rcha(); for ( int i = 1;(i < n);++i) {++cnt[(s[i] - 'a')][(s[(i - 1)] - 'a')]; ++cnt[(s[(i - 1)] - 'a')][(s[i] - 'a')]; }fill(dp,IBIG); dp[0] = 0; int cnt_bit[] = new int[(1 << m)],min_bit[] = new int[(1 << m)],d[][] = new int[(1 << m)][m]; for ( int mask = 1;(mask <= all);++mask) {cnt_bit[mask] = (1 + cnt_bit[(mask & (mask - 1))]); for ( int i = 0;(i < n);++i) {if ( ((mask & (1 << i)) > 0)) {min_bit[mask] = i; break;} }}for ( int mask = 1;(mask <= all);++mask) {for ( int i = 0;(i < m);++i) {d[mask][i] = (d[(mask ^ (1 << min_bit[mask]))][i] + cnt[i][min_bit[mask]]); }}for ( int mask = 0;(mask <= all);++mask) {for ( int i = 0;(i < m);++i) {if ( ((mask & (1 << i)) > 0)) {continue;} int pos = cnt_bit[mask],next = (mask | (1 << i)); dp[next] = min(dp[next],(dp[mask] + (pos * (d[mask][i] - d[(all ^ next)][i])))); }}prln(dp[all]); close(); } static BufferedReader __in = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter __out = new PrintWriter(new OutputStreamWriter(System.out)); static StringTokenizer input ; static Random __rand = new Random(); static final int IBIG = 1000000007; static final int IMAX = 2147483647; static final int IMIN = -2147483648; static final long LMAX = 9223372036854775807L; static final long LMIN = -9223372036854775808L; static int gcf( int a, int b){ return ((b == 0)?a:gcf(b,(a % b)));} static long gcf( long a, long b){ return ((b == 0)?a:gcf(b,(a % b)));} static int randInt( int min, int max){ return (__rand.nextInt(((max - min) + 1)) + min);} static void shuffle( int[] a){ int n = (a.length - 1); for ( int i = 0;(i < n);++i) { int ind = randInt(i,n);  int swap = a[i]; a[i] = a[ind]; a[ind] = swap; }} static void shuffle( long[] a){ int n = (a.length - 1); for ( int i = 0;(i < n);++i) { int ind = randInt(i,n);  long swap = a[i]; a[i] = a[ind]; a[ind] = swap; }} static void shuffle( double[] a){ int n = (a.length - 1); for ( int i = 0;(i < n);++i) { int ind = randInt(i,n);  double swap = a[i]; a[i] = a[ind]; a[ind] = swap; }} static List<List<Integer>> g( int n){ List<List<Integer>> g = new ArrayList<>(); for ( int i = 0;(i < n);++i) g.add(new ArrayList<>()); return g;} static List<Set<Integer>> sg( int n){ List<Set<Integer>> g = new ArrayList<>(); for ( int i = 0;(i < n);++i) g.add(new HashSet<>()); return g;} static void c( List<? extends Collection<Integer>> g, int u, int v){ g.get(u).add(v); g.get(v).add(u); } static void cto( List<? extends Collection<Integer>> g, int u, int v){ g.get(u).add(v); } static void r()throws IOException { input = new StringTokenizer(rline()); } static char[] rcha()throws IOException { return rline().toCharArray();} static String rline()throws IOException { return __in.readLine();} static String n(){ return input.nextToken();} static int rni()throws IOException { r(); return ni();} static int ni(){ return Integer.parseInt(n());} static long nl(){ return Long.parseLong(n());} static double nd(){ return Double.parseDouble(n());} static void pr( int i){ __out.print(i); } static void prln( int i){ __out.println(i); } static void pr( long l){ __out.print(l); } static void prln( long l){ __out.println(l); } static void pr( double d){ __out.print(d); } static void prln( double d){ __out.println(d); } static void pr( char c){ __out.print(c); } static void prln( char c){ __out.println(c); } static void pr( char[] s){ __out.print(new String(s)); } static void prln( char[] s){ __out.println(new String(s)); } static void pr( String s){ __out.print(s); } static void prln( String s){ __out.println(s); } static void pr( Object o){ __out.print(o); } static void prln( Object o){ __out.println(o); } static void prln(){ __out.println(); } static void prln( int... a){ for ( int i = 0,len = (a.length - 1);(i < len);pr(a[i]),pr(' '),++i) ;if ( (a.length > 0)) prln(a[(a.length - 1)]); else prln(); } static void prln( long... a){ for ( int i = 0,len = (a.length - 1);(i < len);pr(a[i]),pr(' '),++i) ;if ( (a.length > 0)) prln(a[(a.length - 1)]); else prln(); } static void prln( double... a){ for ( int i = 0,len = (a.length - 1);(i < len);pr(a[i]),pr(' '),++i) ;if ( (a.length > 0)) prln(a[(a.length - 1)]); else prln(); } static <T> void prln( Collection<T> c){ int n = (c.size() - 1);  Iterator<T> iter = c.iterator(); for ( int i = 0;(i < n);pr(iter.next()),pr(' '),++i) ;if ( (n >= 0)) prln(iter.next()); else prln(); } static void flush(){ __out.flush(); } static void close(){ __out.close(); } }
2	public class Main{ static private final long MOD = 998244353; public static void main( String[] args)throws FileNotFoundException { InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  int n = in.nextInt(); if ( (((n / 2) % 2) != 0)) {out.println("! -1"); out.flush(); out.close(); return ;} int[] a = new int[n]; Arrays.fill(a,Integer.MAX_VALUE); int l1 = 0;  int r1 = (l1 + (n / 2));  int l2 = r1;  int r2 = n;  int ans = -1; while(true){getValue(in,out,a,l1); getValue(in,out,a,r1); getValue(in,out,a,l2); getValue(in,out,a,(r2 % n)); if ( (a[l1] == a[l2])) {ans = l1; break;} if ( (a[r1] == a[(r2 % n)])) {ans = r1; break;} int m1 = ((l1 + r1) / 2); getValue(in,out,a,m1); int m2 = ((l2 + r2) / 2); getValue(in,out,a,m2); if ( (a[m1] == a[m2])) {ans = m1; break;} if ( (((a[l1] <= a[m1]) && (a[l2] <= a[m2])) || ((a[l1] >= a[m1]) && (a[l2] >= a[m2])))) {if ( ((a[l1] <= a[l2]) && (a[m1] >= a[m2]))) {r1 = m1; r2 = m2; continue;} if ( ((a[l1] >= a[l2]) && (a[m1] <= a[m2]))) {r1 = m1; r2 = m2; continue;} } if ( ((((a[l1] <= a[m1]) && (a[l2] >= a[m2])) && (a[l1] <= a[l2])) && (a[m1] >= a[m2]))) {r1 = m1; r2 = m2; continue;} if ( ((((a[l1] >= a[m1]) && (a[l2] <= a[m2])) && (a[l1] >= a[l2])) && (a[m1] <= a[m2]))) {r1 = m1; r2 = m2; continue;} l1 = m1; l2 = m2; }out.println(("! " + (ans + 1))); out.close(); } static private void getValue( InputReader in, PrintWriter out, int[] a, int l){ if ( (a[l] == Integer.MAX_VALUE)) {out.println(("? " + (l + 1))); out.flush(); a[l] = in.nextInt(); } } static int binSearchRight( List<Long> list, long key, int start, int end){ int l = (start - 1);  int r = end; while((l < (r - 1))){ int m = ((l + r) / 2); if ( (list.get(m) <= key)) {l = m; } else {r = m; }}return l;} static private 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());} public long nextLong(){ return Long.parseLong(next());} private List<Integer>[] readGraph( int n, int m){ List<Integer>[] result = new ArrayList[n]; for ( int i = 0;(i < n);i++) {result[i] = new ArrayList<>(); }for ( int i = 0;(i < m);i++) { int u = (nextInt() - 1);  int v = (nextInt() - 1); result[u].add(v); result[v].add(u); }return result;} } }
2	public class Main{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long k = in.nextLong();  long t = 1;  long l = 1; if ( (k <= 9)) {System.out.print(k); System.exit(0); } long x = 9; while(true){++l; t *= 10; x += ((9 * l) * t); if ( (x >= k)) {break;} }if ( (x == k)) {System.out.print(9); System.exit(0); } x -= ((9 * l) * t); long a = ((k - x) / l); if ( (((k - x) % l) == 0)) {x = ((t + a) - 1); System.out.print((x % 10)); } else {k -= (x + (a * l)); x = (t + a); String s = Long.toString(x); System.out.print(s.charAt(((int)k - 1))); }} }
2	@SuppressWarnings("unused") public class round169D{ static PrintWriter out = new PrintWriter(System.out); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer st = new StringTokenizer(""); static String next()throws Exception { while(true){if ( st.hasMoreTokens()) {return st.nextToken();} String s = br.readLine(); if ( (s == null)) {return null;} st = new StringTokenizer(s); }} public static void main( String[] args)throws Exception { long l = parseLong(next());  long r = parseLong(next());  long[] min = new long[61]; for ( int i = 1;(i <= 60);++i) {min[i] = ((long)pow(2,(i - 1)) - 1); }for ( int i = 60;(i >= 0);--i) {if ( (min[i] >= r)) continue; if ( ((min[i] >= l) && ((min[i] + 1) <= r))) {out.println(((long)pow(2,i) - 1)); out.flush(); return ;} if ( (min[i] < l)) { long one_jump = (long)pow(2,i);  long jumps = (long)ceil(((l - min[i]) / (one_jump * 1.0)));  long cur = (min[i] + (jumps * one_jump)); if ( ((cur >= l) && ((cur + 1) <= r))) {out.println(((long)pow(2,i) - 1)); out.flush(); return ;} } }out.println(0); out.flush(); } }
0	public class maximus{ static long GCD( long a, long b){ if ( (b == 0)) return a; return GCD(b,(a % b));} public static void main( String[] args){ Scanner in = new Scanner(System.in);  long n = in.nextInt(); if ( (n <= 2)) {System.out.print(n); return ;} if ( ((n % 2) == 1)) {System.out.print(((n * (n - 1)) * (n - 2))); return ;} if ( (((n % 2) == 0) && (n <= 6))) {System.out.print((((n * (n - 1)) * (n - 2)) / 2)); return ;} long temp = (((n * (n - 1)) * (n - 3)) / GCD(n,(n - 3))); System.out.print(Math.max((((n - 1) * (n - 2)) * (n - 3)),temp)); } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  QuickScanner in = new QuickScanner(inputStream);  QuickWriter out = new QuickWriter(outputStream);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ static boolean LOCAL = false; static int TEST_CASE = 10000; QuickScanner in ; QuickWriter out ; int n ; Server server ; public void solve( int testNumber, QuickScanner in, QuickWriter out){ this.in = in; this.out = out; n = (LOCAL?(1 << 16):in.nextInt()); server = new Server(); for ( int remCases = (LOCAL?TEST_CASE:1);(remCases > 0);--remCases) {server.init(n); Rect[] rects = split(0); if ( (rects == null)) {rects = split(1); } rects[0] = shrink(rects[0]); rects[1] = shrink(rects[1]); server.answer(rects[0],rects[1]); }} Rect[] split( int dim){ int lower = 1,upper = (n - 1),res = 0;  Rect fullRect = new Rect(1,1,n,n); while((lower <= upper)){ int medium = ((lower + upper) >> 1); if ( (server.ask(fullRect.update(1,dim,medium)) == 0)) {res = medium; lower = (medium + 1); } else {upper = (medium - 1); }} Rect[] rects = new Rect[]{fullRect.update(1,dim,(res + 1)),fullRect.update(0,dim,(res + 2))}; return (((server.ask(rects[0]) == 1) && (server.ask(rects[1]) == 1))?rects:null);} Rect shrink( Rect rect){ rect = shrink(rect,0); rect = shrink(rect,1); return rect;} Rect shrink( Rect rect, int dim){ int lower ,upper ,res ; lower = (rect.getValue(0,dim) + 1); upper = rect.getValue(1,dim); res = (lower - 1); while((lower <= upper)){ int medium = ((lower + upper) >> 1); if ( (server.ask(rect.update(0,dim,medium)) == 1)) {res = medium; lower = (medium + 1); } else {upper = (medium - 1); }}rect = rect.update(0,dim,res); lower = rect.getValue(0,dim); upper = (rect.getValue(1,dim) - 1); res = (upper + 1); while((lower <= upper)){ int medium = ((lower + upper) >> 1); if ( (server.ask(rect.update(1,dim,medium)) == 1)) {res = medium; upper = (medium - 1); } else {lower = (medium + 1); }}return rect.update(1,dim,res);} class Server{ Rect rect1 ; Rect rect2 ; Server(){ rect1 = new Rect(); rect2 = new Rect(); } void init( int n){ if ( LOCAL) {do {rect1.initRandom(n); rect2.initRandom(n); }while(!rect1.valid(rect2));} } int ask( Rect rect){ out.print("? "); rect.print(); out.println(); out.flush(); if ( LOCAL) {return ((rect1.in(rect)?1:0) + (rect2.in(rect)?1:0));} else {return in.nextInt();}} void answer( Rect rect1, Rect rect2){ out.print("! "); rect1.print(); out.print(' '); rect2.print(); out.println(); out.flush(); if ( LOCAL) {if ( ((rect1.equals(this.rect1) && rect2.equals(this.rect2)) || (rect2.equals(this.rect1) && rect1.equals(this.rect2)))) {System.out.println("AC!"); } else {System.out.println("WA!"); throw (new IllegalArgumentException());}} } } class Rect{ final Random random = new Random(); int x1 ; int y1 ; int x2 ; int y2 ; Rect(){ } Rect( int x1, int y1, int x2, int y2){ this.x1 = x1; this.y1 = y1; this.x2 = x2; this.y2 = y2; } void initRandom( int n){ x1 = random.nextInt(n); x2 = ((random.nextInt((n - x1)) + x1) + 1); ++x1; y1 = random.nextInt(n); y2 = ((random.nextInt((n - y1)) + y1) + 1); ++y1; } int getValue( int idx1, int idx2){ switch(((idx1 << 1) | idx2)){ case 0:return x1; case 1:return y1; case 2:return x2; case 3:return y2; } throw (new IllegalArgumentException());} Rect update( int idx1, int idx2, int value){ switch(((idx1 << 1) | idx2)){ case 0:return new Rect(value,y1,x2,y2); case 1:return new Rect(x1,value,x2,y2); case 2:return new Rect(x1,y1,value,y2); case 3:return new Rect(x1,y1,x2,value); } return null;} boolean valid( Rect o){ if ( (x2 < o.x1)) return true; if ( (y2 < o.y1)) return true; if ( (o.x2 < x1)) return true; if ( (o.y2 < y1)) return true; return false;} boolean in( Rect o){ return ((((o.x1 <= x1) && (x2 <= o.x2)) && (o.y1 <= y1)) && (y2 <= o.y2));} boolean equals( Rect o){ return ((((x1 == o.x1) && (y1 == o.y1)) && (x2 == o.x2)) && (y2 == o.y2));} void print(){ out.printf("%d %d %d %d",x1,y1,x2,y2); } } } static class QuickScanner{ static private final int BUFFER_SIZE = 1024; private InputStream stream ; private byte[] buffer ; private int currentPostion ; private int numberOfChars ; public QuickScanner( InputStream stream){ this.stream = stream; this.buffer = new byte[BUFFER_SIZE]; this.currentPostion = 0; this.numberOfChars = 0; } public int nextInt(){ int c = nextNonSpaceChar();  boolean positive = true; if ( (c == '-')) {positive = false; c = nextChar(); } int res = 0; do {if ( ((c < '0') || ('9' < c))) throw (new RuntimeException()); res = (((res * 10) + c) - '0'); c = nextChar(); }while(!isSpaceChar(c));return (positive?res:-res);} public int nextNonSpaceChar(){ int res = nextChar(); for ( ;(isSpaceChar(res) || (res < 0));res = nextChar()) ;return res;} public int nextChar(){ if ( (numberOfChars == -1)) {throw (new RuntimeException());} if ( (currentPostion >= numberOfChars)) {currentPostion = 0; try{numberOfChars = stream.read(buffer); }catch (Exception e){ throw (new RuntimeException(e));} if ( (numberOfChars <= 0)) {return -1;} } return buffer[currentPostion++];} public boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c < 0));} } static class QuickWriter{ private final PrintWriter writer ; public QuickWriter( OutputStream outputStream){ this.writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public QuickWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);++i) {if ( (i > 0)) {writer.print(' '); } writer.print(objects[i]); }} public void println( Object... objects){ print(objects); writer.print('\n'); } public void printf( String format, Object... objects){ writer.printf(format,objects); } public void close(){ writer.close(); } public void flush(){ writer.flush(); } } }
0	public class A{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer tb ;  int n = Integer.parseInt(br.readLine());  int x = 0,y = 0; if ( ((n % 2) == 0)) {x = (n - 4); y = 4; } else {x = (n - 9); y = 9; }System.out.println(((x + " ") + y)); } }
0	public class A{ public static void main( String[] args)throws IOException { try(BufferedReader reader=new BufferedReader(new InputStreamReader(System.in))){ String input ; while((((input = reader.readLine()) != null) && (input.length() > 0))){ int n = Integer.parseInt(input);  int start = 4;  int end = (n - start); while((start <= end)){if ( ((((start % 2) == 0) || ((start % 3) == 0)) && (((end % 2) == 0) || ((end % 3) == 0)))) {System.out.println(((start + " ") + end)); break;} ++start; --end; }} }} }
0	public class N72A{ StreamTokenizer in ; PrintWriter out ; int nextInt()throws IOException { in.nextToken(); return (int)in.nval;} public void init()throws Exception { boolean oj = (System.getProperty("ONLINE_JUDGE") != null);  Reader reader = (oj?new InputStreamReader(System.in):new FileReader(new File("input.txt")));  Writer writer = (oj?new OutputStreamWriter(System.out):new FileWriter(new File("output.txt"))); in = new StreamTokenizer(reader); out = new PrintWriter(writer); } public void solve()throws Exception { int n = nextInt(); out.print(((2 * n) - (n / 2))); } public void print()throws Exception { out.flush(); } public void run()throws Exception { init(); solve(); print(); } public static void main( String[] args)throws Exception { new N72A().run(); } }
6	public class C{ public static double Epsilon = 1e-6; public static long x ,y ,d ; public static long MOD = 1000000007; public static int[][][] dp ; public static int min ,max ,need ; public static void main( String[] args){ Scanner in = new Scanner();  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt();  int m = in.nextInt(); min = Math.min(n,m); max = ((m + n) - min); dp = new int[max][(1 << min)][(1 << min)]; for ( int[][] temp :dp) {for ( int[] val :temp) {Arrays.fill(val,-1); }}need = ((1 << min) - 1); out.println(cal(0,0,0)); out.close(); } public static int cal( int index, int last, int lastHold){ if ( (index == max)) {return 0;} if ( (dp[index][lastHold][last] != -1)) {return dp[index][lastHold][last];} int result = 0; for ( int i = 0;(i < (1 << min));i++) {if ( (((i | last) == need) || (index == 0))) {if ( (((index + 1) == max) && (match(i,lastHold) != need))) {continue;} int temp = (cal((index + 1),match(i,lastHold),i) + (min - Integer.bitCount(i))); result = ((result < temp)?temp:result); } }dp[index][lastHold][last] = result; return result;} public static int match( int mask, int last){ int result = last; for ( int i = 0;(i < min);i++) {if ( (((1 << i) & mask) != 0)) { int a = (i - 1);  int b = (i + 1); result |= (1 << i); if ( (a >= 0)) {result |= (1 << a); } if ( (b < min)) {result |= (1 << b); } } }return result;} public static long pow( long a, long b){ if ( (b == 0)) {return 1;} long val = pow(a,(b / 2)); if ( ((b % 2) == 0)) {return ((val * val) % MOD);} else {return ((a * ((val * val) % MOD)) % MOD);}} public static void extendEuclid( long a, long b){ if ( (b == 0)) {x = 1; y = 0; d = a; return ;} extendEuclid(b,(a % b)); long x1 = y;  long y1 = (x - ((a / b) * y)); x = x1; y = y1; } public static long gcd( long a, long b){ if ( (b == 0)) {return a;} return gcd(b,(a % b));} static class Line{ double a ,b ,c ; Line( double x1, double y1, double x2, double y2){ if ( ((Math.abs((x1 - x2)) < Epsilon) && (Math.abs((y1 - y2)) < Epsilon))) {throw (new RuntimeException("Two point are the same"));} a = (y1 - y2); b = (x2 - x1); c = ((-a * x1) - (b * y1)); } Line( Point x, Point y){ this(x.x,x.y,y.x,y.y); } public Point intersect( Line l){ double d = ((a * l.b) - (b * l.a)); if ( (d == 0)) {throw (new RuntimeException("Two lines are parallel"));} return new Point((((l.c * b) - (c * l.b)) / d),(((l.a * c) - (l.c * a)) / d));} } static Point intersect( Point a, Point b, Point c){ double D = cross(a,b); if ( (D != 0)) {return new Point((cross(c,b) / D),(cross(a,c) / D));} return null;} static Point minus( Point a, Point b){ return new Point((a.x - b.x),(a.y - b.y));} static Point add( Point a, Point b){ return new Point((a.x + b.x),(a.y + b.y));} static double cross( Point a, Point b){ return ((a.x * b.y) - (a.y * b.x));} static class Point{ double x ,y ; Point( double x, double y){ this.x = x; this.y = y; } } static class Scanner{ BufferedReader br ; StringTokenizer st ; public Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ throw (new RuntimeException());} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
3	public class PC1229{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int r = sc.nextInt();  int[] x = new int[n]; for ( int i = 0;(i < n);i++) {x[i] = sc.nextInt(); } double[] ans = new double[n]; for ( int i = 0;(i < n);i++) { double maxY = r; for ( int j = 0;(j < i);j++) {if ( ((x[j] <= (x[i] + (2 * r))) && (x[j] >= (x[i] - (2 * r))))) {maxY = Math.max(maxY,(ans[j] + Math.sqrt((((4 * r) * r) - (Math.abs((x[i] - x[j])) * Math.abs((x[i] - x[j]))))))); } }ans[i] = maxY; }for ( int i = 0;(i < n);i++) {System.out.println(ans[i]); }sc.close(); } }
0	public class Main{ static private BufferedReader in ; static private BufferedWriter out ; public static void main( String[] args)throws NumberFormatException,IOException { boolean file = false; if ( file) in = new BufferedReader(new FileReader("input.txt")); else in = new BufferedReader(new InputStreamReader(System.in)); out = new BufferedWriter(new FileWriter("output.txt")); StringTokenizer tok ;  int n = Integer.parseInt(in.readLine()); if ( ((n % 2) == 0)) System.out.println(((4 + " ") + (n - 4))); else System.out.println(((9 + " ") + (n - 9))); } }
6	public class Main{ static double arr[][] ; public static void main( String[] args){ try{ Parserdoubt pd = new Parserdoubt(System.in);  PrintWriter pw = new PrintWriter(System.out);  int fishes = pd.nextInt(); arr = new double[fishes][fishes]; for ( int i = 0;(i < fishes);i++) for ( int j = 0;(j < fishes);j++) arr[i][j] = Double.parseDouble(pd.nextString()); double dp[] = new double[(1 << fishes)]; dp[(dp.length - 1)] = 1.0; for ( int c = (dp.length - 1);(c >= 0);c--) { int count = Integer.bitCount(c); if ( (count <= 1)) continue; for ( int i = 0;(i < fishes);i++) for ( int j = (i + 1);(j < fishes);j++) {if ( ((((1 << i) & c) != 0) && (((1 << j) & c) != 0))) {dp[(c & (1 << j))] += (arr[i][j] * dp[c]); dp[(c & (1 << i))] += (arr[j][i] * dp[c]); } }} double s = 0.0; for ( int i = 0;(i < fishes);i++) s += dp[(1 << i)]; for ( int i = 0;(i < fishes);i++) dp[(1 << i)] /= s; int i = 0; for ( i = 0;(i < (fishes - 1));i++) pw.printf("%.6f ",dp[(1 << i)]); pw.printf("%.6f\n",dp[(1 << i)]); pw.close(); }catch (Exception e){ } } } class Parserdoubt{ private final int BUFFER_SIZE = (1 << 17); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ,bytesRead ; public Parserdoubt( InputStream in){ din = new DataInputStream(in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String nextString()throws Exception { StringBuffer sb = new StringBuffer("");  byte c = read(); while((c <= ' '))c = read(); do {sb.append((char)c); c = read(); }while((c > ' '));return sb.toString();} public int nextInt()throws Exception { int ret = 0;  byte c = read(); while((c <= ' '))c = read(); boolean neg = (c == '-'); if ( neg) c = read(); do {ret = (((ret * 10) + c) - '0'); c = read(); }while((c > ' '));if ( neg) return -ret; return ret;} private void fillBuffer()throws Exception { bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) buffer[0] = -1; } private byte read()throws Exception { if ( (bufferPointer == bytesRead)) fillBuffer(); return buffer[bufferPointer++];} }
6	public class Main{ public static void main( String[] args){ new Main().run(); } FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ int t = in.nextInt(); for ( int i = 0;(i < t);i++) {out.println(work()); }out.flush(); } long mod = 1000000007; long gcd( long a, long b){ return ((b == 0)?a:gcd(b,(a % b)));} int work(){ int n = in.nextInt();  int m = in.nextInt();  int[][] A = new int[n][m];  int[][] B = new int[n][m];  int[][] R = new int[m][2]; for ( int i = 0;(i < m);i++) R[i][1] = i; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {A[i][j] = in.nextInt(); R[j][0] = Math.max(R[j][0],A[i][j]); }}Arrays.sort(R,new Comparator<int[]>(){}); for ( int j = 0;(j < m);j++) { int index = R[j][1]; for ( int i = 0;(i < n);i++) {B[i][j] = A[i][index]; }}m = Math.min(n,m); int[][] dp = new int[m][(1 << n)];  int[][] rec = new int[m][(1 << n)]; for ( int j = 0;(j < m);j++) {for ( int s = 0;(s < n);s++) {for ( int i = 1;(i < (1 << n));i++) { int sum = 0; for ( int b = 0;(b < n);b++) {if ( (((1 << b) & i) > 0)) {sum += B[((b + s) % n)][j]; } }rec[j][i] = Math.max(sum,rec[j][i]); }}}for ( int j = 0;(j < m);j++) {for ( int i = 0;(i < (1 << n));i++) {if ( (j == 0)) {dp[j][i] = rec[j][i]; } else {for ( int p = i;(p < (1 << n));p++) {p = (p | i); dp[j][p] = Math.max(dp[j][p],(rec[j][i] + dp[(j - 1)][(p ^ i)])); }}}}return dp[(m - 1)][((1 << n) - 1)];} } class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ if ( ((st == null) || !st.hasMoreElements())) {try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } } return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} }
2	public class _____A implements Runnable{ final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null); BufferedReader in ; OutputWriter out ; StringTokenizer tok = new StringTokenizer(""); public static void main( String[] args){ new Thread(null,new _____A(),"",(128 * (1L << 20))).start(); } void init()throws FileNotFoundException { Locale.setDefault(Locale.US); if ( ONLINE_JUDGE) {in = new BufferedReader(new InputStreamReader(System.in)); out = new OutputWriter(System.out); } else {in = new BufferedReader(new FileReader("input.txt")); out = new OutputWriter("output.txt"); }} long timeBegin ,timeEnd ; void time(){ timeEnd = System.currentTimeMillis(); System.err.println(("Time = " + (timeEnd - timeBegin))); } String delim = " "; String readString()throws IOException { while(!tok.hasMoreTokens()){try{tok = new StringTokenizer(in.readLine()); }catch (Exception e){ return null;} }return tok.nextToken(delim);} String readLine()throws IOException { return in.readLine();} final char NOT_A_SYMBOL = '\0'; int readInt()throws IOException { return Integer.parseInt(readString());} long readLong()throws IOException { return Long.parseLong(readString());} double readDouble()throws IOException { return Double.parseDouble(readString());} Point readPoint()throws IOException { int x = readInt();  int y = readInt(); return new Point(x,y);} class OutputWriter extends PrintWriter{ final int DEFAULT_PRECISION = 12; int precision ; String format ,formatWithSpace ; {precision = DEFAULT_PRECISION; format = createFormat(precision); formatWithSpace = (format + " "); }public OutputWriter( OutputStream out){ super(out); } public OutputWriter( String fileName)throws FileNotFoundException{ super(fileName); } private String createFormat( int precision){ return (("%." + precision) + "f");} @Override public void print( double d){ printf(format,d); } public void printWithSpace( double d){ printf(formatWithSpace,d); } public void printAll( double... d){ for ( int i = 0;(i < (d.length - 1));++i) {printWithSpace(d[i]); }print(d[(d.length - 1)]); } @Override public void println( double d){ printlnAll(d); } public void printlnAll( double... d){ printAll(d); println(); } } int[][] steps = {{-1,0},{1,0},{0,-1},{0,1}}; int[][] steps8 = {{-1,0},{1,0},{0,-1},{0,1},{-1,-1},{1,1},{1,-1},{-1,1}}; long md = (((1000 * 1000) * 1000) + 9); void solve()throws IOException { int n = readInt();  int m = readInt();  int k = readInt();  long count = (n / k);  long mod = (n % k);  long maxM = ((count * (k - 1)) + mod); if ( (maxM >= m)) {out.println((m % md)); return ;} long d = (m - maxM);  long mul = (((((binpow(2,d) - 1) + md) % md) * 2) % md);  long ans = ((mul * k) % md); ans = (((ans + (((((count - d) * (k - 1)) % md) + md) % md)) + mod) % md); out.println(ans); } long binpow( long a, long n){ if ( (n == 0)) return 1; if ( ((n & 1) == 0)) { long b = binpow(a,(n >> 1)); return ((b * b) % md);} else {return ((binpow(a,(n - 1)) * a) % md);}} }
2	public class B713{ public static BufferedReader f ; public static PrintWriter out ; public static void main( String[] args)throws IOException { f = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); int n = Integer.parseInt(f.readLine());  int l ;  int r ;  int mid ;  int ans ; l = 1; r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); if ( (mid == n)) break; int il = query(1,1,n,mid);  int ir = query(1,(mid + 1),n,n); if ( ((il == 1) && (ir == 1))) {ans = mid; break;} if ( (il > ir)) {r = (mid - 1); } else {l = (mid + 1); }} int x11 = -1;  int y11 = -1;  int x12 = -1;  int y12 = -1;  int x21 = -1;  int y21 = -1;  int x22 = -1;  int y22 = -1; if ( (ans == -1)) {l = 1; r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int il = query(1,1,mid,n);  int ir = query((mid + 1),1,n,n); if ( ((il == 1) && (ir == 1))) {ans = mid; break;} if ( (il > ir)) {r = (mid - 1); } else {l = (mid + 1); }} int bar = ans; l = 1; r = bar; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(mid,1,bar,n); if ( (i == 1)) {ans = mid; l = (mid + 1); } else {r = (mid - 1); }}x11 = ans; l = 1; r = bar; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(1,1,mid,n); if ( (i == 1)) {ans = mid; r = (mid - 1); } else {l = (mid + 1); }}x12 = ans; l = 1; r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(1,mid,bar,n); if ( (i == 1)) {ans = mid; l = (mid + 1); } else {r = (mid - 1); }}y11 = ans; l = 1; r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(1,1,bar,mid); if ( (i == 1)) {ans = mid; r = (mid - 1); } else {l = (mid + 1); }}y12 = ans; l = (bar + 1); r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(mid,1,n,n); if ( (i == 1)) {ans = mid; l = (mid + 1); } else {r = (mid - 1); }}x21 = ans; l = (bar + 1); r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query((bar + 1),1,mid,n); if ( (i == 1)) {ans = mid; r = (mid - 1); } else {l = (mid + 1); }}x22 = ans; l = 1; r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query((bar + 1),mid,n,n); if ( (i == 1)) {ans = mid; l = (mid + 1); } else {r = (mid - 1); }}y21 = ans; l = 1; r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query((bar + 1),1,n,mid); if ( (i == 1)) {ans = mid; r = (mid - 1); } else {l = (mid + 1); }}y22 = ans; } else { int bar = ans; l = 1; r = bar; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(1,mid,n,bar); if ( (i == 1)) {ans = mid; l = (mid + 1); } else {r = (mid - 1); }}y11 = ans; l = 1; r = bar; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(1,1,n,mid); if ( (i == 1)) {ans = mid; r = (mid - 1); } else {l = (mid + 1); }}y12 = ans; l = 1; r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(mid,1,n,bar); if ( (i == 1)) {ans = mid; l = (mid + 1); } else {r = (mid - 1); }}x11 = ans; l = 1; r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(1,1,mid,bar); if ( (i == 1)) {ans = mid; r = (mid - 1); } else {l = (mid + 1); }}x12 = ans; l = (bar + 1); r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(1,mid,n,n); if ( (i == 1)) {ans = mid; l = (mid + 1); } else {r = (mid - 1); }}y21 = ans; l = (bar + 1); r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(1,(bar + 1),n,mid); if ( (i == 1)) {ans = mid; r = (mid - 1); } else {l = (mid + 1); }}y22 = ans; l = 1; r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(mid,(bar + 1),n,n); if ( (i == 1)) {ans = mid; l = (mid + 1); } else {r = (mid - 1); }}x21 = ans; l = 1; r = n; ans = -1; while((l <= r)){mid = (l + ((r - l) / 2)); int i = query(1,(bar + 1),mid,n); if ( (i == 1)) {ans = mid; r = (mid - 1); } else {l = (mid + 1); }}x22 = ans; }out.println(((((((((((((((("! " + x11) + " ") + y11) + " ") + x12) + " ") + y12) + " ") + x21) + " ") + y21) + " ") + x22) + " ") + y22)); out.close(); } public static int query( int a, int b, int c, int d)throws IOException { out.println(((((((("? " + a) + " ") + b) + " ") + c) + " ") + d)); out.flush(); return Integer.parseInt(f.readLine());} }
2	public class Solution{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long itrIdx = 0;  long itr = 0;  long num = 0; while((itrIdx < n)){itrIdx += ((itr + 1) * (Math.pow(10,(itr + 1)) - Math.pow(10,itr))); num += (Math.pow(10,(itr + 1)) - Math.pow(10,itr)); itr++; }itrIdx -= (itr * (Math.pow(10,itr) - Math.pow(10,(itr - 1)))); num -= (Math.pow(10,itr) - Math.pow(10,(itr - 1))); long lastNum = (num + ((n - itrIdx) / itr));  long lastNumIndex = (itrIdx + (itr * (lastNum - num))); if ( (lastNumIndex == n)) {lastNumIndex = (lastNumIndex - itr); lastNum -= 1; } String nextNum = String.valueOf(lastNum += 1); System.out.println(nextNum.charAt((int)((n - lastNumIndex) - 1))); } }
0	public class Test{ static PrintWriter pw = new PrintWriter(System.out); public static void main( String[] args)throws Exception { Reader.init(System.in); int n = Reader.nextInt();  int p = Reader.nextInt();  int L = Reader.nextInt();  int R = Reader.nextInt();  int a = 1;  int b = n;  int res = 0; if ( ((a == L) && (b == R))) {res = 0; } else if ( ((((L != a) && (R != b)) && (p >= L)) && (p <= R))) {res = Math.min((p - L),(R - p)); res += ((R - L) + 2); } else if ( (((L != a) && (R != b)) && (p < L))) {res += ((L - p) + 1); res += ((R - L) + 1); } else if ( (((L != a) && (R != b)) && (p > R))) {res += ((p - R) + 1); res += ((R - L) + 1); } else if ( (((a == L) && (p >= L)) && (p <= R))) {res += ((R - p) + 1); } else if ( (((R == b) && (p >= L)) && (p <= R))) {res += ((p - L) + 1); } else if ( ((a == L) && (p > R))) {res += ((p - R) + 1); } else if ( ((R == b) && (p < L))) {res += ((L - p) + 1); } pw.print(res); pw.close(); } }
2	public class A{ static StringTokenizer st ; static BufferedReader in ; static PrintWriter pw ; public static void main( String[] args)throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int n = nextInt();  int m = nextInt();  int k = nextInt();  long t = ((long)(n - m) * k);  int mod = (int)(1e9 + 9);  long ans = 0;  int x = (m / (k - 1)); if ( ((m % (k - 1)) != 0)) x++; if ( ((n - m) < (x - 1))) { int s = (int)(n - t);  int cnt = (s / k); ans = BigInteger.valueOf(2).modPow(BigInteger.valueOf((cnt + 1)),BigInteger.valueOf(mod)).longValue(); ans = (((ans - 2) + mod) % mod); ans = ((ans * k) % mod); ans = ((ans + (((long)(k - 1) * (n - m)) % mod)) % mod); ans = ((ans + (s % k)) % mod); } else ans = m; System.out.println(ans); pw.close(); } static private int nextInt()throws IOException { return Integer.parseInt(next());} static private String next()throws IOException { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(in.readLine()); }return st.nextToken();} }
0	public class A{ public static void main( String[] args){ Kattio io = new Kattio(System.in);  int n = io.getInt();  int ans = 0;  int V = n;  int A = n; A -= (n / 2); ans += (n / 2); V -= A; ans += A; A -= (n / 2); ans += (n / 2); io.println(ans); io.flush(); } } class Kattio extends PrintWriter{ public Kattio( InputStream i){ super(new BufferedOutputStream(System.out)); r = new BufferedReader(new InputStreamReader(i)); } public Kattio( InputStream i, OutputStream o){ super(new BufferedOutputStream(o)); r = new BufferedReader(new InputStreamReader(i)); } public boolean hasMoreTokens(){ return (peekToken() != null);} public int getInt(){ return Integer.parseInt(nextToken());} private BufferedReader r ; private String line ; private StringTokenizer st ; private String token ; private String peekToken(){ if ( (token == null)) try{while(((st == null) || !st.hasMoreTokens())){line = r.readLine(); if ( (line == null)) return null; st = new StringTokenizer(line); }token = st.nextToken(); }catch (IOException e){ } return token;} private String nextToken(){ String ans = peekToken(); token = null; return ans;} }
4	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);  TaskE solver = new TaskE(); solver.solve(1,in,out); out.close(); } static class TaskE{ public void solve( int testNumber, FastScanner in, PrintWriter out){ int n = in.nextInt();  int MOD = in.nextInt();  int[][] C = new int[(n + 1)][(n + 1)]; C[0][0] = 1; for ( int i = 1;(i < C.length);i++) {C[i][0] = 1; for ( int j = 1;(j < C.length);j++) {C[i][j] = (C[(i - 1)][j] + C[(i - 1)][(j - 1)]); if ( (C[i][j] >= MOD)) {C[i][j] -= MOD; } }} int[] p2 = new int[(n + 1)]; p2[0] = 1; for ( int i = 1;(i < p2.length);i++) {p2[i] = ((2 * p2[(i - 1)]) % MOD); } int[][] d = new int[(n + 1)][(n + 1)]; d[0][0] = 1; for ( int i = 1;(i <= n);i++) {for ( int j = 1;(j <= i);j++) {for ( int t = 1;(t <= j);t++) {if ( (t == (i - 1))) {continue;} d[i][j] = (int)((d[i][j] + ((((long)C[j][t] * p2[(t - 1)]) % MOD) * d[((i - t) - ((i == t)?0:1))][(j - t)])) % MOD); }}} int ans = 0; for ( int k = 1;(k <= n);k++) {ans += d[n][k]; if ( (ans >= MOD)) {ans -= MOD; } }out.println(ans); } } static class FastScanner{ private BufferedReader in ; private StringTokenizer st ; public FastScanner( InputStream stream){ in = new BufferedReader(new InputStreamReader(stream)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,dd ,bb ; int[] uu ,vv ,uv ,cost ,cost_ ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; dd = new int[n_]; bb = new int[n_]; uu = new int[m_]; vv = new int[m_]; uv = new int[m_]; cost = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; uv[h] = (u ^ v); cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } boolean dijkstra( int s, int t){ Arrays.fill(pi,INF); pi[s] = 0; TreeSet<Integer> pq = new TreeSet<>((u,v)->((pi[u] != pi[v])?(pi[u] - pi[v]):((dd[u] != dd[v])?(dd[u] - dd[v]):(u - v)))); pq.add(s); Integer first ; while(((first = pq.pollFirst()) != null)){ int u = first;  int d = (dd[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost_[h]:-cost_[h]));  int v = (u ^ uv[h]); if ( ((pi[v] > p) || ((pi[v] == p) && (dd[v] > d)))) {if ( (pi[v] != INF)) pq.remove(v); pi[v] = p; dd[v] = d; bb[v] = h_; pq.add(v); } } }return (pi[t] != INF);} void push1( int s, int t){ for ( int u = t,h_ ,h ;(u != s);u ^= uv[h]) {h = ((h_ = bb[u]) >> 1); cc[h_]--; cc[(h_ ^ 1)]++; }} int edmonds_karp( int s, int t){ cost_ = Arrays.copyOf(cost,m_); while(dijkstra(s,t)){push1(s,t); for ( int h = 0;(h < m_);h++) { int u = uu[h],v = vv[h]; if ( ((pi[u] != INF) && (pi[v] != INF))) cost_[h] += (pi[u] - pi[v]); }} int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
0	public class C236{ public static void main( String[] args){ new C236().run(); } void run(){ InputScanner scanner = new InputScanner(System.in);  PrintStream printer = new PrintStream(System.out);  int n = scanner.nextInt();  long answer ; if ( (n == 1)) {answer = 1; } else if ( (n == 2)) {answer = 2; } else {if ( ((n & 1) != 0)) {answer = (((long)n * (long)(n - 1)) * (long)(n - 2)); } else {if ( ((n % 3) == 0)) {answer = (((long)(n - 1) * (long)(n - 2)) * (long)(n - 3)); } else {answer = (((long)n * (long)(n - 1)) * (long)(n - 3)); }}}printer.println(answer); } class InputScanner{ BufferedInputStream bis ; byte[] buffer = new byte[1024]; int currentChar ; int charCount ; public InputScanner( InputStream stream){ bis = new BufferedInputStream(stream); } public byte read(){ if ( (charCount == -1)) throw (new InputMismatchException()); if ( (currentChar >= charCount)) {currentChar = 0; try{charCount = bis.read(buffer); }catch (IOException e){ throw (new InputMismatchException());} if ( (charCount <= 0)) return -1; } return buffer[currentChar++];} public int nextInt(){ int c = read(); while(isSpaceChar(c)){c = read(); } int sign = 1; if ( (c == '-')) {sign = -1; c = read(); } int rep = 0; do {if ( ((c < '0') || (c > '9'))) throw (new InputMismatchException()); rep *= 10; rep += (c - '0'); c = read(); }while(!isSpaceChar(c));return (rep * sign);} public boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public void close(){ try{bis.close(); }catch (IOException e){ e.printStackTrace(); } } } }
6	public class Main implements Runnable{ final String filename = ""; public void solve()throws Exception { int n = iread(),k = iread(),A = iread();  int[] b = new int[n],l = new int[n]; for ( int i = 0;(i < n);i++) {l[i] = iread(); b[i] = iread(); } int[] c = new int[n];  double ans = 0.0; for ( int mask = 0;(mask < (1 << ((k + n) - 1)));mask++) { int t = 0; for ( int i = 0;(i < ((n + k) - 1));i++) {if ( ((mask & (1 << i)) != 0)) t++; }if ( (t != k)) continue; int x = mask; for ( int i = 0;(i < n);i++) {c[i] = b[i]; while(((x % 2) == 1)){c[i] += 10; x /= 2; }if ( (c[i] > 100)) c[i] = 100; x /= 2; } double res = 0.0; for ( int mask2 = 0;(mask2 < (1 << n));mask2++) { int m = 0;  double p = 1.0; t = 0; for ( int i = 0;(i < n);i++) {if ( ((mask2 & (1 << i)) == 0)) {t += l[i]; p *= ((100.0 - c[i]) / 100.0); } else {p *= (c[i] / 100.0); m++; }}if ( ((m * 2) > n)) res += p; else res += (((p * A) * 1.0) / (A + t)); }ans = Math.max(ans,res); } DecimalFormat df = new DecimalFormat("0.0000000"); out.write((df.format(ans) + "\n")); } public int iread()throws Exception { return Integer.parseInt(readword());} BufferedReader in ; BufferedWriter out ; public String readword()throws IOException { StringBuilder b = new StringBuilder();  int c ; c = in.read(); while(((c >= 0) && (c <= ' ')))c = in.read(); if ( (c < 0)) return ""; while((c > ' ')){b.append((char)c); c = in.read(); }return b.toString();} public static void main( String[] args){ try{Locale.setDefault(Locale.US); }catch (Exception e){ } new Thread(null,new Main(),"1",(1 << 25)).start(); } }
3	public class c{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int num = in.nextInt();  int rad = in.nextInt();  int[] start = new int[num]; for ( int i = 0;(i < num);i++) start[i] = in.nextInt(); double[] finalY = new double[num];  double hyp = (rad * 2); for ( int cur = 0;(cur < num);cur++) { double stopAt = rad; for ( int comp = 0;(comp < cur);comp++) {if ( (Math.abs((start[comp] - start[cur])) > (rad * 2))) continue; double base = Math.abs((start[comp] - start[cur]));  double ny = (Math.sqrt(((hyp * hyp) - (base * base))) + finalY[comp]); stopAt = Math.max(ny,stopAt); }finalY[cur] = stopAt; }for ( int i = 0;(i < num);i++) System.out.print((finalY[i] + " ")); System.out.println(); } }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastReader in = new FastReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ public void solve( int testNumber, FastReader in, OutputWriter out){ int n = in.nextInt();  double r = in.nextInt();  double[] x = new double[n]; for ( int i = 0;(i < n);i++) {x[i] = in.nextDouble(); } double[] ans = new double[n]; ans[0] = r; for ( int i = 1;(i < n);i++) {ans[i] = r; double maxY = 0; for ( int j = 0;(j < i);j++) {if ( (Math.abs((x[j] - x[i])) <= (2.0 * r))) { double y = (ans[j] + Math.sqrt((((4 * r) * r) - ((x[j] - x[i]) * (x[j] - x[i]))))); ans[i] = Math.max(ans[i],y); } }}for ( int i = 0;(i < n);i++) {if ( (i > 0)) out.print(" "); out.printf("%.8f",ans[i]); }} } static class FastReader{ BufferedReader reader ; StringTokenizer st ; public FastReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); st = null; } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{ String line = reader.readLine(); if ( (line == null)) {return null;} st = new StringTokenizer(line); }catch (Exception e){ throw (new RuntimeException());} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} public double nextDouble(){ return Double.parseDouble(next());} } static class OutputWriter extends PrintWriter{ public OutputWriter( OutputStream os, boolean autoFlush){ super(os,autoFlush); } public OutputWriter( Writer out){ super(out); } public OutputWriter( Writer out, boolean autoFlush){ super(out,autoFlush); } public OutputWriter( String fileName)throws FileNotFoundException{ super(fileName); } public OutputWriter( String fileName, String csn)throws FileNotFoundException,UnsupportedEncodingException{ super(fileName,csn); } public OutputWriter( File file)throws FileNotFoundException{ super(file); } public OutputWriter( File file, String csn)throws FileNotFoundException,UnsupportedEncodingException{ super(file,csn); } public OutputWriter( OutputStream out){ super(out); } public void close(){ super.close(); } } }
0	public class Main{ public static void main( String[] args)throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(in.readLine()); System.out.println(((n / 2) * 3)); } }
0	public class LuxuriousHouses{ public static void main( String[] args)throws IOException { System.out.println(25); } }
2	public class A2{ public static void main( String[] args)throws Exception { uu.s1(); uu.out.close(); } static private class MOD{ public long mod = -1; public MOD( long k1){ mod = k1; } public long cl( long n1){ long fin = (n1 % mod); if ( (fin < 0)) fin += mod; return fin;} public long s( long n1, long n2){ long k1 = ((n1 - n2) % mod); if ( (k1 < 0)) k1 += mod; return k1;} public long t( long n1, long n2){ long k1 = ((n1 * n2) % mod); if ( (k1 < 0)) k1 += mod; return k1;} public long pow( long n1, long pow){ if ( (pow == 0)) return 1; else if ( (pow == 1)) return t(1l,n1); else if ( ((pow & 1) == 0)) { long half = pow(n1,(pow >> 1)); return t(half,half);} else { long half = pow(n1,(pow >> 1)); return t(half,t(half,n1));}} } static private class BR{ BufferedReader k1 = null; StringTokenizer k2 = null; public BR(){ k1 = new BufferedReader(new InputStreamReader(System.in)); } public String nx()throws Exception { for ( ;;) {if ( ((k2 == null) || !k2.hasMoreTokens())) { String temp = k1.readLine(); if ( (temp == null)) return null; k2 = new StringTokenizer(temp); } else break;}return k2.nextToken();} public int ni()throws Exception { return Integer.parseInt(nx());} } }
2	public class D{ final int MOD = ((int)1e9 + 7); final double eps = 1e-12; final int INF = (int)1e9; public D(){ long L = sc.nextLong();  long R = sc.nextLong();  int Z = (64 - Long.numberOfLeadingZeros((L ^ R)));  long res = ((1L << Z) - 1); exit(res); } static MyScanner sc = new MyScanner(); static class MyScanner{ public String next(){ newLine(); return line[index++];} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} public double nextDouble(){ return Double.parseDouble(next());} public String[] nextStrings(){ line = null; return readLine().split(" ");} public Integer[] nextInts(){ String[] L = nextStrings();  Integer[] res = new Integer[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Integer.parseInt(L[i]); return res;} public Long[] nextLongs(){ String[] L = nextStrings();  Long[] res = new Long[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Long.parseLong(L[i]); return res;} public Double[] nextDoubles(){ String[] L = nextStrings();  Double[] res = new Double[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Double.parseDouble(L[i]); return res;} public String[] next( int N){ String[] res = new String[N]; for ( int i = 0;(i < N);++i) res[i] = sc.next(); return res;} public Integer[] nextInt( int N){ Integer[] res = new Integer[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInt(); return res;} public Long[] nextLong( int N){ Long[] res = new Long[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLong(); return res;} public Double[] nextDouble( int N){ Double[] res = new Double[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDouble(); return res;} public String[][] nextStrings( int N){ String[][] res = new String[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextStrings(); return res;} public Integer[][] nextInts( int N){ Integer[][] res = new Integer[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInts(); return res;} public Long[][] nextLongs( int N){ Long[][] res = new Long[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLongs(); return res;} public Double[][] nextDoubles( int N){ Double[][] res = new Double[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDoubles(); return res;} private boolean eol(){ return (index == line.length);} private String readLine(){ try{return r.readLine(); }catch (Exception e){ throw (new Error(e));} } private final BufferedReader r ; MyScanner(){ this(new BufferedReader(new InputStreamReader(System.in))); } MyScanner( BufferedReader r){ try{this.r = r; while(!r.ready())Thread.sleep(1); start(); }catch (Exception e){ throw (new Error(e));} } private String[] line ; private int index ; private void newLine(){ if ( ((line == null) || eol())) {line = readLine().split(" "); index = 0; } } } static void print( Object o, Object... a){ printDelim(" ",o,a); } static void printDelim( String delim, Object o, Object... a){ pw.println(build(delim,o,a)); } static void exit( Object o, Object... a){ print(o,a); exit(); } static void exit(){ pw.close(); System.out.flush(); System.err.println("------------------"); System.err.println(("Time: " + ((millis() - t) / 1000.0))); System.exit(0); } static String build( String delim, Object o, Object... a){ StringBuilder b = new StringBuilder(); append(b,o,delim); for ( Object p :a) append(b,p,delim); return b.toString().trim();} static void append( StringBuilder b, Object o, String delim){ if ( o.getClass().isArray()) { int L = Array.getLength(o); for ( int i = 0;(i < L);++i) append(b,Array.get(o,i),delim); } else if ( (o instanceof Iterable<?>)) {for ( Object p :(Iterable<?>)o) append(b,p,delim); } else b.append(delim).append(o); } public static void main( String[] args){ new D(); exit(); } static void start(){ t = millis(); } static PrintWriter pw = new PrintWriter(System.out); static long t ; static long millis(){ return System.currentTimeMillis();} }
0	public class Main{ public static void main( String[] args)throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  int num = Integer.parseInt(in.readLine()); System.out.println(((num / 2) * 3)); } }
2	public class Quiz{ public static final int MOD = 1000000009; public static void main( String[] args){ Scanner in = new Scanner(System.in);  long n = in.nextInt();  long m = in.nextInt();  long k = in.nextInt();  long low = Math.min((n - (k * (n - m))),m); if ( (low < 0)) {low = 0; } long result = 0; if ( (low >= k)) { long b = (low / k); result += fastExp(2,(b + 1)); result -= 2; if ( (result < 0)) {result += MOD; } result *= k; result %= MOD; } result += (low % k); result %= MOD; result += (m - low); result %= MOD; System.out.println(result); } public static long fastExp( int x, long pow){ if ( (pow == 0)) {return 1;} long result = fastExp(x,(pow / 2)); result *= result; result %= MOD; if ( ((pow % 2) == 1)) {result *= x; result %= MOD; } return result;} }
4	public class CF_2020_GlobalRound_E{ static boolean verb = true; static void log( Object X){ if ( verb) System.err.println(X); } static void log( Object[] X){ if ( verb) {for ( Object U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X){ if ( verb) {for ( int U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X, int L){ if ( verb) {for ( int i = 0;(i < L);i++) System.err.print((X[i] + " ")); System.err.println(""); } } static void log( long[] X){ if ( verb) {for ( long U :X) System.err.print((U + " ")); System.err.println(""); } } static InputReader reader ; static long[][] binom ; static void buildBinom( int N){ int MAX = (N + 1); binom = new long[(MAX + 1)][]; for ( int i = 0;(i < (MAX + 1));i++) binom[i] = new long[(i + 1)]; binom[0][0] = 1; for ( int i = 1;(i < MAX);i++) {binom[i][0] = 1; binom[i][i] = 1; for ( int j = 0;(j < i);j++) {binom[(i + 1)][(j + 1)] = ((binom[i][j] + binom[i][(j + 1)]) % mod); }}log("binom done"); } static long mod ; static long solve( int n){ long[] pow2 = new long[(n + 1)]; pow2[0] = 1; for ( int i = 1;(i <= n);i++) {pow2[i] = (pow2[(i - 1)] << 1); while((pow2[i] >= mod))pow2[i] -= mod; }buildBinom(n); long[][] dp = new long[(n + 1)][(n + 1)]; dp[1][1] = 1; for ( int i = 1;(i <= n);i++) {dp[i][i] = pow2[(i - 1)]; for ( int j = 1;(j < (i - 1));j++) { int me = ((i - j) - 1); for ( int cn = 1;(cn <= j);cn++) {dp[i][(cn + me)] += ((((dp[j][cn] * binom[(cn + me)][cn]) % mod) * pow2[(me - 1)]) % mod); dp[i][(cn + me)] %= mod; }}} long ans = 0; for ( int i = 0;(i <= n);i++) {ans += dp[n][i]; ans %= mod; }return ans;} public static void main( String[] args)throws Exception { log(((400 * 400) * 400)); reader = new InputReader(System.in); int n = reader.readInt(); mod = reader.readInt(); System.out.println(solve(n)); } static final class InputReader{ private final InputStream stream ; private final byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read()throws IOException { if ( (curChar >= numChars)) {curChar = 0; numChars = stream.read(buf); if ( (numChars <= 0)) {return -1;} } return buf[curChar++];} public final int readInt()throws IOException { int c = read();  boolean neg = false; while(isSpaceChar(c)){c = read(); } char d = (char)c; if ( (d == '-')) {neg = true; c = read(); } int res = 0; do {res *= 10; res += (c - '0'); c = read(); }while(!isSpaceChar(c));if ( neg) return -res; return res;} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
6	public class C{ public static void main( String[] args){ FastScanner fs = new FastScanner();  int nBoxes = fs.nextInt();  long[] sums = new long[nBoxes];  HashMap<Long,Integer> boxOf = new HashMap<>();  int[][] boxes = new int[nBoxes][];  long total = 0; for ( int i = 0;(i < nBoxes);i++) { int size = fs.nextInt(); boxes[i] = new int[size]; for ( int j = 0;(j < size);j++) {boxes[i][j] = fs.nextInt(); boxOf.put((long)boxes[i][j],i); sums[i] += boxes[i][j]; }total += sums[i]; }if ( ((total % nBoxes) != 0)) {System.out.println("No"); return ;} long target = (total / nBoxes);  int[][] masks = new int[nBoxes][];  ArrayList<Integer>[][] maskLoops = new ArrayList[nBoxes][]; for ( int i = 0;(i < nBoxes);i++) {masks[i] = new int[boxes[i].length]; maskLoops[i] = new ArrayList[boxes[i].length]; for ( int j = 0;(j < maskLoops[i].length);j++) maskLoops[i][j] = new ArrayList<>(); for ( int j = 0;(j < boxes[i].length);j++) { long startVal = boxes[i][j],lookingFor = (target - (sums[i] - startVal)); maskLoops[i][j].add((int)lookingFor); int mask = (1 << i); while((lookingFor != startVal)){if ( !boxOf.containsKey(lookingFor)) continue inner; int nextBox = boxOf.get(lookingFor); if ( ((mask & (1 << nextBox)) != 0)) continue inner; mask |= (1 << nextBox); lookingFor = (target - (sums[nextBox] - lookingFor)); maskLoops[i][j].add((int)lookingFor); }masks[i][j] = mask; }} boolean[] possible = new boolean[(1 << nBoxes)];  int[] maskFrom = new int[(1 << nBoxes)];  int[] indexToUse = new int[(1 << nBoxes)]; possible[0] = true; for ( int mask = 1;(mask < (1 << nBoxes));mask++) { int lowestBit = Integer.numberOfTrailingZeros(Integer.lowestOneBit(mask)); for ( int i = 0;(i < masks[lowestBit].length);i++) { int m = masks[lowestBit][i]; if ( (((mask & m) == m) && possible[(mask ^ m)])) {possible[mask] = true; maskFrom[mask] = (mask ^ m); indexToUse[mask] = i; break;} }}if ( !possible[((1 << nBoxes) - 1)]) {System.out.println("No"); return ;} System.out.println("Yes"); ArrayList<ArrayList<Integer>> loops = new ArrayList<>();  int mask = ((1 << nBoxes) - 1); while((mask != 0)){ int lowestBit = Integer.numberOfTrailingZeros(Integer.lowestOneBit(mask)); loops.add(maskLoops[lowestBit][indexToUse[mask]]); mask = maskFrom[mask]; } int[] takeFrom = new int[nBoxes];  int[] boxGiveTo = new int[nBoxes]; for ( ArrayList<Integer> loop :loops) {for ( int i = 0;(i < loop.size());i++) { int cur = loop.get(i),next = loop.get(((i + 1) % loop.size()));  int curBox = boxOf.get((long)cur),nextBox = boxOf.get((long)next); takeFrom[nextBox] = next; boxGiveTo[nextBox] = curBox; }}for ( int i = 0;(i < nBoxes);i++) {System.out.println(((takeFrom[i] + " ") + (boxGiveTo[i] + 1))); }} static class FastScanner{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next(){ while(!st.hasMoreElements())try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
1	public class SingleWildcard{ public static void main( String[] args){ Scanner input = new Scanner(System.in);  int a = input.nextInt();  int b = input.nextInt();  char[] s1 = new char[a]; s1 = input.next().toCharArray(); char[] s2 = new char[b]; s2 = input.next().toCharArray(); boolean condition = false; for ( int i = 0;(i < a);i++) {if ( (s1[i] == '*')) {condition = true; break;} }if ( !condition) {if ( match(s1,s2)) {System.out.println("YES"); } else System.out.println("NO"); return ;} else { int i = 0; if ( ((s1.length - 1) > s2.length)) {System.out.println("NO"); return ;} while((((i < s1.length) && (i < s2.length)) && (s1[i] == s2[i]))){i++; } int j = (s2.length - 1);  int k = (s1.length - 1); while(((((j >= 0) && (k >= 0)) && (s1[k] == s2[j])) && (i <= j))){j--; k--; }if ( ((((i == k) && (i >= 0)) && (i < s1.length)) && (s1[i] == '*'))) {System.out.println("YES"); return ;} System.out.println("NO"); }} static boolean match( char[] s1, char[] s2){ if ( (s1.length != s2.length)) return false; for ( int i = 0;(i < s1.length);i++) {if ( (s1[i] != s2[i])) return false; }return true;} }
6	public class DarkAssembly extends Thread{ public DarkAssembly(){ this.input = new BufferedReader(new InputStreamReader(System.in)); this.output = new PrintWriter(System.out); this.setPriority(Thread.MAX_PRIORITY); } static class Senator{ int loyalty ; int level ; public Senator( int level, int loyalty){ this.level = level; this.loyalty = loyalty; } } static private double doIt( Senator[] senators, int A){ double probability = .0; for ( int mask = 0;(mask < (1 << senators.length));++mask) { int sum = A;  double current = 1.0; for ( int i = 0;(i < senators.length);++i) {if ( ((mask & (1 << i)) != 0)) {current *= (.01 * senators[i].loyalty); } else {current *= (.01 * (100 - senators[i].loyalty)); sum += senators[i].level; }}if ( (Integer.bitCount(mask) > (senators.length / 2))) {probability += current; } else {probability += ((current * (double)A) / sum); }}return probability;} static private double go( Senator[] senators, int candies, int A, int current){ if ( (current == senators.length)) {return doIt(senators,A);} else { double result = go(senators,candies,A,(current + 1)); if ( ((candies > 0) && (senators[current].loyalty < 100))) {senators[current].loyalty += 10; result = Math.max(result,go(senators,(candies - 1),A,current)); senators[current].loyalty -= 10; } return result;}} private void solve()throws Throwable { int n = nextInt();  int k = nextInt();  int A = nextInt();  Senator[] senators = new Senator[n]; for ( int i = 0;(i < n);++i) {senators[i] = new Senator(nextInt(),nextInt()); }output.printf("%.10f",go(senators,k,A,0)); } public static void main( String[] args){ new DarkAssembly().start(); } private String nextToken()throws IOException { while(((tokens == null) || !tokens.hasMoreTokens())){tokens = new StringTokenizer(input.readLine()); }return tokens.nextToken();} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} private BufferedReader input ; private PrintWriter output ; private StringTokenizer tokens = null; }
6	public class Main{ public static void main( String[] args){ new Thread(null,new Runnable(){},"1",(1 << 26)).start(); } void solve(){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  ScanReader in = new ScanReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  E2RotateColumnsHardVersion solver = new E2RotateColumnsHardVersion();  int testCount = in.scanInt(); for ( int i = 1;(i <= testCount);i++) solver.solve(i,in,out); out.close(); } static class E2RotateColumnsHardVersion{ int[][] dp ; int[] cur ; public void solve( int testNumber, ScanReader in, PrintWriter out){ int n = in.scanInt();  int m = in.scanInt();  int[][] ar = new int[n][m];  int[][] max = new int[m][2]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < m);j++) ar[i][j] = in.scanInt(); for ( int i = 0;(i < m);i++) {for ( int j = 0;(j < n);j++) max[i][0] = Math.max(max[i][0],ar[j][i]); max[i][1] = i; }CodeHash.shuffle(max); Arrays.sort(max,(o1,o2)->(-o1[0] + o2[0])); dp = new int[2][(1 << n)]; cur = new int[(1 << n)]; for ( int i = 0;(i < Math.min(m,n));i++) {Arrays.fill(cur,0); Arrays.fill(dp[(i & 1)],0); for ( int j = 0;(j < (1 << n));j++) {for ( int k = 0;(k < n);k++) { int sum = 0; for ( int l = 0;(l < n);l++) {if ( ((j & (1 << l)) != 0)) {sum += ar; } }cur[j] = Math.max(cur[j],sum); }}for ( int j = 0;(j < (1 << n));j++) {for ( int k = j;;k = ((k - 1) & j)) {dp[(i & 1)][j] = Math.max(dp[(i & 1)][j],(dp[((i - 1) & 1)][k] + cur[(j ^ k)])); if ( (k == 0)) break; }}}out.println(dp[((Math.min(n,m) & 1) ^ 1)][((1 << n) - 1)]); } } static class ScanReader{ private byte[] buf = new byte[(4 * 1024)]; private int index ; private BufferedInputStream in ; private int total ; public ScanReader( InputStream inputStream){ in = new BufferedInputStream(inputStream); } private int scan(){ if ( (index >= total)) {index = 0; try{total = in.read(buf); }catch (Exception e){ e.printStackTrace(); } if ( (total <= 0)) return -1; } return buf[index++];} public int scanInt(){ int integer = 0;  int n = scan(); while(isWhiteSpace(n))n = scan(); int neg = 1; if ( (n == '-')) {neg = -1; n = scan(); } while(!isWhiteSpace(n)){if ( ((n >= '0') && (n <= '9'))) {integer *= 10; integer += (n - '0'); n = scan(); } }return (neg * integer);} private boolean isWhiteSpace( int n){ if ( (((((n == ' ') || (n == '\n')) || (n == '\r')) || (n == '\t')) || (n == -1))) return true; else return false;} } }
0	public class BetaRound72_Div2_A 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());} public static void main( String[] args){ new Thread(new BetaRound72_Div2_A()).start(); } void solve()throws IOException { int n = readInt();  int ans = ((n * 3) / 2); out.print(ans); } }
0	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long a = sc.nextLong(); if ( ((a % 4) == 0)) {System.out.println((((a / 2) + " ") + (a / 2))); } if ( ((a % 4) == 1)) {System.out.println(((9 + " ") + (a - 9))); } if ( ((a % 4) == 2)) {System.out.println(((6 + " ") + (a - 6))); } if ( (((a % 4) == 3) && (a > 15))) {System.out.println(((15 + " ") + (a - 15))); } if ( (a == 15)) {System.out.println("6 9"); } } }
6	public class DarkAssembly extends Thread{ public DarkAssembly(){ this.input = new BufferedReader(new InputStreamReader(System.in)); this.output = new PrintWriter(System.out); this.setPriority(Thread.MAX_PRIORITY); } class Senator{ int loyalty ; int level ; public Senator( int level, int loyalty){ this.level = level; this.loyalty = loyalty; } } static private double doIt( Senator[] senators, int A){ double probability = .0; for ( int mask = 0;(mask < (1 << senators.length));++mask) { int sum = A;  double current = 1.0; for ( int i = 0;(i < senators.length);++i) {if ( ((mask & (1 << i)) != 0)) {current *= (.01 * Math.min(senators[i].loyalty,100)); } else {current *= (.01 * (100 - Math.min(senators[i].loyalty,100))); sum += senators[i].level; }}if ( (getOnes(mask) > (senators.length / 2))) {probability += current; } else {probability += ((current * (double)A) / sum); }}return probability;} static private double go( Senator[] senators, int candies, int A, int current){ if ( (current == senators.length)) {return doIt(senators,A);} else { double result = Double.MIN_VALUE; if ( (candies > 0)) {senators[current].loyalty += 10; result = Math.max(result,go(senators,(candies - 1),A,current)); senators[current].loyalty -= 10; } result = Math.max(result,go(senators,candies,A,(current + 1))); return result;}} static int getOnes( int mask){ int result = 0; while((mask != 0)){mask &= (mask - 1); ++result; }return result;} public static void main( String[] args){ new DarkAssembly().start(); } private String nextToken()throws IOException { while(((tokens == null) || !tokens.hasMoreTokens())){tokens = new StringTokenizer(input.readLine()); }return tokens.nextToken();} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} private BufferedReader input ; private PrintWriter output ; private StringTokenizer tokens = null; }
2	public class Main{ public static void main( String[] argv){ new Main(); } boolean test = false; final int MOD = 998244353; public Main(){ FastReader in = new FastReader(new BufferedReader(new InputStreamReader(System.in))); final int N = 50;  long[] f = new long[N];  int maxN = 50; f[0] = 0; for ( int i = 1;(i < N);i++) {if ( ((Long.MAX_VALUE / 4) <= f[(i - 1)])) {maxN = (i - 1); break;} f[i] = ((f[(i - 1)] * 4) + 1); } long[] a = new long[N];  long[] b = new long[N];  int nt = in.nextInt(); for ( int ii = 1;(ii <= nt);ii++) { int n = in.nextInt();  long k = in.nextLong(); if ( (k == 0)) {System.out.println(("YES " + n)); continue;} if ( (((n - 1) > maxN) || (k <= (1 + f[(n - 1)])))) {System.out.println(("YES " + (n - 1))); continue;} if ( ((n - 1) == maxN)) {System.out.println(("YES " + (n - 2))); continue;} if ( (k > f[n])) {System.out.println("NO"); continue;} if ( (n == 2)) {if ( (k == 3)) System.out.println("NO"); else System.out.println("YES 0"); continue;} a[1] = 1; b[1] = f[(n - 1)]; int ret = 0; for ( int i = 2;(i <= n);i++) {a[i] = ((a[(i - 1)] + (1L << i)) - 1); b[i] = (b[(i - 1)] + (((2 * (1L << i)) - 3) * f[(n - i)])); if ( ((a[i] + b[i]) >= k)) {ret = (n - i); break;} }System.out.println(("YES " + ret)); }} private long abs( long v){ return ((v > 0)?v:-v);} private int abs( int v){ return ((v > 0)?v:-v);} private void swap( char[] a, int i, int j){ char t = a[i]; a[i] = a[j]; a[j] = t; } private int gcd( int x, int y){ if ( (y == 0)) return x; return gcd(y,(x % y));} private long gcd( long x, long y){ if ( (y == 0)) return x; return gcd(y,(x % y));} static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader( BufferedReader in){ br = in; } String next(){ while(((st == null) || !st.hasMoreElements())){try{ String line = br.readLine(); if ( ((line == null) || (line.length() == 0))) return ""; st = new StringTokenizer(line); }catch (IOException e){ return "";} }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } }
4	public class GeorgeInterestingGraph{ int N = 505; int INF = (int)1e9; List<Integer>[] G = new List[N]; int[] match = new int[N]; int[] used = new int[N]; int cur = 0; {for ( int i = 0;(i < N);i++) G[i] = new ArrayList<>(1); } void solve(){ int n = in.nextInt(),m = in.nextInt();  int[] fr = new int[m],to = new int[m]; for ( int i = 0;(i < m);i++) {fr[i] = (in.nextInt() - 1); to[i] = (in.nextInt() - 1); } int ans = INF; for ( int i = 0;(i < n);i++) { int cnt = 0; for ( int j = 0;(j < n);j++) {G[j].clear(); match[j] = -1; }for ( int j = 0;(j < m);j++) {if ( ((fr[j] == i) || (to[j] == i))) {cnt++; } else {G[fr[j]].add(to[j]); }} int other = (m - cnt);  int max = 0; for ( int j = 0;(j < n);j++) {cur++; augment(j); }for ( int j = 0;(j < n);j++) if ( (match[j] >= 0)) max++; ans = Math.min(ans,(((((((2 * (n - 1)) + 1) - cnt) + other) - max) + (n - 1)) - max)); }out.println(ans); } boolean augment( int u){ if ( (used[u] == cur)) return false; used[u] = cur; for ( int v :G[u]) {if ( ((match[v] < 0) || augment(match[v]))) {match[v] = u; return true;} }return false;} public static void main( String[] args){ in = new FastScanner(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); new GeorgeInterestingGraph().solve(); out.close(); } static FastScanner in ; static PrintWriter out ; static class FastScanner{ BufferedReader in ; StringTokenizer st ; public FastScanner( BufferedReader in){ this.in = in; } public String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} public int nextInt(){ return Integer.parseInt(nextToken());} } }
6	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);  TaskE solver = new TaskE(); solver.solve(1,in,out); out.close(); } static class TaskE{ HashMap<Integer,Integer> map = new HashMap<>(); boolean[] dp ; boolean[] vis ; boxPair[] ans ; int two( int bit){ return (1 << bit);} boolean contain( int mask, int bit){ return ((two(bit) & mask) > 0);} int get( long val){ if ( ((val > Integer.MAX_VALUE) || (val < Integer.MIN_VALUE))) return -1; int key = (int)val; if ( (map.containsKey(key) == false)) return -1; return map.get(key);} boolean rec( int mask, boolean[] hasCycle){ if ( hasCycle[mask]) return true; if ( (vis[mask] == true)) return dp[mask]; vis[mask] = true; for ( int i = (mask & (mask - 1));(i > 0);i = (mask & (i - 1))) {if ( (rec(i,hasCycle) && rec((i ^ mask),hasCycle))) {return dp[mask] = true;} }return dp[mask] = false;} void findPath( int mask, boolean[] hasCycle, ArrayList<boxPair>[] maskPath){ if ( hasCycle[mask]) {for ( boxPair b :maskPath[mask]) {ans[get(b.addTo)] = b; }return ;} for ( int i = (mask & (mask - 1));(i > 0);i = (mask & (i - 1))) {if ( (rec(i,hasCycle) && rec((i ^ mask),hasCycle))) {findPath(i,hasCycle,maskPath); findPath((i ^ mask),hasCycle,maskPath); return ;} }} public void solve( int testNumber, InputReader in, PrintWriter out){ int k = in.nextInt();  int[][] a = new int[k][];  int[] n = new int[k];  long[] sum = new long[k];  long S = 0; for ( int i = 0;(i < k);i++) {n[i] = in.nextInt(); a[i] = new int[n[i]]; for ( int j = 0;(j < n[i]);j++) {a[i][j] = in.nextInt(); sum[i] += a[i][j]; map.put(a[i][j],i); }S += sum[i]; }if ( ((S % k) != 0)) out.println("No"); else { ArrayList<boxPair>[] maskPath = new ArrayList[two(k)];  boolean[] hasCycle = new boolean[two(k)]; for ( int i = 0;(i < two(k));i++) {maskPath[i] = new ArrayList<>(); } long balance = (S / k); for ( int i = 0;(i < k);i++) {for ( int j = 0;(j < n[i]);j++) { long remove = a[i][j];  int curID = i;  int curMask = 0;  ArrayList<boxPair> curPath = new ArrayList<>(); while(true){curMask |= two(curID); remove = (balance - (sum[curID] - remove)); int nxtID = get(remove); curPath.add(new boxPair(curID,(int)remove)); if ( ((nxtID == i) && (remove == a[i][j]))) {if ( (hasCycle[curMask] == false)) {hasCycle[curMask] = true; maskPath[curMask] = curPath; } break;} if ( ((nxtID == -1) || contain(curMask,nxtID))) break; curID = nxtID; }}}vis = new boolean[two(k)]; dp = new boolean[two(k)]; if ( (rec((two(k) - 1),hasCycle) == false)) out.println("No"); else {ans = new boxPair[k]; findPath((two(k) - 1),hasCycle,maskPath); out.println("Yes"); for ( int i = 0;(i < k);i++) {out.println(((ans[i].addTo + " ") + (ans[i].boxID + 1))); }}}} class boxPair{ int boxID ; int addTo ; boxPair( int _boxID, int _addTo){ this.boxID = _boxID; this.addTo = _addTo; } } } static class InputReader{ InputStream is ; private byte[] inbuf = new byte[1024]; private int lenbuf = 0; private int ptrbuf = 0; static final int[] ints = new int[128]; public InputReader( InputStream is){ for ( int i = '0';(i <= '9');i++) ints[i] = (i - '0'); this.is = is; } public 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++];} public int nextInt(){ 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 << 3) + (num << 1)) + ints[b]); } else {return (minus?-num:num);}b = readByte(); }} } }
0	public class Main{ public static void main( String[] args)throws Exception { FastReader sc = new FastReader();  OutputStream outputStream = System.out;  PrintWriter out = new PrintWriter(outputStream);  int n = sc.nextInt();  HashMap<String,Integer> map = new HashMap<String,Integer>(); for ( int i = 0;(i < n);i++) {map.put(sc.next(),1); } ArrayList<String> list = new ArrayList<String>();  int count = 0; if ( !map.containsKey("purple")) {count++; list.add("Power"); } if ( !map.containsKey("green")) {count++; list.add("Time"); } if ( !map.containsKey("blue")) {count++; list.add("Space"); } if ( !map.containsKey("orange")) {count++; list.add("Soul"); } if ( !map.containsKey("red")) {count++; list.add("Reality"); } if ( !map.containsKey("yellow")) {count++; list.add("Mind"); } System.out.println(count); for ( String s :list) {System.out.println(s); }} } class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} }
0	public class A{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int in = sc.nextInt(); System.out.println(((in / 2) + in)); System.exit(0); } }
1	public class Main{ static private final int MAX_SIZE = 100005; public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int m = sc.nextInt();  int a = sc.nextInt();  int b = sc.nextInt(); if ( ((((m + 1) / 60) < a) || ((((m + 1) / 60) == a) && (((m + 1) % 60) <= b)))) {out(0,0); System.exit(0); } for ( int i = 2;(i <= n);i++) { int x = sc.nextInt();  int y = sc.nextInt();  int bb = ((b + (2 * m)) + 2);  int aa = (a + (bb / 60)); bb %= 60; if ( ((aa < x) || ((aa == x) && (bb <= y)))) {b = ((b + m) + 1); a = (a + (b / 60)); b %= 60; out(a,b); System.exit(0); } a = x; b = y; }b = ((b + m) + 1); a = (a + (b / 60)); b = (b % 60); out(a,b); } static private void out( int a, int b){ cout(a); cout(" "); cout(b); } static private void cout( Object a){ System.out.print(a); } }
6	public class Fish{ public static void main( String[] args){ Scanner in = new Scanner(System.in); in.useLocale(Locale.US); int n = in.nextInt();  double[] dp = new double[(1 << n)]; Arrays.fill(dp,0); dp[((1 << n) - 1)] = 1; double[][] prob = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {prob[i][j] = in.nextDouble(); }}for ( int t = ((1 << n) - 1);(t >= 0);t--) { int k = Integer.bitCount(t); for ( int i = 0;(i < n);i++) {if ( ((t & (1 << i)) > 0)) {for ( int j = 0;(j < n);j++) {if ( ((t & (1 << j)) > 0)) {if ( (i != j)) {dp[(t - (1 << j))] += ((dp[t] * prob[i][j]) / ((k * (k - 1)) / 2)); } } }} }}for ( int i = 0;(i < n);i++) {System.out.print((dp[(1 << i)] + " ")); }} }
6	public class Fish{ public static void main( String[] args)throws Exception { new Fish(); } public Fish()throws Exception{ Scanner sc = new Scanner(System.in);  int N = sc.nextInt();  double[][] P = new double[N][N]; for ( int i = 0;(i < N);i++) for ( int j = 0;(j < N);j++) P[i][j] = sc.nextDouble(); double[] best = new double[(1 << N)]; best[((1 << N) - 1)] = 1; for ( int mask = ((1 << N) - 1);(mask > 0);mask--) { int C = Integer.bitCount(mask); if ( (C == 1)) continue; for ( int i = 0;(i < N);i++) if ( on(mask,i)) for ( int j = (i + 1);(j < N);j++) if ( on(mask,j)) { int nmask = (mask & (1 << j)); best[nmask] += (((P[i][j] * best[mask]) * 2.0) / (C * (C - 1.0))); nmask = (mask & (1 << i)); best[nmask] += (((P[j][i] * best[mask]) * 2.0) / (C * (C - 1.0))); } }for ( int i = 0;(i < N);i++) System.out.printf("%.7f ",(best[(1 << i)] + 1e-9)); System.out.println(); } boolean on( int mask, int pos){ return ((mask & (1 << pos)) > 0);} }
4	public class CF1497E2 extends PrintWriter{ CF1497E2(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; byte[] bb = new byte[(1 << 15)]; int i ,n ; byte getc(){ if ( (i == n)) {i = n = 0; try{n = in.read(bb); }catch (IOException e){ } } return ((i < n)?bb[i++]:0);} int nextInt(){ byte c = 0; while((c <= ' '))c = getc(); int a = 0; while((c > ' ')){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1497E2 o = new CF1497E2(); o.main(); o.flush(); } static final int A = 10000000,K = 20; int[] cc = new int[(A + 1)]; {for ( int a = 1;(a <= A);a++) cc[a] = a; for ( int a = 2;(a <= (A / a));a++) { int s = (a * a); for ( int b = s;(b <= A);b += s) while(((cc[b] % s) == 0))cc[b] /= s; }} void main(){ int[] pp = new int[(A + 1)]; Arrays.fill(pp,-1); int t = sc.nextInt(); while((t-- > 0)){ int n = sc.nextInt();  int k = sc.nextInt();  int[] aa = new int[n]; for ( int i = 0;(i < n);i++) aa[i] = cc[sc.nextInt()]; int[] mp = new int[(k + 1)];  int[] ip = new int[(k + 1)]; for ( int i = 0;(i < n);i++) { int a = aa[i]; for ( int h = k;(h >= 0);h--) {if ( (pp[a] >= ip[h])) {mp[h]++; ip[h] = i; } if ( ((h > 0) && ((mp[(h - 1)] < mp[h]) || ((mp[(h - 1)] == mp[h]) && (ip[(h - 1)] > ip[h]))))) {mp[h] = mp[(h - 1)]; ip[h] = ip[(h - 1)]; } }pp[a] = i; }println((mp[k] + 1)); for ( int i = 0;(i < n);i++) { int a = aa[i]; pp[a] = -1; }}} }
6	public class Main{ static int senator_attr[][] ; static int senators ; static double A ; public static void main( String[] args){ try{ Parserdoubt pd = new Parserdoubt(System.in);  PrintWriter pw = new PrintWriter(System.out); senators = pd.nextInt(); int candies = pd.nextInt(); senator_attr = new int[senators][2]; A = pd.nextInt(); for ( int i = 0;(i < senators);i++) {senator_attr[i][0] = pd.nextInt(); senator_attr[i][1] = pd.nextInt(); }max = -1; make(0,candies,new int[senators]); System.out.printf("%.10f",max); }catch (Exception e){ e.printStackTrace(); } } static double max ; static int maxer[] ; public static void get( int[] a){ maxer = new int[senators]; for ( int i = 0;(i < maxer.length);i++) maxer[i] = a[i]; } public static void make( int pos, int left, int[] arr){ if ( (pos == (senators - 1))) {arr[pos] = left; double f = calc(arr); if ( (f > max)) {max = f; get(arr); } return ;} if ( (left == 0)) { double f = calc(arr); if ( (f > max)) {max = f; get(arr); } return ;} for ( int i = 0;(i <= left);i++) {arr[pos] = i; make((pos + 1),(left - i),arr); arr[pos] = 0; }} public static double calc( int[] arr){ int tmp[][] = new int[senators][2]; for ( int i = 0;(i < senators);i++) {tmp[i][0] = senator_attr[i][0]; tmp[i][1] = Math.min((senator_attr[i][1] + (arr[i] * 10)),100); }return prob(tmp);} public static void print( int[] a){ for ( int i = 0;(i < a.length);i++) System.out.print((a[i] + " ")); System.out.println(); } public static double prob( int[][] arr){ double probability = 0.0; for ( int i = 0;(i < (1 << senators));i++) {if ( (Integer.bitCount(i) > (senators / 2))) { double add = 1.0;  int tmpi = i; for ( int p = 0;(p < senators);p++) {if ( ((tmpi % 2) == 1)) {add *= (arr[p][1] / 100.0); } else {add *= ((100 - arr[p][1]) / 100.0); }tmpi /= 2; }probability += add; } else { double add = 1.0;  double B = 0;  int tmpi = i; for ( int p = 0;(p < senators);p++) {if ( ((tmpi % 2) == 1)) {add *= (arr[p][1] / 100.0); } else {add *= ((100 - arr[p][1]) / 100.0); B += arr[p][0]; }tmpi /= 2; }add *= (A / (A + B)); probability += add; }}return probability;} } class Parserdoubt{ private final int BUFFER_SIZE = (1 << 17); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ,bytesRead ; public Parserdoubt( InputStream in){ din = new DataInputStream(in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public int nextInt()throws Exception { int ret = 0;  byte c = read(); while((c <= ' '))c = read(); boolean neg = (c == '-'); if ( neg) c = read(); do {ret = (((ret * 10) + c) - '0'); c = read(); }while((c > ' '));if ( neg) return -ret; return ret;} private void fillBuffer()throws Exception { bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) buffer[0] = -1; } private byte read()throws Exception { if ( (bufferPointer == bytesRead)) fillBuffer(); return buffer[bufferPointer++];} }
2	public class _v14{ public static void main( String[] args){ PrintWriter out = new PrintWriter(System.out);  Reader in = new Reader();  long k = in.nextLong(); if ( (k < 10)) {System.out.println(k); return ;} long sum = 0;  long cur = 9;  long prev = 0;  int count = 1; while((k > cur)){k = (k - cur); sum = (sum + (cur / count)); prev = cur; cur = ((9 * (count + 1)) * (long)Math.pow(10,count)); count++; } long num = (k / count); sum = (sum + num); if ( ((k % count) == 0)) {System.out.println((sum % 10)); } else {sum++; k = (k % count); String str = String.valueOf(sum); System.out.println(str.charAt(((int)k - 1))); }out.flush(); out.close(); } static class Reader{ private InputStream mIs ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public Reader(){ this(System.in); } public Reader( InputStream is){ mIs = is; } public int read(){ if ( (numChars == -1)) {throw (new InputMismatchException());} if ( (curChar >= numChars)) {curChar = 0; try{numChars = mIs.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) {return -1;} } return buf[curChar++];} 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 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 boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} } }
3	public class C{ static long time = System.currentTimeMillis(); public static void main( String[] args)throws IOException { FastReader infile = new FastReader(System.in);  int N = infile.nextInt();  int R = infile.nextInt();  double[] xPos = new double[N]; for ( int x = 0;(x < N);x++) xPos[x] = infile.nextDouble(); double[] yPos = new double[N]; Arrays.fill(yPos,R); for ( int x = 1;(x < N);x++) {for ( int y = 0;(y < x);y++) if ( (Math.abs((xPos[x] - xPos[y])) <= (2 * R))) {yPos[x] = Math.max(yPos[x],(yPos[y] + Math.sqrt((((2 * R) * (2 * R)) - (Math.abs((xPos[x] - xPos[y])) * Math.abs((xPos[x] - xPos[y]))))))); } }System.out.print(yPos[0]); for ( int x = 1;(x < N);x++) System.out.print((" " + yPos[x])); } } class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader( String file)throws IOException{ br = new BufferedReader(new FileReader(file)); } public FastReader( InputStream i)throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} double nextDouble(){ return Double.parseDouble(next());} }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ public void solve( int testNumber, InputReader in, OutputWriter out){ int n = in.nextInt();  int r = in.nextInt();  ArrayList<PointDouble> centers = new ArrayList<>();  ArrayList<Integer> xs = new ArrayList<>(); for ( int i = 0;(i < n);++i) { int x = in.nextInt();  double y = r; for ( int j = 0;(j < centers.size());j++) { int ox = xs.get(j); if ( (Math.abs((ox - x)) > (2 * r))) continue; PointDouble c = centers.get(j);  double t = Math.abs((ox - x));  double h = Math.sqrt(Math.abs((((4.0 * r) * r) - (t * t))));  double val = (c.y + h); if ( (y < val)) y = val; }out.print(String.format("%.20f ",y)); centers.add(new PointDouble(x,y)); xs.add(x); }out.printLine(); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } } static class InputReader{ private InputStream stream ; private byte[] buffer = new byte[10000]; private int cur ; private int count ; public InputReader( InputStream stream){ this.stream = stream; } public static boolean isSpace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public int read(){ if ( (count == -1)) {throw (new InputMismatchException());} try{if ( (cur >= count)) {cur = 0; count = stream.read(buffer); if ( (count <= 0)) return -1; } }catch (IOException e){ throw (new InputMismatchException());} return buffer[cur++];} public int readSkipSpace(){ int c ; do {c = read(); }while(isSpace(c));return c;} public int nextInt(){ int sgn = 1;  int c = readSkipSpace(); if ( (c == '-')) {sgn = -1; c = read(); } int res = 0; do {if ( ((c < '0') || (c > '9'))) {throw (new InputMismatchException());} res = (((res * 10) + c) - '0'); c = read(); }while(!isSpace(c));res *= sgn; return res;} } static class PointDouble{ public double x ; public double y ; public PointDouble( double x, double y){ this.x = x; this.y = y; } public PointDouble(){ x = 0; y = 0; } } }
0	public class Ideone{ public static void main( String[] args)throws java.lang.Exception { long n ,s ,p ;  Scanner in = new Scanner(System.in); n = in.nextLong(); s = in.nextLong(); if ( ((n == 1) && (s <= 1))) {System.out.print((n - 1)); } else if ( (s < n)) {if ( ((s % 2) != 0)) {System.out.print((s / 2)); } else {System.out.print(((s / 2) - 1)); }} else if ( (s == n)) {if ( ((s % 2) == 0)) {System.out.println(((n / 2) - 1)); } else {System.out.println((n / 2)); }} else if ( (s <= ((2 * n) - 1))) {System.out.print(((((2 * n) + 1) - s) / 2)); } else {System.out.print(0); }} }
6	public class E implements Runnable{ public static void main( String[] args){ new Thread(null,new E(),"_cf",(1 << 28)).start(); } int n ,m ; char[] str ; int[][] occs ,cost ; int[] dp ; int oo = (int)1e9; int min( int a, int b){ if ( (a < b)) return a; return b;} class FastScanner{ public int BS = (1 << 16); public char NC = (char)0; byte[] buf = new byte[BS]; int bId = 0,size = 0; char c = NC; double num = 1; BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } public char nextChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ num = 1; boolean neg = false; if ( (c == NC)) c = nextChar(); for ( ;((c < '0') || (c > '9'));c = nextChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = nextChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); num *= 10; }return (neg?-res:res);} public String next(){ StringBuilder res = new StringBuilder(); while((c <= 32))c = nextChar(); while((c > 32)){res.append(c); c = nextChar(); }return res.toString();} } }
2	public class A implements Runnable{ static BufferedReader in ; static PrintWriter out ; static StringTokenizer st ; static Random rnd ; final long MODULO = 1000000009; private void solve()throws IOException { int moves = nextInt(),rightMoves = nextInt(),sequence = nextInt();  long answer = solveSmart(moves,rightMoves,sequence); out.println(answer); } private long solveSmart( long moves, long rightMoves, long sequence){ long fullSequences = (moves / sequence);  long canReset = Math.min(fullSequences,(moves - rightMoves));  long remainSequences = (fullSequences - canReset);  long answer = ((rightMoves - (remainSequences * sequence)) + getAnswerSequences(remainSequences,sequence)); answer %= MODULO; return answer;} private long getAnswerSequences( long count, long length){ long first = ((getPow(2,(count + 1)) - 2) % MODULO);  long result = (first * length); result %= MODULO; result += MODULO; result %= MODULO; return result;} private int getPow( int n, long p){ return BigInteger.valueOf(2).modPow(BigInteger.valueOf(p),BigInteger.valueOf(MODULO)).intValue();} public static void main( String[] args){ new A().run(); } public void run(){ try{in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); rnd = new Random(); solve(); out.close(); }catch (IOException e){ e.printStackTrace(); System.exit(1); } } private String nextToken()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String line = in.readLine(); if ( (line == null)) return null; st = new StringTokenizer(line); }return st.nextToken();} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
0	public class aaaaaaaaaaaaaaaa{ public void run()throws Exception { Scanner file = new Scanner(System.in);  int a = file.nextInt(),b = file.nextInt(),c = file.nextInt(),n = file.nextInt(); a -= c; b -= c; if ( ((a < 0) || (b < 0))) System.out.println(-1); else { int x = ((a + b) + c); if ( (x >= n)) System.out.println(-1); else System.out.println((n - x)); }} public static void main( String[] args)throws Exception { new aaaaaaaaaaaaaaaa().run(); } }
0	public class C72A{ static BufferedReader br ; public static void main( String[] args)throws Exception { br = new BufferedReader(new InputStreamReader(System.in)); long n = toLong();  long res = (n + (n / 2)); System.out.println(res); } public static long toLong()throws Exception { return Long.parseLong(br.readLine());} }
2	public class D{ InputStream is ; PrintWriter out ; String INPUT = ""; long I = 4000000000000000007L; void solve(){ for ( int T = ni();(T > 0);T--) { long n = nl(),K = nl();  long inf = 0;  long sup = 0; for ( int d = 1;(d <= n);d++) {inf += (pow(2,d) - 1); if ( (inf >= I)) inf = I; sup += ((pow(2,d) - 1) + mul((pow(2,(d + 1)) - 3),((pow(4,(n - d)) - 1) / 3))); if ( (sup >= I)) sup = I; if ( ((inf <= K) && (K <= sup))) {out.println(("YES " + (n - d))); continue outer;} }out.println("NO"); }} long mul( long a, long b){ if ( (((double)a * b) > I)) return I; return (a * b);} long pow( int b, long d){ long v = 1; for ( int i = 1;(i <= d);i++) {if ( (((double)v * b) > I)) return I; v = (v * b); }return v;} 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 D().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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)); } }
6	public class Fish extends Thread{ public Fish(){ this.input = new BufferedReader(new InputStreamReader(System.in)); this.output = new PrintWriter(System.out); this.setPriority(Thread.MAX_PRIORITY); } static int getOnes( int mask){ int result = 0; while((mask != 0)){mask &= (mask - 1); ++result; }return result;} private void solve()throws Throwable { int n = nextInt();  double[][] a = new double[n][n];  double[] dp = new double[(1 << n)]; for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < n);++j) {a[i][j] = nextDouble(); }} int limit = ((1 << n) - 1); dp[limit] = 1.0; for ( int mask = limit;(mask > 0);--mask) { int cardinality = getOnes(mask); if ( (cardinality < 2)) {continue;} int probability = ((cardinality * (cardinality - 1)) / 2); for ( int first = 0;(first < n);++first) {if ( ((mask & powers[first]) != 0)) {for ( int second = (first + 1);(second < n);++second) {if ( ((mask & powers[second]) != 0)) {dp[(mask - powers[first])] += ((dp[mask] * a[second][first]) / probability); dp[(mask - powers[second])] += ((dp[mask] * a[first][second]) / probability); } }} }}for ( int i = 0;(i < n);++i) {output.printf("%.10f ",dp[powers[i]]); }} public static void main( String[] args){ new Fish().start(); } private String nextToken()throws IOException { while(((tokens == null) || !tokens.hasMoreTokens())){tokens = new StringTokenizer(input.readLine()); }return tokens.nextToken();} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} private double nextDouble()throws IOException { return Double.parseDouble(nextToken());} static final int powers[] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144}; private BufferedReader input ; private PrintWriter output ; private StringTokenizer tokens = null; }
1	public class Main{ static final long mod = ((int)1e9 + 7); public static void main( String[] args)throws Exception { FastReader in = new FastReader();  PrintWriter pw = new PrintWriter(System.out);  int n = in.nextInt();  long ans = 0; for ( int i = 2;((2 * i) <= n);i++) {ans += (i * ((n / i) - 1)); }ans *= 4; pw.print(ans); pw.flush(); } } class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next()throws IOException { if ( ((st == null) || !st.hasMoreElements())) {st = new StringTokenizer(br.readLine()); } return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} }
6	public class Main{ public static void main( String[] args)throws IOException { try{if ( new File("input.txt").exists()) {System.setIn(new FileInputStream("input.txt")); } }catch (SecurityException e){ } new Main().run(); } BufferedReader in ; PrintWriter out ; StringTokenizer st = new StringTokenizer(""); void run()throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); int N = nextInt();  double[][] a = new double[N][N]; for ( int i = 0;(i < N);i++) for ( int j = 0;(j < N);j++) a[i][j] = nextDouble(); int NN = (1 << N);  double[] dp = new double[NN]; dp[(NN - 1)] = 1.0; for ( int mask = (NN - 1);(mask > 0);mask--) { int b = Integer.bitCount(mask); if ( (b <= 1)) continue; double k = (2.0 / (b * (b - 1))); for ( int i = 0;(i < N);i++) {if ( ((mask & (1 << i)) == 0)) continue; for ( int j = (i + 1);(j < N);j++) {if ( ((mask & (1 << j)) == 0)) continue; double p = a[i][j]; dp[(mask & (1 << j))] += ((k * p) * dp[mask]); dp[(mask & (1 << i))] += ((k * (1.0 - p)) * dp[mask]); }}}out.printf(Locale.US,"%.8f",dp[1]); for ( int i = 1,ind = 2;(i < N);ind <<= 1,i++) out.printf(Locale.US," %.8f",dp[ind]); out.println(); out.close(); } String nextToken()throws IOException { while(!st.hasMoreTokens()){st = new StringTokenizer(in.readLine()); }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} double nextDouble()throws IOException { return Double.parseDouble(nextToken());} }
3	public class c{ public static void main( String[] args)throws IOException { FastScanner in = new FastScanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt();  int r = in.nextInt();  int xs[] = new int[n]; for ( int i = 0;(i < n);i++) xs[i] = in.nextInt(); double ys[] = new double[n]; ys[0] = r; for ( int i = 1;(i < n);i++) { double worst = r; for ( int j = 0;(j < i);j++) {if ( (xs[i] == xs[j])) {worst = Math.max(worst,((ys[j] + r) + r)); } else if ( (((xs[i] - xs[j]) * (xs[i] - xs[j])) <= ((4 * r) * r))) { double hypot = (r + r);  double adj = Math.abs((xs[i] - xs[j]));  double theta = Math.acos((adj / hypot)); worst = Math.max(((hypot * Math.sin(theta)) + ys[j]),worst); } }ys[i] = worst; }for ( int i = 0;(i < n);i++) out.printf("%.10f ",ys[i]); out.close(); } static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream i){ br = new BufferedReader(new InputStreamReader(i)); st = null; } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} } }
2	public class B{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  Task solver = new Task(); solver.solve(1,in,out); out.close(); } static class Task{ int n = 0; int query( int p, InputReader in){ p %= n; if ( (p <= 0)) p += n; System.out.println(("? " + p)); System.out.flush(); int x = in.nextInt(); return x;} public void solve( int testNumber, InputReader in, PrintWriter out){ n = in.nextInt(); if ( ((n % 4) != 0)) {out.println("! -1"); return ;} int p = query(0,in);  int q = query((n / 2),in);  int l = 0;  int r = (n / 2); if ( (p == q)) {out.println(("! " + (n / 2))); return ;} while(((l + 1) < r)){ int mid = ((l + r) / 2);  int u = query(mid,in);  int v = query((mid + (n / 2)),in); if ( (u == v)) {out.println(("! " + (mid + (n / 2)))); return ;} if ( ((p < q) == (u < v))) {l = mid; } else {r = mid; }}} } 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());} } }
2	public class Cses{ public static void main( String[] args){ FastReader sc = new FastReader();  long n = sc.nextLong(); if ( (n < 10)) {System.out.println(n); return ;} else { long sum = 0;  long cur = 9;  long prev = 0;  int count = 1; while((n > cur)){n -= cur; sum += (cur / count); prev = cur; cur = ((9 * (count + 1)) * (long)Math.pow(10,count)); count++; }sum = (sum + (n / count)); if ( ((n % count) == 0)) {System.out.println((sum % 10)); } else {sum++; n = (n % count); String s = String.valueOf(sum); System.out.println(s.charAt(((int)n - 1))); }}} public static int pow( int a, int b){ int res = 1; while((b > 0)){if ( ((b & 1) != 0)) {res = (res * a); } a = (a * a); b = (b >> 1); }return res;} public static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} long nextLong(){ return Long.parseLong(next());} } }
2	public class CFFF{ static PrintWriter out ; static final int oo = 987654321; static final long mod = ((long)1e9 + 9); public static void main( String[] args){ MScanner sc = new MScanner(); out = new PrintWriter(System.out); long N = sc.nextLong();  long M = sc.nextLong();  long K = sc.nextLong(); if ( (M <= (N - (N / K)))) out.println(M); else { long ans = ((((fastModExpo(2,(((M - (((N - (N % K)) / K) * (K - 1))) - (N % K)) + 1),mod) - 2) * K) + M) - (((M - (((N - (N % K)) / K) * (K - 1))) - (N % K)) * K)); out.println(((mod + ans) % mod)); }out.close(); } static long fastModExpo( int base, long pow, long mod){ if ( (pow == 0)) return 1L; if ( ((pow & 1) == 1)) return ((base * fastModExpo(base,(pow - 1),mod)) % mod); long temp = fastModExpo(base,(pow / 2),mod); return ((temp * temp) % mod);} static class MScanner{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public MScanner(){ stream = System.in; } 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));} int nextInt(){ return Integer.parseInt(next());} int[] nextInt( int N){ int[] ret = new int[N]; for ( int a = 0;(a < N);a++) ret[a] = nextInt(); return ret;} int[][] nextInt( int N, int M){ int[][] ret = new int[N][M]; for ( int a = 0;(a < N);a++) ret[a] = nextInt(M); return ret;} long nextLong(){ return Long.parseLong(next());} long[] nextLong( int N){ long[] ret = new long[N]; for ( int a = 0;(a < N);a++) ret[a] = nextLong(); return ret;} double nextDouble(){ return Double.parseDouble(next());} double[] nextDouble( int N){ double[] ret = new double[N]; for ( int a = 0;(a < N);a++) ret[a] = nextDouble(); return ret;} 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();} String[] next( int N){ String[] ret = new String[N]; for ( int a = 0;(a < N);a++) ret[a] = next(); return ret;} 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();} String[] nextLine( int N){ String[] ret = new String[N]; for ( int a = 0;(a < N);a++) ret[a] = nextLine(); return ret;} } }
6	public class P111C{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); double EPS = 1e-9; int h ,w ; void run(){ h = sc.nextInt(); w = sc.nextInt(); solve(); } void solve(){ n = (w * h); g = new long[n]; int[] dx = {0,0,-1,1};  int[] dy = {-1,1,0,0}; for ( int y = 0;(y < h);y++) {for ( int x = 0;(x < w);x++) {for ( int k = 0;(k < 4);k++) { int x2 = (x + dx[k]);  int y2 = (y + dy[k]); if ( ((((x2 >= 0) && (x2 < w)) && (y2 >= 0)) && (y2 < h))) {g[((y * w) + x)] |= (1L << ((y2 * w) + x2)); } }}}mds = ((1L << n) - 1); mds(0,0,0); println(((n - Long.bitCount(mds)) + "")); } int n ; long[] g ; long mds ; void mds( long choosed, long removed, long covered){ if ( (Long.bitCount(choosed) >= Long.bitCount(mds))) return ; if ( (covered == ((1L << n) - 1))) {if ( (Long.bitCount(choosed) < Long.bitCount(mds))) mds = choosed; return ;} int k = -1;  ArrayList<Integer> list = new ArrayList<Integer>(); for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); if ( (((covered >>> i) & 1) == 1)) {if ( (Long.bitCount((g[i] & ~covered)) == 0)) {mds(choosed,(removed | (1L << i)),covered); return ;} else if ( ((Long.bitCount((g[i] & ~covered)) == 1) && (((g[i] & ~covered) & ~removed) != 0))) {mds(choosed,(removed | (1L << i)),covered); return ;} } else {if ( (Long.bitCount((g[i] & ~removed)) == 0)) {mds((choosed | (1L << i)),(removed | (1L << i)),((covered | (1L << i)) | g[i])); return ;} else if ( ((Long.bitCount((g[i] & ~removed)) == 1) && (((g[i] & ~removed) | (g[i] & ~covered)) == (g[i] & ~removed)))) { int j = Long.numberOfTrailingZeros((g[i] & ~removed)); mds((choosed | (1L << j)),((removed | (1L << i)) | (1L << j)),((covered | (1L << j)) | g[j])); return ;} }if ( ((k == -1) || (Long.bitCount((g[i] & ~covered)) > Long.bitCount((g[k] & ~covered))))) {list.clear(); list.add(i); k = i; } else if ( (Long.bitCount((g[i] & ~covered)) == Long.bitCount((g[k] & ~covered)))) list.add(i); }if ( (k == -1)) return ; k = list.get((int)(list.size() * random())); mds((choosed | (1L << k)),(removed | (1L << k)),((covered | (1L << k)) | g[k])); mds(choosed,(removed | (1L << k)),covered); } void println( String s){ System.out.println(s); } void print( String s){ System.out.print(s); } public static void main( String[] args){ Locale.setDefault(Locale.US); new P111C().run(); } }
3	public class Codeforces{ public static void main( String[] args)throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); final double eps = 1e-7;  String toks[] = in.readLine().split(" ");  int n = Integer.parseInt(toks[0]);  double r = Double.parseDouble(toks[1]);  double x[] = new double[n]; toks = in.readLine().split(" "); for ( int i = 0;(i < n);i++) {x[i] = Double.parseDouble(toks[i]); } double lo ,hi ,mid ;  double y[] = new double[n]; y[0] = r; for ( int i = 1;(i < n);i++) {y[i] = r; for ( int j = 0;(j < i);j++) {lo = y[j]; hi = (2000 * 2000); while((Math.abs((hi - lo)) >= eps)){mid = ((hi + lo) / 2); if ( ((Math.sqrt((((x[i] - x[j]) * (x[i] - x[j])) + ((y[j] - mid) * (y[j] - mid)))) + eps) > (2 * r))) {hi = mid; } else {lo = mid; }}if ( (Math.sqrt((((x[i] - x[j]) * (x[i] - x[j])) + ((y[j] - lo) * (y[j] - lo)))) < ((2 * r) + eps))) {y[i] = Math.max(y[i],lo); } }}for ( double z :y) {System.out.printf(Locale.US,"%.7f ",z); }} }
6	public class E implements Runnable{ public static void main( String[] args){ new Thread(null,new E(),"_cf",(1 << 28)).start(); } int n ,m ; char[] str ; int[][] occs ,cost ; int[] dp ; int oo = (int)1e9; int min( int a, int b){ if ( (a < b)) return a; return b;} class FastScanner{ public int BS = (1 << 16); public char NC = (char)0; byte[] buf = new byte[BS]; int bId = 0,size = 0; char c = NC; double num = 1; BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } public char nextChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ num = 1; boolean neg = false; if ( (c == NC)) c = nextChar(); for ( ;((c < '0') || (c > '9'));c = nextChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = nextChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); num *= 10; }return (neg?-res:res);} public String next(){ StringBuilder res = new StringBuilder(); while((c <= 32))c = nextChar(); while((c > 32)){res.append(c); c = nextChar(); }return res.toString();} } }
2	public class test1177b{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long k = sc.nextLong();  long k1 = 0,k2 = 0;  long p = 1;  String str = ""; for ( int i = 1;(i <= 12);i++) {if ( ((k >= k1) && (k <= (k1 + ((p * 9) * i))))) { long kk = ((k - k1) % i); k2 = ((p + ((k - k1) / i)) - 1); if ( (kk != 0)) k2++; str = ("" + k2); if ( (str.length() > i)) {k2--; str = ("" + k2); kk = 0; } if ( (kk > 0)) {System.out.println(str.charAt(((int)kk - 1))); } else {System.out.println(str.charAt((i - 1))); }break;} else {k1 += ((p * 9) * i); p = (p * 10); }}} }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  QuickScanner in = new QuickScanner(inputStream);  QuickWriter out = new QuickWriter(outputStream);  TaskG solver = new TaskG(); solver.solve(1,in,out); out.close(); } static class TaskG{ static int MAXL = (700 + 1); static IntModular MOD = new IntModular(); int n ; char[] digits ; int[] pow10 ; int[] ones ; int[][][] way ; public void solve( int testNumber, QuickScanner in, QuickWriter out){ digits = new char[MAXL]; n = in.next(digits); initPow(); int res = MOD.mul(calc(9),9); for ( int digit = 0;(digit < 9);++digit) {res = MOD.sub(res,calc(digit)); }out.println(res); } void initPow(){ pow10 = new int[(n + 1)]; ones = new int[(n + 1)]; pow10[0] = 1; for ( int i = 1;(i <= n);++i) {pow10[i] = MOD.mul(pow10[(i - 1)],10); ones[i] = MOD.add(MOD.mul(ones[(i - 1)],10),1); }} int calc( int targetDigit){ if ( (way == null)) {way = new int[2][2][(n + 1)]; } int t = 0; clearCnt(t); way[t][0][0] = 1; for ( int i = 0;(i < n);++i) { int digit = (digits[i] - '0'); clearCnt((t ^ 1)); for ( int cnt = 0;(cnt <= n);++cnt) if ( (way[t][0][cnt] > 0)) { int newCnt = ((targetDigit < digit)?(cnt + 1):cnt); way[(t ^ 1)][0][newCnt] = MOD.add(way[(t ^ 1)][0][newCnt],way[t][0][cnt]); way[(t ^ 1)][1][cnt] = MOD.add(way[(t ^ 1)][1][cnt],MOD.mul(Math.min((targetDigit + 1),digit),way[t][0][cnt])); way[(t ^ 1)][1][(cnt + 1)] = MOD.add(way[(t ^ 1)][1][(cnt + 1)],MOD.mul(Math.max(((digit - targetDigit) - 1),0),way[t][0][cnt])); } for ( int cnt = 0;(cnt <= n);++cnt) if ( (way[t][1][cnt] > 0)) {way[(t ^ 1)][1][cnt] = MOD.add(way[(t ^ 1)][1][cnt],MOD.mul((targetDigit + 1),way[t][1][cnt])); way[(t ^ 1)][1][(cnt + 1)] = MOD.add(way[(t ^ 1)][1][(cnt + 1)],MOD.mul((9 - targetDigit),way[t][1][cnt])); } t ^= 1; } int res = 0; for ( int cnt = 0;(cnt <= n);++cnt) {res = MOD.add(res,MOD.mul(MOD.mul(ones[(n - cnt)],pow10[cnt]),MOD.add(way[t][0][cnt],way[t][1][cnt]))); }return res;} void clearCnt( int t){ for ( int free = 0;(free < 2);++free) {Arrays.fill(way[t][free],0); }} } static class QuickWriter{ private final PrintWriter writer ; public QuickWriter( OutputStream outputStream){ this.writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public QuickWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);++i) {if ( (i > 0)) {writer.print(' '); } writer.print(objects[i]); }} public void println( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } } static class IntModular{ static private final int MOD = 1000000007; public final int mod ; private final int[] x ; public IntModular(){ this(MOD); } public IntModular( int mod){ this.mod = mod; this.x = new int[2]; } public int add( int a, int b){ return fix((a + b),mod);} public int sub( int a, int b){ return fix((a - b),mod);} public int mul( int a, int b){ return mul(a,b,mod);} public static int mul( int a, int b, int mod){ return ((a > 0)?((b < (mod / a))?(a * b):(int)(((long)a * b) % mod)):0);} public static int fix( int a, int mod){ a = slightFix(a,mod); return (((0 <= a) && (a < mod))?a:slightFix((a % mod),mod));} static private int slightFix( int a, int mod){ return ((a >= mod)?(a - mod):((a < 0)?(a + mod):a));} } static class QuickScanner{ static private final int BUFFER_SIZE = 1024; private InputStream stream ; private byte[] buffer ; private int currentPosition ; private int numberOfChars ; public QuickScanner( InputStream stream){ this.stream = stream; this.buffer = new byte[BUFFER_SIZE]; this.currentPosition = 0; this.numberOfChars = 0; } public int next( char[] s){ return next(s,0);} public int next( char[] s, int startIdx){ int b = nextNonSpaceChar();  int res = 0; do {s[startIdx++] = (char)b; b = nextChar(); ++res; }while(!isSpaceChar(b));return res;} public int nextNonSpaceChar(){ int res = nextChar(); for ( ;(isSpaceChar(res) || (res < 0));res = nextChar()) ;return res;} public int nextChar(){ if ( (numberOfChars == -1)) {throw (new RuntimeException());} if ( (currentPosition >= numberOfChars)) {currentPosition = 0; try{numberOfChars = stream.read(buffer); }catch (Exception e){ throw (new RuntimeException(e));} if ( (numberOfChars <= 0)) {return -1;} } return buffer[currentPosition++];} public boolean isSpaceChar( int c){ return (((c == ' ') || (c == '\t')) || isEndOfLineChar(c));} public boolean isEndOfLineChar( int c){ return (((c == '\n') || (c == '\r')) || (c < 0));} } }
0	public class MainY{ static double eps = (double)1e-6; static long mod = ((int)1e9 + 7); static boolean f = true; public static void main( String[] args){ InputReader in = new InputReader(System.in);  OutputStream outputStream = System.out;  PrintWriter out = new PrintWriter(outputStream);  long n = in.nextLong(); if ( (n == 1)) {System.out.println("5"); } else {System.out.println("25"); }out.close(); } static class InputReader{ public BufferedReader reader ; public StringTokenizer tokenizer ; public InputReader( InputStream inputstream){ reader = new BufferedReader(new InputStreamReader(inputstream)); 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 long nextLong(){ return Long.parseLong(next());} } }
3	public class p3{ static int N ,M ,K ; static String s ; static StringTokenizer st ; static int[] d ; public static void main( String[] args)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(br.readLine()); int N = Integer.parseInt(st.nextToken());  int R = Integer.parseInt(st.nextToken());  double[] x = new double[N]; st = new StringTokenizer(br.readLine()); for ( int i = 0;(i < N);i++) {x[i] = Double.parseDouble(st.nextToken()); } double[] y = new double[N]; for ( int i = 0;(i < N);i++) { double maxy = R; for ( int j = (i - 1);(j >= 0);j--) {if ( (Math.abs((x[j] - x[i])) <= (2 * R))) {maxy = Math.max((y[j] + inc((x[j] - x[i]),R)),maxy); } }y[i] = maxy; }for ( int i = 0;(i < (y.length - 1));i++) {System.out.print((y[i] + " ")); }System.out.println(y[(y.length - 1)]); } public static double inc( double x, double R){ return Math.sqrt((((4 * R) * R) - (x * x)));} }
4	public class e1515{ public static void main( String[] args){ Scanner s = new Scanner(System.in); solve(s.nextInt(),s.nextLong()); } public static long inv( long n, long mod){ if ( (n == 1)) return 1; return ((inv((mod % n),mod) * (mod - (mod / n))) % mod);} public static void solve( int n, long mod){ long fact[] = new long[(n + 2)];  long invFact[] = new long[(n + 2)];  long twoPow[] = new long[(n + 2)]; fact[0] = 1; invFact[0] = 1; twoPow[0] = 1; for ( int i = 1;(i < (n + 2));i++) {fact[i] = ((fact[(i - 1)] * i) % mod); invFact[i] = ((invFact[(i - 1)] * inv(i,mod)) % mod); twoPow[i] = ((2 * twoPow[(i - 1)]) % mod); } long dp[][] = new long[(n + 2)][]; dp[0] = new long[]{1}; long next[] = null; for ( int i = 1;(i <= (n + 1));i++) {next = new long[(i + 1)]; for ( int j = 0;(j < (i - 1));j++) {for ( int k = 0;(k < dp[j].length);k++) {next[(((k + i) - j) - 1)] = ((next[(((k + i) - j) - 1)] + ((((((((dp[j][k] * twoPow[((i - j) - 2)]) % mod) * fact[(((k + i) - j) - 1)]) % mod) * invFact[k]) % mod) * invFact[((i - j) - 1)]) % mod)) % mod); }}dp[i] = next; } long sum = 0; for ( int i = 0;(i < next.length);i++) {sum = ((sum + next[i]) % mod); }System.out.println(sum); } }
2	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);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ public void solve( int testNumber, Scanner in, PrintWriter out){ long n = in.nextLong();  long st = 1,en = n,ans = 0,len = 0; while((st <= en)){ long mid = ((st + en) / 2);  long have = 0;  int curLen = Long.toString(mid).length();  long bef = 0; for ( int i = 1;(i < curLen);i++) { long cur = 0; for ( int j = 1;(j <= i);j++) {cur *= 10; cur += 9; }have += (i * (cur - bef)); bef = cur; }have += (curLen * (mid - bef)); if ( (have < n)) {ans = mid; len = have; st = (mid + 1); } else en = (mid - 1); } String s = Long.toString((ans + 1)); for ( int i = 0;(i < s.length());i++) {if ( (((len + i) + 1) == n)) {out.print(s.charAt(i)); return ;} }} } }
5	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);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  int k = in.nextInt();  HashSet<Integer> set = new HashSet<Integer>();  int a[] = new int[n]; for ( int i = 0;(i < n);++i) {a[i] = in.nextInt(); }Arrays.sort(a); int ans = 0;  int ptr = -1;  boolean chosen[] = new boolean[n]; for ( int i = 0;(i < n);++i) {while((((ptr + 1) < i) && ((a[(ptr + 1)] * (long)k) <= a[i]))){++ptr; }if ( (((((a[i] % k) != 0) || (ptr == -1)) || !chosen[ptr]) || ((a[ptr] * (long)k) != a[i]))) {++ans; chosen[i] = true; } }out.println(ans); } } class InputReader{ BufferedReader reader ; StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new StringTokenizer(reader.readLine()); }catch (Exception e){ throw (new UnknownError());} }return tokenizer.nextToken();} public int nextInt(){ return Integer.parseInt(next());} }
3	public class ProblemA{ public static void main( String[] args)throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(bf.readLine());  StringTokenizer st1 = new StringTokenizer(bf.readLine());  int n = Integer.parseInt(st.nextToken());  int r = Integer.parseInt(st.nextToken());  int[] xcoords = new int[n]; for ( int i = 0;(i < n);i++) {xcoords[i] = Integer.parseInt(st1.nextToken()); } double[] ycoords = new double[n]; for ( int i = 0;(i < n);i++) { ArrayList<Integer> nodes = new ArrayList<Integer>(); for ( int j = 0;(j < i);j++) {if ( (Math.abs(((xcoords[j] - xcoords[i]) + 0.0)) <= (2 * r))) nodes.add(j); }if ( nodes.isEmpty()) {ycoords[i] = r; continue;} else { double min = -1; for ( int k = 0;(k < nodes.size());k++) { double tmp = (ycoords[nodes.get(k)] + Math.sqrt((((4 * r) * r) - ((xcoords[i] - xcoords[nodes.get(k)]) * (xcoords[i] - xcoords[nodes.get(k)]))))); if ( (tmp > min)) {min = tmp; } }ycoords[i] = min; }}for ( int i = 0;(i < ycoords.length);i++) {System.out.print((ycoords[i] + " ")); }} }
1	public class abc{ public static int check( StringBuilder s){ int countRemove = 0; if ( !s.toString().contains("xxx")) return countRemove; else {for ( int i = 1;(i < (s.length() - 1));i++) {if ( (((s.charAt((i - 1)) == 'x') && (s.charAt(i) == 'x')) && (s.charAt((i + 1)) == 'x'))) {countRemove++; } }return countRemove;}} public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  String s = sc.next();  StringBuilder sb = new StringBuilder(""); sb.append(s); System.out.println(check(sb)); } }
5	public class Solution implements Runnable{ public void solve()throws Exception { int n = sc.nextInt();  int k = sc.nextInt();  TreeSet<Integer> bad = new TreeSet<>();  int a[] = new int[n]; for ( int i = 0;(i < n);i++) a[i] = sc.nextInt(); Arrays.sort(a); int result = 0; for ( int i = 0;(i < n);i++) {if ( !bad.contains(a[i])) {result++; long next = ((long)a[i] * k); if ( (next <= 1000000000)) bad.add((int)next); } }out.println(result); } BufferedReader in ; PrintWriter out ; FastScanner sc ; static Throwable uncaught ; public static void main( String[] args)throws Throwable { Thread t = new Thread(null,new Solution(),"",(1 << 26)); t.start(); t.join(); if ( (uncaught != null)) {throw (uncaught);} } } class FastScanner{ BufferedReader reader ; StringTokenizer strTok ; public FastScanner( BufferedReader reader){ this.reader = reader; } public String nextToken()throws IOException { while(((strTok == null) || !strTok.hasMoreTokens())){strTok = new StringTokenizer(reader.readLine()); }return strTok.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
3	public class C{ public static void main( String[] args)throws IOException { FastScanner in = new FastScanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt();  int r = in.nextInt();  int[] x = new int[n]; for ( int i = 0;(i < x.length);i++) {x[i] = in.nextInt(); } double[] res = new double[n]; res[0] = r; for ( int i = 1;(i < x.length);i++) { boolean found = false; for ( int j = 0;(j < i);j++) { double dis = Math.abs((x[i] - x[j]));  double rr = (((4.0 * r) * r) - ((1.0 * dis) * dis)); if ( (rr >= 0)) { double del = Math.sqrt(rr); res[i] = Math.max(res[i],(res[j] + del)); found = true; } }if ( !found) {res[i] = r; } }for ( int i = 0;(i < res.length);i++) {out.print((res[i] + " ")); }out.close(); } static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream in){ br = new BufferedReader(new InputStreamReader(in)); st = new StringTokenizer(""); } public String next()throws IOException { if ( !st.hasMoreTokens()) {st = new StringTokenizer(br.readLine()); return next();} return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} } }
2	public class Solution{ public static void main( String[] args){ long b = 0;  long p = 1;  Scanner s = new Scanner(System.in);  long m = s.nextLong();  long x = 1; do {p = ((m + b) / x); b = ((10 * b) + 10); x++; }while(((p / (long)Math.pow(10,(x - 1))) != 0));x--; b = ((b / 10) - 1); b = ((x * p) - b); b = (m - b); b = ((x - b) - 1); p /= (long)Math.pow(10,b); p %= 10; System.out.println(p); } }
0	public class A630{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  long n = scan.nextLong(); System.out.println(25); } }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  Kattio in = new Kattio(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, Kattio in, PrintWriter out){ int n = in.nextInt();  int r = in.nextInt();  double[] xs = new double[n];  double[] ys = new double[n];  TreeSet<TaskC.Pair> set = new TreeSet<>(); for ( int i = 0;(i < n);++i) {xs[i] = in.nextDouble(); ys[i] = (double)Integer.MIN_VALUE; if ( (i == 0)) {out.printf("%f",(double)r); ys[i] = (double)r; set.add(new TaskC.Pair(xs[i],ys[i])); } else {for ( TaskC.Pair p :set) { double maximum = p.x;  double diffX = ((xs[i] - maximum) * (xs[i] - maximum)); if ( (diffX <= ((r * r) * 4.0))) {ys[i] = Math.max(ys[i],(p.y + Math.sqrt((((r * r) * 4.0) - diffX)))); continue;} }if ( (ys[i] < 0)) ys[i] = (double)r; set.add(new TaskC.Pair(xs[i],ys[i])); out.printf(" %f",ys[i]); }}} } static class Kattio extends PrintWriter{ private BufferedReader r ; private String line ; private StringTokenizer st ; private String token ; public Kattio( InputStream i){ super(new BufferedOutputStream(System.out)); r = new BufferedReader(new InputStreamReader(i)); } public Kattio( InputStream i, OutputStream o){ super(new BufferedOutputStream(o)); r = new BufferedReader(new InputStreamReader(i)); } public int nextInt(){ return Integer.parseInt(nextToken());} public double nextDouble(){ return Double.parseDouble(nextToken());} private String peekToken(){ if ( (token == null)) try{while(((st == null) || !st.hasMoreTokens())){line = r.readLine(); if ( (line == null)) return null; st = new StringTokenizer(line); }token = st.nextToken(); }catch (IOException e){ } return token;} private String nextToken(){ String ans = peekToken(); token = null; return ans;} } }
1	public class TaskB implements Runnable{ boolean prime[] = new boolean[((int)1e6 + 10)]; InputReader c ; PrintWriter w ; static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} 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 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 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 TaskB(),"TaskB",(1 << 26)).start(); } }
6	public class Main{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  double value[][] = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) value[i][j] = in.nextDouble(); double ans[] = new double[(1 << n)];  int mask = (1 << n); ans[((1 << n) - 1)] = 1.0; for ( int i = (mask - 1);(i >= 0);i--) { int cnt = Integer.bitCount(i);  int pairs = ((cnt * (cnt - 1)) / 2); for ( int j = 0;(j < n);j++) {if ( (((i >> j) & 1) == 0)) continue; for ( int k = (j + 1);(k < n);k++) {if ( (((i >> k) & 1) == 0)) continue; ans[(i ^ (1 << k))] += ((ans[i] * value[j][k]) / pairs); ans[(i ^ (1 << j))] += ((ans[i] * value[k][j]) / pairs); }}}for ( int i = 0;(i < n);i++) System.out.print((ans[(1 << i)] + " ")); } }
2	public class D{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  int tc = sc.nextInt(); out:while((tc-- > 0)){ long n = sc.nextInt();  long k = sc.nextLong(); if ( (n >= 32)) {pw.println(("YES " + (n - 1))); continue;} long steps = 0; for ( int i = 1;;i++) { long cnt = ((1l << (i + 1)) - 1); steps += ((1l << i) - 1); if ( (steps > k)) break; if ( (steps > f(n))) break; long rem = (k - steps); if ( (rem <= ((f(n) - steps) - (cnt * f((n - i)))))) {pw.println(("YES " + (n - i))); continue out;} }pw.println("NO"); }pw.flush(); pw.close(); } static long f( long n){ if ( (n == 0)) return 0; long ans = 0; for ( int i = 0;(i < n);i++) {ans += (1l << (2 * i)); }return ans;} static int[][] matMul( int[][] A, int[][] B, int p, int q, int r){ int[][] C = new int[p][r]; for ( int i = 0;(i < p);++i) for ( int j = 0;(j < r);++j) for ( int k = 0;(k < q);++k) C[i][j] += (A[i][k] * B[k][j]); return C;} static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public Scanner( String s)throws FileNotFoundException{ br = new BufferedReader(new FileReader(new File(s))); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public long nextLong()throws IOException { return Long.parseLong(next());} public boolean ready()throws IOException { return br.ready();} } }
5	public class solve{ Scanner in ; PrintWriter out ; public void solve()throws IOException { int n = in.nextInt();  long k = in.nextLong();  int[] a = new int[n];  Set<Long> b = new TreeSet<Long>(); for ( int i = 0;(i < n);i++) {a[i] = in.nextInt(); }Arrays.sort(a); int ans = 0; for ( int i = (n - 1);(i >= 0);i--) {if ( !b.contains(((long)k * a[i]))) {ans++; b.add((long)a[i]); } }out.print(ans); } public void run(){ try{in = new Scanner(System.in); out = new PrintWriter(System.out); solve(); out.close(); }catch (IOException e){ e.printStackTrace(); } } public static void main( String[] arg){ new solve().run(); } }
6	public class Main{ static final boolean _DEBUG = false; static private class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner( BufferedReader _br){ br = _br; } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ e.printStackTrace(); return "";} }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } static MyScanner scan ; static PrintWriter out ; static int debugCount = 0; public static void main( String[] args)throws IOException { scan = new MyScanner(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); Main inst = new Main(); inst.execute(); out.close(); } int N ,M ,pow ; int[] counts ; int[][][] dp ; void execute(){ N = scan.nextInt(); M = scan.nextInt(); if ( (N < M)) { int temp = N; N = M; M = temp; } pow = (1 << M); counts = new int[pow]; dp = new int[N][pow][pow]; for ( int[][] i :dp) {for ( int[] j :i) {Arrays.fill(j,-1); }}for ( int i = 0;(i < pow);i++) {counts[i] = Integer.bitCount(i); dp[0][i][0] = counts[i]; } int spiders = Integer.MAX_VALUE; for ( int y = 0;(y < (N - 1));y++) {for ( int i = 0;(i < pow);i++) {for ( int j = 0;(j < pow);j++) {if ( (dp[y][i][j] == -1)) {continue;} for ( int k = 0;(k < pow);k++) {if ( ((((((i | (i << 1)) | (i >> 1)) | j) | k) & (pow - 1)) == (pow - 1))) { int value = (dp[y][i][j] + counts[k]); if ( ((dp[(y + 1)][k][i] == -1) || (dp[(y + 1)][k][i] > value))) {dp[(y + 1)][k][i] = value; } } }}}}for ( int i = 0;(i < pow);i++) {for ( int j = 0;(j < pow);j++) {if ( ((dp[(N - 1)][i][j] != -1) && (((((i | (i << 1)) | (i >> 1)) | j) & (pow - 1)) == (pow - 1)))) {spiders = Math.min(spiders,dp[(N - 1)][i][j]); } }}out.println(((N * M) - spiders)); } }
4	public class Main{ public static void main(final String[] args)throws IOException { try(Scanner scan=new Scanner(System.in);PrintWriter print=new PrintWriter(System.out)){final int n = scan.nextInt(); final int m = scan.nextInt(); final Pair<Integer,Integer>[] arcs = new Pair[m]; for ( int k = 0;(k < m);++k) { int i = scan.nextInt();  int j = scan.nextInt(); --i; --j; arcs[k] = new Pair(i,j); }print.println(calcMinNumStepsToCenterPermGraph(new DirectedGraph(n,arcs))); }} public static int calcMinNumStepsToCenterPermGraph(final DirectedGraph graph){ int result = Integer.MAX_VALUE; for ( DirectedGraph.Vertex center :graph.vertices) { int num = (((((2 * graph.vertices.length) - 1) - graph.getOutcomingArcs(center).size()) - graph.getIncomingArcs(center).size()) + (graph.containsArc(center,center)?1:0)); final int n = (graph.vertices.length - 1); final List<Pair<Integer,Integer>> edges = CollectionFactory.createArrayList(); for ( DirectedGraph.Arc arc :graph.arcs) {if ( (!center.equals(arc.from) && !center.equals(arc.to))) { int i = arc.from.index;  int j = arc.to.index; if ( (i > center.index)) {--i; } if ( (j > center.index)) {--j; } edges.add(new Pair(i,j)); } }final int matching = GraphUtils.calcNumMatchingBipartite(n,n,edges); num += (edges.size() - matching); num += (n - matching); result = Math.min(result,num); }return result;} public static class DirectedGraph{ public static class Vertex{ public final int index ; public Vertex( int index){ this.index = index; } @Override public boolean equals( Object o){ if ( (this == o)) return true; if ( ((o == null) || (getClass() != o.getClass()))) return false; Vertex vertex = (Vertex)o; if ( (index != vertex.index)) return false; return true;} @Override public int hashCode(){ return index;} } public static class Arc{ public final Vertex from ; public final Vertex to ; public Arc( Vertex from, Vertex to){ this.from = from; this.to = to; } @Override public boolean equals( Object o){ if ( (this == o)) return true; if ( ((o == null) || (getClass() != o.getClass()))) return false; Arc arc = (Arc)o; if ( !from.equals(arc.from)) return false; if ( !to.equals(arc.to)) return false; return true;} @Override public int hashCode(){ int result = from.hashCode(); result = ((31 * result) + to.hashCode()); return result;} } public final Vertex[] vertices ; public final Arc[] arcs ; public DirectedGraph(final int n,final Pair<Integer,Integer>[] arcs){ vertices = new Vertex[n]; this.arcs = new Arc[arcs.length]; for ( int i = 0;(i < n);++i) {vertices[i] = new Vertex(i); }for ( int i = 0;(i < arcs.length);++i) {this.arcs[i] = new Arc(vertices[arcs[i].first],vertices[arcs[i].second]); }} public List<Arc> getOutcomingArcs(final Vertex v){ final List<Arc> result = CollectionFactory.createArrayList(); for ( Arc arc :arcs) {if ( arc.from.equals(v)) {result.add(arc); } }return result;} public List<Arc> getIncomingArcs(final Vertex v){ final List<Arc> result = CollectionFactory.createArrayList(); for ( Arc arc :arcs) {if ( arc.to.equals(v)) {result.add(arc); } }return result;} public boolean containsArc(final Vertex from,final Vertex to){ for ( Arc arc :arcs) {if ( (arc.from.equals(from) && arc.to.equals(to))) {return true;} }return false;} } public static class MatrixIntMod{ final int mod ; final int[][] data ; public MatrixIntMod(final int n,final int m,final int mod){ this.mod = mod; this.data = new int[n][m]; for ( int i = 0;(i < n);++i) {Arrays.fill(data[i],0); }} public MatrixIntMod(final int[][] data,final int mod){ this(data.length,data[0].length,mod); for ( int i = 0;(i < data.length);++i) {for ( int j = 0;(j < data[i].length);++j) {this.data[i][j] = ModNumberUtils.norm(mod,data[i][j]); }}} public MatrixIntMod(final int[] data,final int mod){ this(data.length,1,mod); for ( int i = 0;(i < data.length);++i) {this.data[i][0] = ModNumberUtils.norm(mod,data[i]); }} public int[] all(){ int n = data.length;  int m = data[0].length; final int[] res = new int[(n * m)];  int k = 0; for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < m);++j) {res[k++] = data[i][j]; }}return res;} public MatrixIntMod mult(final MatrixIntMod val){ if ( (data[0].length != val.data.length)) throw (new RuntimeException("dimensions for mult are wrong")); final int n = data.length; final int m = data[0].length; final int l = val.data[0].length; final MatrixIntMod res = new MatrixIntMod(n,l,mod); for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < l);++j) {for ( int k = 0;(k < m);++k) {res.data[i][j] = ModNumberUtils.add(mod,res.data[i][j],ModNumberUtils.mult(mod,data[i][k],val.data[k][j])); }}}return res;} public int[] mult(final int[] ar){ return mult(new MatrixIntMod(ar,mod)).all();} public MatrixIntMod power(final long t){ if ( (t == 0)) return eye(data.length,mod); MatrixIntMod res = power((t >> 1)); res = res.mult(res); if ( ((t & 1) == 1)) {res = res.mult(this); } return res;} public static MatrixIntMod eye(final int n,final int mod){ final MatrixIntMod res = new MatrixIntMod(n,n,mod); if ( (mod > 1)) {for ( int i = 0;(i < n);++i) {res.data[i][i] = 1; }} return res;} } public static class Pair<X,Y>{ public X first ; public Y second ; public Pair(final X first,final Y second){ this.first = first; this.second = second; } } }
4	public class CF387D{ static class A{ ArrayList<Integer> list = new ArrayList<>(); int u ,v ,d ; } static int INF = Integer.MAX_VALUE; static boolean bfs( A[] aa, int n){ LinkedList<Integer> q = new LinkedList<>(); for ( int u = 1;(u <= n);u++) if ( (aa[u].v > 0)) aa[u].d = INF; else {aa[u].d = 0; q.addLast(u); }aa[0].d = INF; while(!q.isEmpty()){ int u = q.removeFirst(); for ( int v :aa[u].list) { int w = aa[v].u; if ( (aa[w].d == INF)) {aa[w].d = (aa[u].d + 1); if ( (w == 0)) return true; q.addLast(w); } }}return false;} static boolean dfs( A[] aa, int n, int u){ if ( (u == 0)) return true; for ( int v :aa[u].list) { int w = aa[v].u; if ( ((aa[w].d == (aa[u].d + 1)) && dfs(aa,n,w))) {aa[u].v = v; aa[v].u = u; return true;} }aa[u].d = INF; return false;} static int matchings( A[] aa, int n){ int cnt = 0; while(bfs(aa,n))for ( int u = 1;(u <= n);u++) if ( ((aa[u].v == 0) && dfs(aa,n,u))) cnt++; return cnt;} public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int m = Integer.parseInt(st.nextToken());  int[] eu = new int[m];  int[] ev = new int[m]; for ( int j = 0;(j < m);j++) {st = new StringTokenizer(br.readLine()); eu[j] = Integer.parseInt(st.nextToken()); ev[j] = Integer.parseInt(st.nextToken()); } A[] aa = new A[(n + 1)];  int min = (m + (n * 3)); for ( int ctr = 1;(ctr <= n);ctr++) { boolean loop = false;  boolean[] ci = new boolean[(n + 1)];  boolean[] co = new boolean[(n + 1)]; for ( int i = 0;(i <= n);i++) aa[i] = new A(); int m_ = 0; for ( int j = 0;(j < m);j++) { int u = eu[j];  int v = ev[j]; if ( ((u == ctr) && (v == ctr))) loop = true; else if ( ((u == ctr) && (v != ctr))) ci[v] = true; else if ( ((u != ctr) && (v == ctr))) co[u] = true; else {aa[u].list.add(v); m_++; }} int cnt = (loop?0:1); for ( int i = 1;(i <= n);i++) if ( (i != ctr)) {if ( !ci[i]) cnt++; if ( !co[i]) cnt++; } int m2 = matchings(aa,n); cnt += ((m_ - m2) + ((n - 1) - m2)); if ( (min > cnt)) min = cnt; }System.out.println(min); } }
5	public class Main{ static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); public static void main( String[] args){ int n = nextInt();  int m = nextInt();  long b[] = new long[n];  long g[] = new long[m]; for ( int i = 0;(i < n);i++) b[i] = nextInt(); for ( int i = 0;(i < m);i++) g[i] = nextInt(); Arrays.sort(b); Arrays.sort(g); if ( (b[(n - 1)] > g[0])) System.out.println("-1"); else if ( (b[(n - 1)] == g[0])) { long sum = 0; for ( int i = 0;(i < m);i++) sum += g[i]; for ( int i = 0;(i < (n - 1));i++) {sum += (m * b[i]); }System.out.println(sum); } else { long sum = 0; for ( int i = 0;(i < m);i++) sum += g[i]; sum += b[(n - 1)]; sum += (b[(n - 2)] * (m - 1)); for ( int i = 0;(i < (n - 2));i++) {sum += (m * b[i]); }System.out.println(sum); }} static int nextInt(){ try{st.nextToken(); }catch (IOException e){ e.printStackTrace(); } return (int)st.nval;} }
2	public class CodeForces{ static private MyPrinter out ; public static void solve()throws IOException { Scanner sc = new Scanner(System.in);  long l = sc.nextLong();  long r = sc.nextLong();  String ls = Long.toBinaryString(l);  String rs = Long.toBinaryString(r); while((ls.length() < rs.length())){ls = ("0" + ls); } String res = "";  boolean ok = false; for ( int i = 0;(i < ls.length());i++) {if ( ok) {res += "1"; } else {if ( (ls.charAt(i) != rs.charAt(i))) {res += "1"; ok = true; } }} long all = 0; for ( int i = 0;(i < res.length());i++) {all += (long)Math.pow((long)2,(((long)res.length() - 1) - i)); }System.out.println(all); } public static void main( String[] args)throws IOException { out = new MyPrinter(System.out); solve(); out.close(); } } class MyPrinter{ private BufferedWriter out ; public MyPrinter( OutputStream os){ out = new BufferedWriter(new PrintWriter(os)); } public MyPrinter( File f)throws IOException{ out = new BufferedWriter(new FileWriter(f)); } public void println( int i)throws IOException { out.write(Integer.toString(i)); out.newLine(); } public void println( double d)throws IOException { out.write(Double.toString(d)); out.newLine(); } public void println( long l)throws IOException { out.write(Long.toString(l)); out.newLine(); } public void println( String s)throws IOException { out.write(s); out.newLine(); } public void println( char c)throws IOException { out.write(Character.toString(c)); out.newLine(); } public void close()throws IOException { out.flush(); out.close(); } }
3	public class C{ public static Scanner sc = new Scanner(System.in); public static StringTokenizer st ; public static PrintWriter pw = new PrintWriter(System.out); static final boolean debugmode = true; public static int k = 7; public static long STMOD = (1000000000 + k); public static void main( String[] args){ int disks = getInt();  int radii = getInt(); if ( (disks == 1)) {System.out.println(radii); } else { double[][] diskcenters = new double[disks][2]; for ( int i = 0;(i < disks);i++) {diskcenters[i][0] = getInt(); }diskcenters[0][1] = radii; for ( int i = 1;(i < disks);i++) { double cmax = 0; for ( int prev = 0;(prev < i);prev++) {cmax = Math.max(cmax,calcintersection(diskcenters[prev][0],diskcenters[prev][1],radii,diskcenters[i][0],radii)); }diskcenters[i][1] = cmax; }for ( int i = 0;(i < diskcenters.length);i++) {System.out.print((Double.toString(diskcenters[i][1]) + " ")); }System.out.print("\n"); }} public static double calcintersection( double x1, double y1, double r1, double x2, double r2){ if ( !intersects((x1 - r1),(x1 + r1),(x2 - r1),(x2 + r2))) {return r2;} else if ( (x1 == x2)) {return ((y1 + r1) + r2);} double lo = y1;  double hi = (y1 + (2 * r2)); while((Math.abs((lo - hi)) > 0.0000001)){ double mid = ((lo + hi) / 2.0);  int u = colide(x1,y1,r1,x2,mid,r2); if ( (u == 1)) {lo = mid; } else if ( (u == 0)) {hi = mid; } else {return mid;}}return ((lo + hi) / 2.0);} public static boolean intersects( double l1, double r1, double l2, double r2){ if ( ((l2 <= l1) && (r2 >= l1))) {return true;} if ( ((l2 <= r1) && (r2 >= r1))) {return true;} if ( ((l1 <= l2) && (r2 <= r1))) {return true;} else if ( ((l2 <= l1) && (r1 <= r2))) {return true;} return false;} public static int colide( double x1, double y1, double r1, double x2, double y2, double r2){ double dist = Math.sqrt((Math.pow((x1 - x2),2) + Math.pow((y2 - y1),2))); if ( (dist > (r1 + r2))) {return 0;} else if ( (dist == (r1 + r2))) {return 2;} else {return 1;}} public static int getInt(){ if ( ((st != null) && st.hasMoreTokens())) {return Integer.parseInt(st.nextToken());} st = new StringTokenizer(sc.nextLine()); return Integer.parseInt(st.nextToken());} }
0	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int T = sc.nextInt();  int t = (T / 2); System.out.println((t * 3)); } }
4	public class E{ public static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out)); public static void main( String[] args)throws IOException { readInput(); out.close(); } static long[][] dp ; static int n ; static long m ; static long pow( long b, long e){ if ( (e == 0)) return 1; long r = pow(b,(e / 2)); r = ((r * r) % m); if ( ((e & 1) == 1)) return ((r * b) % m); return r;} static long modinv( long a){ return pow(a,(m - 2));} static long solve( int len, int num){ if ( ((len == -1) && (num == -1))) return 1; if ( ((num < 0) || (len <= 0))) return 0; if ( (dp[len][num] == -1)) {dp[len][num] = 0; for ( int i = 0;(i < len);i++) {if ( (i == 1)) continue; long sol = ((pow[((len - i) - 1)] * solve((i - 1),(num - 1))) % m); sol = ((sol * faci[(len - i)]) % m); dp[len][num] += sol; dp[len][num] %= m; }} return dp[len][num];} static long[] fac ,faci ,pow ; public static void readInput()throws IOException { StringTokenizer st = new StringTokenizer(br.readLine()); n = Integer.parseInt(st.nextToken()); m = Long.parseLong(st.nextToken()); fac = new long[500]; pow = new long[500]; faci = new long[fac.length]; fac[0] = pow[0] = 1; faci[0] = modinv(fac[0]); for ( int i = 1;(i < fac.length);i++) {fac[i] = ((fac[(i - 1)] * i) % m); faci[i] = modinv(fac[i]); pow[i] = ((pow[(i - 1)] * 2) % m); }dp = new long[(n + 1)][(n + 1)]; for ( long[] a :dp) Arrays.fill(a,-1); long ans = 0; for ( int i = 0;(i <= ((n / 2) + 1));i++) { long sol = (solve(n,i) * fac[(n - i)]); sol %= m; ans += sol; }out.println((ans % m)); } }
0	public class Solution{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[] str = br.readLine().split(" ");  long n = Long.parseLong(str[0]); if ( (n < 3)) System.out.println(n); else if ( ((n % 2) == 1)) System.out.println(((n * (n - 1)) * (n - 2))); else {if ( ((n % 3) != 0)) System.out.println(((n * (n - 1)) * (n - 3))); else System.out.println((((n - 1) * (n - 2)) * (n - 3))); }} }
2	public class Codechef{ static class FastScanner{ BufferedReader br ; StringTokenizer stok ; FastScanner( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); } String next()throws IOException { while(((stok == null) || !stok.hasMoreTokens())){ String s = br.readLine(); if ( (s == null)) {return null;} stok = new StringTokenizer(s); }return stok.nextToken();} int ni()throws IOException { return Integer.parseInt(next());} long nl()throws IOException { return Long.parseLong(next());} double nd()throws IOException { return Double.parseDouble(next());} } static long mod = Long.MAX_VALUE; static PrintWriter out = new PrintWriter(System.out); static FastScanner in = new FastScanner(System.in); public static void main( String[] args)throws java.lang.Exception { int i ,j ;  long flag ,flag1 ,flag2 ,temp ,temp2 ,temp1 ,count ,counter ,l ;  HashMap<Integer,Integer> hm = new HashMap<Integer,Integer>();  ArrayList<Integer> arr = new ArrayList<Integer>();  HashSet<Integer> set = new HashSet<Integer>();  PriorityQueue<Integer> pq = new PriorityQueue<Integer>();  long k = in.nl(); temp = 9; l = 1; temp2 = 0; while(true){if ( (k <= (temp2 + (temp * l)))) {k -= temp2; break;} else {temp2 += (temp * l); temp *= 10; l++; }} long z = ((k - 1) / l);  long no = ((long)Math.pow(10,(l - 1)) + z);  int index = ((int)(((k % l) == 0)?l:(k % l)) - 1);  String p = Long.toString(no); out.println(p.charAt(index)); out.close(); } static long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} static int binarySearch( int[] a, int item, int low, int high){ if ( (high <= low)) return ((item > a[low])?(low + 1):low); int mid = ((low + high) / 2); if ( (item == a[mid])) return (mid + 1); if ( (item > a[mid])) return binarySearch(a,item,(mid + 1),high); return binarySearch(a,item,low,(mid - 1));} }
6	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);  TaskE2 solver = new TaskE2(); solver.solve(1,in,out); out.close(); } static class TaskE2{ public void solve( int testNumber, FastScanner in, PrintWriter out){ int numTests = in.nextInt(); for ( int test = 0;(test < numTests);test++) { int n = in.nextInt();  int m = in.nextInt();  int[][] a = new int[n][m]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {a[i][j] = in.nextInt(); }}if ( (m > n)) { int[] maxInColumn = new int[m]; for ( int j = 0;(j < m);j++) {for ( int i = 0;(i < n);i++) {maxInColumn[j] = Math.max(maxInColumn[j],a[i][j]); }} Integer[] cols = new Integer[m]; for ( int i = 0;(i < m);i++) {cols[i] = i; }Arrays.sort(cols,(u,v)->(maxInColumn[u] - maxInColumn[v])); int[][] na = new int[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {na[i][j] = a[i][cols[j]]; }}m = n; a = na; } int[] buf = new int[n];  int[][] sums = new int[m][(1 << n)];  int[] sumsCur = new int[(1 << n)]; for ( int j = 0;(j < m);j++) {for ( int shift = 0;(shift < n);shift++) {for ( int i = 0;(i < n);i++) {buf[i] = a[((i + shift) % n)][j]; }for ( int mask = 1;(mask < (1 << n));mask++) { int k = Integer.numberOfTrailingZeros(mask); sumsCur[mask] = (sumsCur[(mask ^ (1 << k))] + buf[k]); sums[j][mask] = Math.max(sums[j][mask],sumsCur[mask]); }}} int[] d = new int[(1 << n)]; for ( int j = 0;(j < m);j++) {for ( int mask = ((1 << n) - 1);(mask >= 0);mask--) {for ( int submask = mask;(submask > 0);submask = ((submask - 1) & mask)) {d[mask] = Math.max(d[mask],(d[(mask ^ submask)] + sums[j][submask])); }}} int ans = 0; for ( int x :d) {ans = Math.max(ans,x); }out.println(ans); }} } static class FastScanner{ private BufferedReader in ; private StringTokenizer st ; public FastScanner( InputStream stream){ in = new BufferedReader(new InputStreamReader(stream)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
5	public class Main{ public static void main( String[] args)throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(new PrintStream(System.out));  StringTokenizer st = new StringTokenizer(f.readLine());  int n = Integer.parseInt(st.nextToken());  int m = Integer.parseInt(st.nextToken());  long[] arrB = new long[n];  long[] arrG = new long[m]; st = new StringTokenizer(f.readLine()); for ( int i = 0;(i < n);i++) {arrB[i] = Long.parseLong(st.nextToken()); }st = new StringTokenizer(f.readLine()); for ( int j = 0;(j < m);j++) {arrG[j] = Long.parseLong(st.nextToken()); }Arrays.sort(arrB); Arrays.sort(arrG); long ans = 0; for ( int i = 0;(i < n);i++) {ans += (arrB[i] * (long)m); }for ( int i = 1;(i < m);i++) {ans += (arrG[i] - arrB[(n - 1)]); }if ( (arrB[(n - 1)] != arrG[0])) {if ( (n == 1)) {ans = -1; } else {ans += (arrG[0] - arrB[(n - 2)]); }} if ( (arrB[(n - 1)] > arrG[0])) {ans = -1; } System.out.println(ans); f.close(); out.close(); } }
2	public class A{ final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null); BufferedReader in ; PrintWriter out ; StringTokenizer tok = new StringTokenizer(""); void solve()throws IOException { final int mod = (((1000 * 1000) * 1000) + 9);  long n = readInt();  long m = readInt();  long k = readInt();  long fail = (n - m);  long posl = (n / k); if ( ((n % k) != 0)) {posl++; } if ( (posl <= fail)) {out.println(m); } else { long d = (fail - posl);  long res = ((k - 1) * fail); m -= ((k - 1) * fail); long z = (m / k); res += (m % k); res %= mod; long x = binpow(2,(z + 1),mod); x -= 2; x += mod; x %= mod; x *= k; res += x; res %= mod; out.println(res); }} long binpow( long a, long n, long mod){ long res = 1; while((n != 0))if ( ((n & 1) != 0)) {res *= a; res = (res % mod); --n; } else {a *= a; a = (a % mod); n >>= 1; }return res;} void init()throws FileNotFoundException { 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());} long readLong()throws IOException { return Long.parseLong(readString());} public static void main( String[] args){ new A().run(); } 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); } } }
0	public class Main{ public static void main( String[] args)throws java.lang.Exception { Scanner s = new Scanner(System.in);  long n = s.nextLong(); System.out.println(25); } }
5	public class Solution{ static private int[] a ; public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(),m = sc.nextInt(); a = new int[101]; for ( int i = 0;(i < m);i++) { int type = sc.nextInt(); a[type] = (a[type] + 1); } int lo = 1,hi = 100,max = 0; while((lo <= hi)){ int mid = (lo + ((hi - lo) / 2)); if ( check(n,mid)) {max = mid; lo = (mid + 1); } else {hi = (mid - 1); }}System.out.println(max); } public static boolean check( int n, int target){ int result = 0; for ( int i = 0;(i < a.length);i++) {result = (result + (a[i] / target)); }if ( (result >= n)) {return true;} return false;} }
5	public class A{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni(),K = ni();  int[] a = na(n); if ( (K == 1)) {out.println(n); return ;} a = radixSort(a); boolean[] dead = new boolean[n];  int ct = 0; for ( int i = 0;(i < n);i++) {if ( !dead[i]) {ct++; if ( (((long)a[i] * K) <= 1000000000)) { int ind = Arrays.binarySearch(a,(a[i] * K)); if ( (ind >= 0)) {dead[ind] = true; } } } }out.println(ct); } public static int[] radixSort( int[] f){ int[] to = new int[f.length]; { int[] b = new int[65537]; for ( int i = 0;(i < f.length);i++) b[(1 + (f[i] & 0xffff))]++; for ( int i = 1;(i <= 65536);i++) b[i] += b[(i - 1)]; for ( int i = 0;(i < f.length);i++) to[b[(f[i] & 0xffff)]++] = f[i]; int[] d = f; f = to; to = d; }{ int[] b = new int[65537]; for ( int i = 0;(i < f.length);i++) b[(1 + (f[i] >>> 16))]++; for ( int i = 1;(i <= 65536);i++) b[i] += b[(i - 1)]; for ( int i = 0;(i < f.length);i++) to[b[(f[i] >>> 16)]++] = f[i]; int[] d = f; f = to; to = d; }return f;} 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 A().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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
3	public class C{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  int r = in.nextInt();  int x[] = new int[n]; for ( int i = 0;(i < n);i++) {x[i] = in.nextInt(); } double ans[] = new double[n]; ans[0] = r; int index = 1; for ( int i = 1;(i < n);i++) { double maxY = r; for ( int j = 0;(j < index);j++) { int xDist = Math.abs((x[i] - x[j])); if ( (xDist <= (r * 2))) { double cur = (Math.sqrt((((r * 2) * (r * 2)) - (xDist * xDist))) + ans[j]); maxY = Math.max(maxY,cur); } }ans[i] = maxY; index++; }for ( int i = 0;(i < n);i++) {out.print((ans[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());} } }
0	public class Main{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(); System.out.println(((n / 2) * 3)); } }
4	public class D{ static LinkedList<Integer>[] E ; static int[] M ; static boolean[] visited ; static int n ; static int center ; public static boolean match( int x){ if ( visited[x]) return false; visited[x] = true; for ( int y :E[x]) if ( ((y != center) && ((M[y] == -1) || match(M[y])))) {M[y] = x; return true;} return false;} public static int maxMatch(){ int res = 0; Arrays.fill(M,-1); for ( int i = 0;(i < n);i++) {Arrays.fill(visited,false); if ( ((i != center) && match(i))) res++; }return res;} public static void main( String[] args){ InputReader in = new InputReader(System.in); n = in.readInt(); int m = in.readInt(); E = new LinkedList[n]; M = new int[n]; boolean[][] C = new boolean[n][n]; visited = new boolean[n]; for ( int i = 0;(i < n);i++) E[i] = new LinkedList<Integer>(); for ( int i = 0;(i < m);i++) { int x = (in.readInt() - 1);  int y = (in.readInt() - 1); C[x][y] = true; E[x].add(y); } int min = Integer.MAX_VALUE; for ( int i = 0;(i < n);i++) { int res = 0;  int all = 0; for ( int j = 0;(j < n);j++) if ( (j != i)) {all += E[j].size(); if ( !C[i][j]) res++; if ( !C[j][i]) res++; else all--; } if ( !C[i][i]) res++; center = i; int match = maxMatch(); res += ((all - match) + ((n - match) - 1)); min = Math.min(min,res); }System.out.println(min); } } class InputReader{ private InputStream stream ; private byte[] buf = new byte[1000]; private int curChar ,numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read(){ if ( (numChars == -1)) throw (new InputMismatchException()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} public 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);} 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))){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();} }
2	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);  DEhabIEsheOdnaOcherednayaZadachaNaXor solver = new DEhabIEsheOdnaOcherednayaZadachaNaXor(); solver.solve(1,in,out); out.close(); } static class DEhabIEsheOdnaOcherednayaZadachaNaXor{ public void solve( int testNumber, InputReader in, PrintWriter out){ int c = 0;  int d = 0;  int prevSign = 0;  int nextSign ;  boolean zeroOut = true; for ( int i = 29;(i >= 0);i--) {if ( zeroOut) {print(c,d,out); prevSign = read(in); } print(((1 << i) | c),((1 << i) | d),out); nextSign = read(in); if ( (prevSign == nextSign)) {zeroOut = false; print(((1 << i) | c),d,out); nextSign = read(in); if ( (nextSign < 0)) {c = ((1 << i) | c); d = ((1 << i) | d); } } else {zeroOut = true; if ( (nextSign < 0)) c = ((1 << i) | c); else d = ((1 << i) | d); }}out.printf("! %d %d",c,d); out.flush(); } private void print( int c, int d, PrintWriter out){ out.printf("? %d %d\n",c,d); out.flush(); } private int read( InputReader in){ return in.nextInt();} } static class InputReader{ private final BufferedReader reader ; private StringTokenizer tokenizer ; public InputReader( InputStream in){ reader = new BufferedReader(new InputStreamReader(in)); } public int nextInt(){ return Integer.parseInt(next());} public String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(readLine()); }return tokenizer.nextToken();} public String readLine(){ String line ; try{line = reader.readLine(); }catch (IOException e){ throw (new RuntimeException(e));} return line;} } }
4	public class CF1515E extends PrintWriter{ CF1515E(){ super(System.out,true); } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1515E o = new CF1515E(); o.main(); o.flush(); } int[] ff ,gg ; int md ; long ch( int n, int k){ return (((((long)ff[n] * gg[k]) % md) * gg[(n - k)]) % md);} long inv( int a){ return ((a == 1)?1:((inv((a - (md % a))) * ((md / a) + 1)) % md));} void main(){ int n = sc.nextInt(); md = sc.nextInt(); int[] p2 = new int[n]; for ( int p = 1,i = 0;(i < n);i++) {p2[i] = p; p = ((p * 2) % md); }ff = new int[(n + 1)]; gg = new int[(n + 1)]; long f = 1; for ( int i = 0;(i <= n);i++) {gg[i] = (int)inv(ff[i] = (int)f); f = ((f * (i + 1)) % md); } int[][] dp = new int[(n + 1)][(n + 1)]; dp[1][1] = 1; dp[2][2] = 2; for ( int u = 3;(u <= n);u++) for ( int v = 1;(v <= u);v++) { long x = ((v == u)?p2[(u - 1)]:0); for ( int k = 1;((k < v) && (k <= (u - 2)));k++) x += ((((dp[((u - k) - 1)][(v - k)] * ch(v,k)) % md) * p2[(k - 1)]) % md); dp[u][v] = (int)(x % md); } int ans = 0; for ( int v = 1;(v <= n);v++) ans = ((ans + dp[n][v]) % md); println(ans); } }
4	public class C{ int removeSq( int x){ for ( int i = 2;((i * i) <= x);i++) {while(((x % (i * i)) == 0)){x /= (i * i); }}return x;} void submit(){ int n = nextInt();  HashMap<Integer,Integer> map = new HashMap<>(); for ( int i = 0;(i < n);i++) { int x = removeSq(nextInt()); map.merge(x,1,Integer::sum); } int[] a = new int[map.size()];  int ptr = 0; for ( Integer x :map.values()) {a[ptr++] = x; } int ret = go(a); for ( int x :a) {ret = (int)(((long)ret * fact[x]) % P); }out.println(ret); } int go( int[] a){ int[] dp = new int[a[0]]; dp[(a[0] - 1)] = 1; int places = (a[0] + 1);  int toInsert = 0; for ( int x :a) {toInsert += x; }toInsert -= a[0]; for ( int i = 1;(i < a.length);i++) { int here = a[i]; if ( (here == 0)) {continue;} int[] nxt = new int[(dp.length + here)]; for ( int wasSame = 0;(wasSame < dp.length);wasSame++) {if ( (wasSame > toInsert)) {continue;} if ( (dp[wasSame] == 0)) {continue;} int wasDiff = (places - wasSame); for ( int runsSame = 0;((runsSame <= wasSame) && (runsSame <= here));runsSame++) {for ( int runsDiff = 0;((runsDiff <= wasDiff) && ((runsSame + runsDiff) <= here));runsDiff++) {if ( ((runsSame + runsDiff) == 0)) {continue;} int delta = (int)(((((((long)dp[wasSame] * ways[wasSame][runsSame]) % P) * ways[wasDiff][runsDiff]) % P) * ways[(here - 1)][((runsSame + runsDiff) - 1)]) % P); if ( (delta == 0)) {continue;} int nxtIdx = ((wasSame - runsSame) + ((here - runsSame) - runsDiff)); nxt[nxtIdx] += delta; if ( (nxt[nxtIdx] >= P)) {nxt[nxtIdx] -= P; } }}}dp = nxt; places += here; toInsert -= here; }return dp[0];} int[][] ways ; int[] fact ; static final int N = 350; static final int P = 1_000_000_007; void preCalc(){ ways = new int[N][]; for ( int i = 0;(i < N);i++) {ways[i] = new int[(i + 1)]; ways[i][0] = ways[i][i] = 1; for ( int j = 1;(j < i);j++) {ways[i][j] = (ways[(i - 1)][j] + ways[(i - 1)][(j - 1)]); if ( (ways[i][j] >= P)) {ways[i][j] -= P; } }}fact = new int[N]; fact[0] = 1; for ( int i = 1;(i < N);i++) {fact[i] = (int)(((long)fact[(i - 1)] * i) % P); }} C()throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); preCalc(); submit(); out.close(); } static final Random rng = new Random(); public static void main( String[] args)throws IOException { new C(); } BufferedReader br ; PrintWriter out ; StringTokenizer st ; String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} int nextInt(){ return Integer.parseInt(nextToken());} }
6	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{ int n ; int[] bitCount ; long neededSum ; long[] sums ; Map<Long,Integer> where ; public void solve( int testNumber, FastScanner in, PrintWriter out){ n = in.nextInt(); int[][] a = new int[n][]; neededSum = 0; sums = new long[n]; for ( int i = 0;(i < n);i++) { int k = in.nextInt(); a[i] = new int[k]; for ( int j = 0;(j < k);j++) {a[i][j] = in.nextInt(); neededSum += a[i][j]; sums[i] += a[i][j]; }}if ( ((neededSum % n) != 0)) {out.println("No"); return ;} neededSum /= n; where = new HashMap<>(); for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < a[i].length);j++) {where.put((long)a[i][j],i); }}bitCount = new int[(1 << n)]; for ( int i = 0;(i < bitCount.length);i++) {bitCount[i] = Integer.bitCount(i); } Entry[][] cycleSol = new Entry[(1 << n)][];  List<Entry> sol = new ArrayList<>(); for ( int i = 0;(i < n);i++) {for ( int x :a[i]) {search(i,i,x,x,0,0,sol,cycleSol); }} boolean[] can = new boolean[(1 << n)];  int[] via = new int[(1 << n)]; can[0] = true; for ( int mask = 0;(mask < (1 << n));mask++) {for ( int submask = mask;(submask > 0);submask = ((submask - 1) & mask)) {if ( ((cycleSol[submask] != null) && can[(mask ^ submask)])) {can[mask] = true; via[mask] = submask; } }}if ( !can[((1 << n) - 1)]) {out.println("No"); return ;} int[][] ans = new int[n][2]; for ( int mask = ((1 << n) - 1);(mask > 0);) { int sm = via[mask]; mask ^= sm; for ( Entry e :cycleSol[sm]) {ans[e.from][0] = e.what; ans[e.from][1] = (e.to + 1); }}out.println("Yes"); for ( int i = 0;(i < n);i++) {out.println(((ans[i][0] + " ") + ans[i][1])); }} private void search( int start, int cur, long fromStart, long fromCur, int hasIn, int hasOut, List<Entry> sol, Entry[][] cycleSol){ for ( int i = 0;(i < n);i++) {if ( ((hasIn & (1 << i)) > 0)) {continue;} if ( ((hasOut & (1 << cur)) > 0)) {continue;} long fromI = ((sums[i] + fromCur) - neededSum);  Integer w = where.get(fromI); if ( ((w == null) || (w != i))) {continue;} sol.add(new Entry(cur,i,(int)fromCur)); int nHasIn = (hasIn | (1 << i));  int nHasOut = (hasOut | (1 << cur)); if ( ((i == start) && (fromI == fromStart))) {cycleSol[nHasOut] = sol.toArray(new Entry[0]); } search(start,i,fromStart,fromI,nHasIn,nHasOut,sol,cycleSol); sol.remove((sol.size() - 1)); }} class Entry{ int from ; int to ; int what ; Entry( int from, int to, int what){ this.from = from; this.to = to; this.what = what; } } } static class FastScanner{ private BufferedReader in ; private StringTokenizer st ; public FastScanner( InputStream stream){ in = new BufferedReader(new InputStreamReader(stream)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{ String rl = in.readLine(); if ( (rl == null)) {return null;} st = new StringTokenizer(rl); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
6	public class C{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni();  int[][] a = new int[n][];  Map<Long,Long> ci = new HashMap<>();  long[] sums = new long[n]; for ( int i = 0;(i < n);i++) { int K = ni(); a[i] = na(K); for ( int j = 0;(j < K);j++) {ci.put((long)a[i][j],(((long)i << 32) | j)); sums[i] += a[i][j]; }} long S = 0; for ( long v :sums) {S += v; }if ( ((S % n) != 0)) {out.println("No"); return ;} S /= n; int[] offsets = new int[(n + 1)]; for ( int i = 0;(i < n);i++) {offsets[(i + 1)] = (offsets[i] + a[i].length); } int m = offsets[n];  int[] f = new int[m]; Arrays.fill(f,-1); for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < a[i].length);j++) { long T = ((a[i][j] + S) - sums[i]); if ( ci.containsKey(T)) { long code = ci.get(T);  int from = (offsets[i] + j);  int to = (offsets[(int)(code >>> 32)] + (int)code); if ( ((from != to) && (i == (int)(code >>> 32)))) continue; f[from] = to; } }} int[][] cs = getCycles(f);  int[][] zcs = new int[(1 << n)][]; for ( int[] c :cs) { int ptn = 0; for ( int k :c) { int ind = Arrays.binarySearch(offsets,k); if ( (ind < 0)) ind = (-ind - 2); ptn |= (1 << ind); }if ( (Integer.bitCount(ptn) != c.length)) continue; zcs[ptn] = c; } boolean[] dp = new boolean[(1 << n)]; dp[0] = true; for ( int i = 1;(i < (1 << n));i++) {if ( (zcs[i] != null)) { int mask = (((1 << n) - 1) ^ i); for ( int j = mask;(j >= 0);j--) {j &= mask; dp[(i | j)] |= dp[j]; }} }if ( dp[((1 << n) - 1)]) { int[] vals = new int[n];  int[] tos = new int[n];  int cur = ((1 << n) - 1); inner:while((cur > 0)){for ( int k = cur;(k >= 0);k--) {k &= cur; if ( (dp[(cur ^ k)] && (zcs[k] != null))) {for ( int l = 0;(l < zcs[k].length);l++) { int nl = (((l + zcs[k].length) - 1) % zcs[k].length);  int fclus = Arrays.binarySearch(offsets,zcs[k][l]);  int tclus = Arrays.binarySearch(offsets,zcs[k][nl]); if ( (fclus < 0)) fclus = (-fclus - 2); if ( (tclus < 0)) tclus = (-tclus - 2);  int val = a[fclus][(zcs[k][l] - offsets[fclus])]; vals[fclus] = val; tos[fclus] = tclus; }cur ^= k; continue inner;} }}out.println("Yes"); for ( int i = 0;(i < n);i++) {out.println(((vals[i] + " ") + (tos[i] + 1))); }} else {out.println("No"); }} int[][] getCycles( int[] f){ int n = f.length;  int[][] ret = new int[n][];  boolean[] ved = new boolean[n];  int[] touched = new int[n]; Arrays.fill(touched,-1); int[] path = new int[n];  int q = 0; for ( int i = 0;(i < n);i++) { int p = 0; for ( int j = i;(j != -1);j = f[j]) {if ( (touched[j] != -1)) {ret[q++] = Arrays.copyOfRange(path,touched[j],p); break;} if ( ved[j]) break; touched[j] = p; path[p++] = j; ved[j] = true; }for ( int k = 0;(k < p);k++) {touched[path[k]] = -1; }}return Arrays.copyOf(ret,q);} 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 C().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
4	public class CF1185G2{ static final int MD = 1000000007; static int[][] solve1( int[] aa, int t, int n){ int[][] da = new int[(t + 1)][(n + 1)]; da[0][0] = 1; for ( int i = 0;(i < n);i++) { int a = aa[i]; for ( int s = (t - 1);(s >= 0);s--) for ( int m = 0;(m < n);m++) { int x = da[s][m]; if ( (x != 0)) { int s_ = (s + a); if ( (s_ <= t)) da[s_][(m + 1)] = ((da[s_][(m + 1)] + x) % MD); } }}return da;} static int[][][] solve2( int[] aa, int[] bb, int t, int na, int nb){ int[][] da = solve1(aa,t,na);  int[][][] dab = new int[(t + 1)][(na + 1)][(nb + 1)]; for ( int s = 0;(s <= t);s++) for ( int ma = 0;(ma <= na);ma++) dab[s][ma][0] = da[s][ma]; for ( int i = 0;(i < nb);i++) { int b = bb[i]; for ( int s = (t - 1);(s >= 0);s--) for ( int ma = 0;(ma <= na);ma++) for ( int mb = 0;(mb < nb);mb++) { int x = dab[s][ma][mb]; if ( (x != 0)) { int s_ = (s + b); if ( (s_ <= t)) dab[s_][ma][(mb + 1)] = ((dab[s_][ma][(mb + 1)] + x) % MD); } }}return dab;} static int[][][] init( int n, int na, int nb, int nc){ int[][][] dp = new int[(na + 1)][(nb + 1)][(nc + 1)];  int[][][][] dq = new int[(na + 1)][(nb + 1)][(nc + 1)][3]; for ( int ma = 0;(ma <= na);ma++) for ( int mb = 0;(mb <= nb);mb++) for ( int mc = 0;(mc <= nc);mc++) if ( (((ma == 0) && (mb == 0)) && (mc == 0))) {dp[ma][mb][mc] = 1; dq[ma][mb][mc][0] = dq[ma][mb][mc][1] = dq[ma][mb][mc][2] = 1; } else { int x0 = ((ma > 0)?(int)(((long)dq[(ma - 1)][mb][mc][0] * ma) % MD):0);  int x1 = ((mb > 0)?(int)(((long)dq[ma][(mb - 1)][mc][1] * mb) % MD):0);  int x2 = ((mc > 0)?(int)(((long)dq[ma][mb][(mc - 1)][2] * mc) % MD):0); dp[ma][mb][mc] = (int)((((long)x0 + x1) + x2) % MD); dq[ma][mb][mc][0] = ((x1 + x2) % MD); dq[ma][mb][mc][1] = ((x2 + x0) % MD); dq[ma][mb][mc][2] = ((x0 + x1) % MD); }return dp;} public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int t = Integer.parseInt(st.nextToken());  int[] aa = new int[n];  int[] bb = new int[n];  int[] cc = new int[n];  int na = 0,nb = 0,nc = 0; for ( int i = 0;(i < n);i++) {st = new StringTokenizer(br.readLine()); int a = Integer.parseInt(st.nextToken());  int g = Integer.parseInt(st.nextToken()); if ( (g == 1)) aa[na++] = a; else if ( (g == 2)) bb[nb++] = a; else cc[nc++] = a; } int[][][] dp = init(n,na,nb,nc);  int[][][] dab = solve2(aa,bb,t,na,nb);  int[][] dc = solve1(cc,t,nc);  int ans = 0; for ( int tab = 0;(tab <= t);tab++) { int tc = (t - tab); for ( int ma = 0;(ma <= na);ma++) for ( int mb = 0;(mb <= nb);mb++) { int xab = dab[tab][ma][mb]; if ( (xab == 0)) continue; for ( int mc = 0;(mc <= nc);mc++) { int xc = dc[tc][mc]; if ( (xc == 0)) continue; ans = (int)((ans + ((((long)xab * xc) % MD) * dp[ma][mb][mc])) % MD); }}}System.out.println(ans); } }
3	public class helloWorld{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  int m = in.nextInt();  int l = 1000,r = 0,u = 1000,b = 0; for ( int i = 0;(i < n);i++) { String str = in.next(); for ( int j = 0;(j < m);j++) if ( (str.charAt(j) == 'B')) {l = Math.min((j + 1),l); r = Math.max((j + 1),r); u = Math.min((i + 1),u); b = Math.max((i + 1),b); } }System.out.println(((((u + b) / 2) + " ") + ((l + r) / 2))); in.close(); } }
2	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); new TaskC().solve(in,out); out.close(); } } class TaskC{ static final long mod = 1000000009; public void solve( InputReader in, PrintWriter out){ int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int l = 0,r = (m / k); while((l < r)){ int mid = ((l + r) >>> 1); if ( good(n,m,k,mid)) {r = mid; } else {l = (mid + 1); }} Mat u = new Mat(); u.set(k,1,0,0); Mat v = new Mat(); v.set(2,0,k,1); u = u.mul(v.powMat(l)); out.println(((((u.e[0][0] - k) + (m - (l * k))) + mod) % mod)); } private boolean good( int n, int m, int k, int mid){ n -= (mid * k); m -= (mid * k); int ans = (((n / k) * (k - 1)) + (n % k)); if ( (ans >= m)) return true; return false;} static private class Mat{ long[][] e = new long[2][2]; Mat mul( Mat u){ Mat s = new Mat(); s.set(0,0,0,0); for ( int i = 0;(i < 2);i++) {for ( int j = 0;(j < 2);j++) {for ( int k = 0;(k < 2);k++) {s.e[i][j] = ((s.e[i][j] + (e[i][k] * u.e[k][j])) % mod); }}}return s;} Mat powMat( int k){ Mat u = this;  Mat s = new Mat(); s.set(1,0,0,1); while((k != 0)){if ( ((k % 2) == 1)) {s = s.mul(u); } u = u.mul(u); k /= 2; }return s;} void set( long i, long j, long k, long l){ e[0][0] = i; e[0][1] = j; e[1][0] = k; e[1][1] = l; } } } 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());} }
2	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);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ int[][] dr = new int[][]{{0,0,0,-1},{0,0,-1,0},{0,1,0,0},{1,0,0,0}}; int[][] dd = new int[][]{{1,3},{0,2},{1,3},{0,2}}; PrintWriter out ; InputReader in ; int[] re1 ; int[] re2 ; int N ; public void solve( int testNumber, InputReader in, PrintWriter out){ N = in.nextInt(); int r[] = new int[]{1,1,N,N}; this.out = out; this.in = in; re1 = new int[]{1,1,1,1}; re2 = new int[]{2,1,2,1}; int fr[] = moveSide(r,dr[2],dd[2]);  int sr[] = subtract(r,fr); if ( !validSeparation(sr)) {fr = moveSide(r,dr[1],dd[1]); sr = subtract(r,fr); } fr = boundary(fr); sr = boundary(sr); out.println(String.format("! %d %d %d %d %d %d %d %d",fr[0],fr[1],fr[2],fr[3],sr[0],sr[1],sr[2],sr[3])); } private boolean validSeparation( int[] sr){ if ( !validRectangle(sr)) return false; out.println(String.format("? %d %d %d %d",sr[0],sr[1],sr[2],sr[3])); out.flush(); return (in.nextInt() == 1);} private boolean validRectangle( int[] sr){ for ( int i = 0;(i < 4);i++) {if ( ((sr[i] < 1) || (sr[i] > N))) return false; }return true;} private int[] boundary( int[] r){ for ( int d = 0;(d < 4);d++) {r = moveSide(r,dr[d],dd[d]); }return r;} private int[] subtract(final int[] r,final int[] fr){ if ( (r[1] == fr[1])) {return new int[]{(fr[2] + 1),r[1],r[2],r[3]};} return new int[]{r[0],r[1],r[2],(fr[1] - 1)};} private int[] moveSide(final int[] rect,final int[] factors,final int[] widths){ int width = Math.abs((rect[widths[0]] - rect[widths[1]]));  int lo = -1,hi = (width + 1); while(((lo + 1) < hi)){ int m = (lo + ((hi - lo) / 2));  int qr[] = new int[4]; for ( int d = 0;(d < 4);d++) qr[d] = (rect[d] + (factors[d] * m)); int ans = query(qr); if ( (ans != 0)) {lo = m; } else {hi = m; }} int ans_rect[] = new int[4]; for ( int d = 0;(d < 4);d++) ans_rect[d] = (rect[d] + (factors[d] * lo)); return ans_rect;} private int query(final int[] qr){ int ans = 0; out.println(String.format("? %d %d %d %d",qr[0],qr[1],qr[2],qr[3])); out.flush(); ans = in.nextInt(); return ans;} } 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());} } }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,kk ,bb ; int[] uu ,vv ,uv ,cost ,cost_ ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; kk = new int[n_]; bb = new int[n_]; uu = new int[m_]; vv = new int[m_]; uv = new int[m_]; cost = new int[m_]; cost_ = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; uv[h] = (u ^ v); cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } void dijkstra( int s){ Arrays.fill(pi,INF); pi[s] = 0; TreeSet<Integer> pq = new TreeSet<>((u,v)->((pi[u] != pi[v])?(pi[u] - pi[v]):((kk[u] != kk[v])?(kk[u] - kk[v]):(u - v)))); pq.add(s); Integer first ; while(((first = pq.pollFirst()) != null)){ int u = first;  int k = (kk[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost_[h]:-cost_[h]));  int v = (u ^ uv[h]); if ( ((pi[v] > p) || ((pi[v] == p) && (kk[v] > k)))) {if ( (pi[v] < INF)) pq.remove(v); pi[v] = p; kk[v] = k; bb[v] = h_; pq.add(v); } } }} void push( int s, int t){ int c = INF; for ( int u = t,h_ ,h ;(u != s);u ^= uv[h]) {h = ((h_ = bb[u]) >> 1); c = Math.min(c,cc[h_]); }for ( int u = t,h_ ,h ;(u != s);u ^= uv[h]) {h = ((h_ = bb[u]) >> 1); cc[h_] -= c; cc[(h_ ^ 1)] += c; }} int edmonds_karp( int s, int t){ System.arraycopy(cost,0,cost_,0,m_); while(true){dijkstra(s); if ( (pi[t] == INF)) break; push(s,t); for ( int h = 0;(h < m_);h++) { int u = uu[h],v = vv[h]; if ( ((pi[u] != INF) && (pi[v] != INF))) cost_[h] += (pi[u] - pi[v]); }} int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
0	public class Main{ long n ; long maxlcm ; void run(){ n = cin.nextInt(); if ( ((n == 1) || (n == 2))) maxlcm = n; else if ( (n >= 3)) {if ( ((n % 2) != 0)) {maxlcm = ((n * (n - 1)) * (n - 2)); } else if ( ((n % 3) != 0)) maxlcm = ((n * (n - 1)) * (n - 3)); else maxlcm = (((n - 1) * (n - 2)) * (n - 3)); } System.out.println(maxlcm); } public static void main( String[] args){ new Main().run(); } Scanner cin = new Scanner(new BufferedInputStream(System.in)); }
3	public class Main{ public static void main( String[] args)throws FileNotFoundException { ConsoleIO io = new ConsoleIO(new InputStreamReader(System.in),new PrintWriter(System.out)); new Main(io).solve(); io.close(); } ConsoleIO io ; Main( ConsoleIO io){ this.io = io; } List<List<Integer>> gr = new ArrayList<>(); long MOD = 1_000_000_007; public void solve(){ int n = io.ri(),r = io.ri();  double[] res = new double[n];  int[] xs = new int[n]; for ( int i = 0;(i < n);i++) { int x = io.ri(); xs[i] = x; double max = r; for ( int j = 0;(j < i);j++) { int dx = Math.abs((xs[j] - x));  int dx2 = (dx * dx); if ( (dx <= (2 * r))) {max = Math.max(max,(Math.sqrt((((4 * r) * r) - dx2)) + res[j])); } }res[i] = max; } StringBuilder sb = new StringBuilder(); for ( int i = 0;(i < res.length);i++) {if ( (i > 0)) sb.append(' '); sb.append(res[i]); }io.writeLine(sb.toString()); } } class ConsoleIO{ BufferedReader br ; PrintWriter out ; public ConsoleIO( Reader reader, PrintWriter writer){ br = new BufferedReader(reader); out = writer; } public void flush(){ this.out.flush(); } public void close(){ this.out.close(); } public void writeLine( String s){ this.out.println(s); } public int read( char[] buf, int len){ try{return br.read(buf,0,len); }catch (Exception ex){ return -1;} } public String readLine(){ try{return br.readLine(); }catch (Exception ex){ return "";} } public int ri(){ try{ int r = 0;  boolean start = false;  boolean neg = false; while(true){ int c = br.read(); if ( ((c >= '0') && (c <= '9'))) {r = (((r * 10) + c) - '0'); start = true; } else if ( (!start && (c == '-'))) {start = true; neg = true; } else if ( (start || (c == -1))) return (neg?-r:r); } }catch (Exception ex){ return -1;} } }
3	public class Main{ static private int REM = 1000000007; static private int dig ; static private int[][][] dp = new int[701][701][2]; public static void main( String[] args){ Scanner in = new Scanner(System.in);  String X = in.next();  int N = X.length();  int[] P = new int[701]; P[0] = 1; for ( int i = 1;(i < P.length);++i) {P[i] = (int)(((long)P[(i - 1)] * 10) % REM); } int ans = 0; for ( int d = 1;(d <= 9);++d) {dig = d; for ( int[][] array2 :dp) {for ( int[] array1 :array2) {Arrays.fill(array1,-1); }}for ( int c = 1;(c <= N);++c) {for ( int k = 0;(k < c);++k) {ans = (int)((ans + ((long)f(0,c,false,X) * P[k])) % REM); }}}System.out.println(ans); } static private int f( int ps, int needed, boolean less,final String X){ if ( (needed < 0)) {return 0;} if ( (dp[ps][needed][(less?0:1)] != -1)) {return dp[ps][needed][(less?0:1)];} if ( (ps == X.length())) {if ( (needed == 0)) {return 1;} return 0;} int dg = (X.charAt(ps) - '0');  int ans = 0; for ( int d = 0;(d <= 9);++d) {if ( (!less && (d > dg))) {continue;} boolean nless = (less || (d < dg)); ans = (int)((ans + (long)f((ps + 1),(needed - ((d >= dig)?1:0)),nless,X)) % REM); }dp[ps][needed][(less?0:1)] = ans; return ans;} }
6	public class Main{ static double EPS = 1e-10; static double PI = Math.acos(-1.0); static double p[][] = new double[25][25]; static double f[] = new double[(1 << 20)]; static int n ; public static void PR( String s){ System.out.print(s); } public static void PR( double s){ java.text.DecimalFormat d = new java.text.DecimalFormat("#.0000000"); System.out.print(d.format(s)); } public static void DP(){ int i ,j ,k ,cnt ; for ( i = 0;(i < (1 << n));i++) f[i] = 0; f[((1 << n) - 1)] = 1; for ( k = ((1 << n) - 1);(k >= 0);k--) {cnt = 0; for ( i = 0;(i < n);i++) if ( ((k & (1 << i)) != 0)) cnt++; for ( i = 0;(i < n);i++) if ( ((k & (1 << i)) != 0)) {for ( j = 0;(j < n);j++) if ( ((i != j) && ((k & (1 << j)) != 0))) {f[(k ^ (1 << j))] += ((f[k] * p[i][j]) / (((cnt - 1) * cnt) / 2)); } } }} public static void main( String[] args){ Scanner S = new Scanner(System.in); while(S.hasNext()){n = S.nextInt(); int i ,j ; for ( i = 0;(i < n);i++) for ( j = 0;(j < n);j++) p[i][j] = S.nextDouble(); DP(); for ( i = 0;(i < n);i++) {if ( (i != 0)) PR(" "); PR(f[(1 << i)]); }PR("\n"); }} }
6	public class B{ public static void main( String[] args){ new B(new FastScanner()); } int hash( int i, int[] cc){ int res = i; for ( int ii :cc) {res *= 8; res += ii; }return res;} int N ,K ,A ; int[] lvl ; int[] vs ; double calc( int i, int[] cc){ double res = 0;  int cnt = 0; for ( int m = 0;(m < (1 << N));m++) { double pt = 1.0;  boolean passed = true;  int nG = 0;  int lvlcnt = 0; for ( int j = 0;(j < N);j++) { int p = ((10 * cc[j]) + vs[j]);  int u = (m & (1 << j));  boolean votesGood = (u > 0); if ( votesGood) nG++; else lvlcnt += lvl[j]; if ( ((p == 0) && votesGood)) passed = false; if ( ((p == 100) && votesGood)) passed = false; if ( !passed) break; if ( votesGood) pt *= (p / 100.0); else pt *= ((100 - p) / 100.0); }if ( (passed == false)) continue; if ( ((2 * nG) <= N)) { double p1 = (A / (1.0 * (A + lvlcnt))); res += ((1 - p1) * pt); } }return (1.0 - res);} HashMap<Integer,Double> memo ; double go( int i, int[] cc){ if ( (i == -1)) return calc(i,cc); int hv = hash(i,cc);  Double rr = memo.get(hv); if ( (rr != null)) return rr; double res = go((i - 1),cc); for ( int j = 0;(j < N);j++) { int cv = (vs[j] + (cc[j] * 10)); if ( (cv == 100)) continue; cc[j]++; double rrr = go((i - 1),cc); cc[j]--; if ( (rrr > res)) res = rrr; }memo.put(hv,res); return res;} public B( FastScanner in){ N = in.nextInt(); K = in.nextInt(); A = in.nextInt(); memo = new HashMap<Integer,Double>(); lvl = new int[N]; vs = new int[N]; for ( int i = 0;(i < N);i++) {lvl[i] = in.nextInt(); vs[i] = in.nextInt(); } int[] cs = new int[8];  double res = go((K - 1),cs); System.out.printf("%.10f%n",res); } } class FastScanner{ int nextInt(){ try{ int c = System.in.read(); if ( (c == -1)) return c; while(((c != '-') && ((c < '0') || ('9' < c)))){c = System.in.read(); if ( (c == -1)) return c; }if ( (c == '-')) return -nextInt(); int res = 0; do {res *= 10; res += (c - '0'); c = System.in.read(); }while((('0' <= c) && (c <= '9')));return res; }catch (Exception e){ return -1;} } long nextLong(){ try{ int c = System.in.read(); if ( (c == -1)) return -1; while(((c != '-') && ((c < '0') || ('9' < c)))){c = System.in.read(); if ( (c == -1)) return -1; }if ( (c == '-')) return -nextLong(); long res = 0; do {res *= 10; res += (c - '0'); c = System.in.read(); }while((('0' <= c) && (c <= '9')));return res; }catch (Exception e){ return -1;} } String next(){ try{ StringBuilder res = new StringBuilder("");  int c = System.in.read(); while(Character.isWhitespace(c))c = System.in.read(); do {res.append((char)c); }while(!Character.isWhitespace(c = System.in.read()));return res.toString(); }catch (Exception e){ return null;} } }
5	public class A{ static int[] parent ; public static int find( int x){ if ( (x == parent[x])) return x; return parent[x] = find(parent[x]);} public static void union( int x, int y){ int px = find(x);  int py = find(y); if ( (px != py)) {parent[py] = px; } } public static void main( String[] args)throws Exception { int numCnt = (int)nextLong();  long k = nextLong(); parent = new int[numCnt]; for ( int i = 0;(i < parent.length);i++) {parent[i] = i; } HashMap<Long,Integer> map = new HashMap<Long,Integer>();  long[] ar = new long[numCnt]; for ( int i = 0;(i < numCnt);i++) {ar[i] = nextLong(); map.put(((ar[i] * 10007) + (ar[i] / 13)),i); }for ( int i = 0;(i < ar.length);i++) { long req = (ar[i] * k);  Integer idx = map.get(((req * 10007) + (req / 13))); if ( (idx != null)) {union(i,idx); } } int[] count = new int[numCnt]; for ( int i = 0;(i < parent.length);i++) {count[find(i)]++; } int res = 0; for ( int i = 0;(i < numCnt);i++) {res += (int)((count[i] + 1) / 2.0); }System.out.println(res); } static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static StringTokenizer tokenizer = new StringTokenizer(""); static long nextLong()throws Exception { return Long.parseLong(next());} static String next()throws Exception { while(true){if ( tokenizer.hasMoreTokens()) {return tokenizer.nextToken();} String s = br.readLine(); if ( (s == null)) {return null;} tokenizer = new StringTokenizer(s); }} }
0	public class A{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  int a = (n / 2);  int b = ((n / 2) + (n % 2)); if ( ((((a % 2) != 0) && ((a % 3) != 0)) || (((b % 2) != 0) && ((b % 3) != 0)))) {a--; b++; } if ( ((((a % 2) != 0) && ((a % 3) != 0)) || (((b % 2) != 0) && ((b % 3) != 0)))) {a--; b++; } System.out.println(((a + " ") + b)); } }
6	public class E implements Runnable{ public static void main( String[] args)throws IOException { new Thread(null,new E(),"",(1 << 20)).start(); } BufferedReader input ; PrintWriter out ; String file = "input"; void solve()throws IOException { int n = Integer.parseInt(input.readLine());  double[][] p = new double[n][n]; for ( int i = 0;(i < n);i++) { StringTokenizer st = new StringTokenizer(input.readLine()); for ( int j = 0;(j < n);j++) {p[i][j] = Double.parseDouble(st.nextToken()); }} double[] dp = new double[(1 << n)];  int mask = ((1 << n) - 1); dp[mask] = 1; for ( int w = mask;(w > 0);w--) { int count = 0; for ( int i = 0;(i < n);i++) for ( int j = (i + 1);(j < n);j++) if ( ((((w >> i) & 1) != 0) && (((w >> j) & 1) != 0))) count++; if ( (count == 0)) continue; for ( int i = 0;(i < n);i++) for ( int j = (i + 1);(j < n);j++) if ( ((((w >> i) & 1) != 0) && (((w >> j) & 1) != 0))) {dp[(w ^ (1 << i))] += (((1.0 / count) * p[j][i]) * dp[w]); dp[(w ^ (1 << j))] += (((1.0 / count) * p[i][j]) * dp[w]); } }for ( int i = 0;(i < n);i++) System.out.print((dp[(1 << i)] + " ")); } }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ public void solve( int testNumber, InputReader in, OutputWriter out){ int n = in.readInt();  int r = in.readInt();  int[] x = IOUtils.readIntArray(in,n);  double[] y = new double[n]; for ( int idx = 0;(idx < x.length);idx++) { double yRes = r; for ( int prev = 0;(prev < idx);prev++) { int xDelta = Math.abs((x[idx] - x[prev])); if ( (xDelta <= (2 * r))) { double yDelta = calcDelta(xDelta,r); yRes = Math.max(yRes,(y[prev] + yDelta)); } }y[idx] = yRes; }out.printLine(y); } private double calcDelta( int xDelta, int r){ return Math.sqrt((((4 * r) * r) - (xDelta * xDelta)));} } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( double[] array){ for ( int i = 0;(i < array.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(array[i]); }} public void printLine( double[] array){ print(array); writer.println(); } public void close(){ writer.close(); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputReader.SpaceCharFilter filter ; 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 boolean isSpaceChar( int c){ if ( (filter != null)) {return filter.isSpaceChar(c);} return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  int r = in.nextInt();  int[] x = in.readIntArray(n);  double[] y = new double[n]; for ( int i = 0;(i < n);i++) {y[i] = r; for ( int j = 0;(j < i);j++) { double d = Math.abs((x[j] - x[i])); if ( (d <= (2 * r))) { double yy = Math.sqrt((((4.0 * r) * r) - (d * d))); y[i] = Math.max(y[i],(y[j] + yy)); } }}for ( int i = 0;(i < n);i++) {out.print((y[i] + " ")); }} } static class InputReader{ static private BufferedReader in ; static private StringTokenizer tok ; public InputReader( InputStream in){ this.in = new BufferedReader(new InputStreamReader(in)); } public int nextInt(){ return Integer.parseInt(next());} public int[] readIntArray( int n){ int[] ar = new int[n]; for ( int i = 0;(i < n);i++) {ar[i] = nextInt(); }return ar;} public String next(){ try{while(((tok == null) || !tok.hasMoreTokens())){tok = new StringTokenizer(in.readLine()); } }catch (IOException ex){ System.err.println(("An IOException was caught :" + ex.getMessage())); } return tok.nextToken();} } }
4	public class E3{ InputStream is ; FastWriter out ; String INPUT = ""; void solve(){ for ( int T = ni();(T > 0);T--) go(); } int[] lpf = enumLowestPrimeFactors(10000000); void go(){ int n = ni(),K = ni();  int[] a = na(n); for ( int i = 0;(i < n);i++) {a[i] = factorFast(a[i],lpf); }a = shrink(a); int[][] dp = new int[(K + 1)][(n + 1)]; for ( int i = 0;(i <= K);i++) {Arrays.fill(dp[i],999999999); }for ( int i = 0;(i <= K);i++) dp[i][0] = 0; int[] prev = makePrev(a,(n + 1));  int[] imos = new int[(n + 5)];  int[] pp = new int[(K + 1)];  int[] vs = new int[(K + 1)]; for ( int i = 0;(i < n);i++) { int p = prev[i]; imos[(p + 1)]--; for ( int j = 0;(j <= K);j++) {vs[j]++; if ( (pp[j] >= (p + 1))) {vs[j]--; } while((vs[j] > j)){pp[j]++; vs[j] += imos[pp[j]]; }for ( int k = 0;((k + j) <= K);k++) {dp[(k + j)][(i + 1)] = Math.min(dp[(k + j)][(i + 1)],(dp[k][pp[j]] + 1)); }}}out.println(dp[K][n]); } public static int[] shrink( int[] a){ int n = a.length;  long[] b = new long[n]; for ( int i = 0;(i < n);i++) b[i] = (((long)a[i] << 32) | i); Arrays.sort(b); int[] ret = new int[n];  int p = 0; for ( int i = 0;(i < n);i++) {if ( ((i > 0) && (((b[i] ^ b[(i - 1)]) >> 32) != 0))) p++; ret[(int)b[i]] = p; }return ret;} public static int[] makePrev( int[] a, int sup){ int n = a.length;  int[] mnext = new int[sup]; Arrays.fill(mnext,-1); int[] next = new int[n]; for ( int i = 0;(i < n);i++) {next[i] = mnext[a[i]]; mnext[a[i]] = i; }return next;} public static int factorFast( int n, int[] lpf){ int ret = 1;  int e = 0;  int last = -1; while((lpf[n] > 0)){ int p = lpf[n]; if ( (last != p)) {if ( ((last > 0) && ((e % 2) == 1))) {ret = (ret * last); } last = p; e = 1; } else {e++; }n /= p; }if ( ((last > 0) && ((e % 2) == 1))) {ret *= last; } return ret;} public static int[] enumLowestPrimeFactors( int n){ int tot = 0;  int[] lpf = new int[(n + 1)];  int u = (n + 32);  double lu = Math.log(u);  int[] primes = new int[(int)((u / lu) + (((u / lu) / lu) * 1.5))]; for ( int i = 2;(i <= n);i++) lpf[i] = i; for ( int p = 2;(p <= n);p++) {if ( (lpf[p] == p)) primes[tot++] = p;  int tmp ; for ( int i = 0;(((i < tot) && (primes[i] <= lpf[p])) && ((tmp = (primes[i] * p)) <= n));i++) {lpf[tmp] = primes[i]; }}return lpf;} void run()throws Exception { is = (oj?System.in:new ByteArrayInputStream(INPUT.getBytes())); out = new FastWriter(System.out); long s = System.currentTimeMillis(); solve(); out.flush(); tr(((System.currentTimeMillis() - s) + "ms")); } public static void main( String[] args)throws Exception { new E3().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 int[] na( int n){ int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = ni(); return a;} private int ni(){ return (int)nl();} 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(); }} public static class FastWriter{ static private final int BUF_SIZE = (1 << 13); private final byte[] buf = new byte[BUF_SIZE]; private final OutputStream out ; private int ptr = 0; private FastWriter(){ out = null; } public FastWriter( OutputStream os){ this.out = os; } public FastWriter( String path){ try{this.out = new FileOutputStream(path); }catch (FileNotFoundException e){ throw (new RuntimeException("FastWriter"));} } public FastWriter write( byte b){ buf[ptr++] = b; if ( (ptr == BUF_SIZE)) innerflush(); return this;} public FastWriter write( char c){ return write((byte)c);} public FastWriter write( char[] s){ for ( char c :s) {buf[ptr++] = (byte)c; if ( (ptr == BUF_SIZE)) innerflush(); }return this;} public FastWriter write( String s){ s.chars().forEach((c)->{buf[ptr++] = (byte)c; if ( (ptr == BUF_SIZE)) innerflush(); }); return this;} static private int countDigits( int l){ if ( (l >= 1000000000)) return 10; if ( (l >= 100000000)) return 9; if ( (l >= 10000000)) return 8; if ( (l >= 1000000)) return 7; if ( (l >= 100000)) return 6; if ( (l >= 10000)) return 5; if ( (l >= 1000)) return 4; if ( (l >= 100)) return 3; if ( (l >= 10)) return 2; return 1;} public FastWriter write( int x){ if ( (x == Integer.MIN_VALUE)) {return write((long)x);} if ( ((ptr + 12) >= BUF_SIZE)) innerflush(); if ( (x < 0)) {write((byte)'-'); x = -x; } int d = countDigits(x); for ( int i = ((ptr + d) - 1);(i >= ptr);i--) {buf[i] = (byte)('0' + (x % 10)); x /= 10; }ptr += d; return this;} static private int countDigits( long l){ if ( (l >= 1000000000000000000L)) return 19; if ( (l >= 100000000000000000L)) return 18; if ( (l >= 10000000000000000L)) return 17; if ( (l >= 1000000000000000L)) return 16; if ( (l >= 100000000000000L)) return 15; if ( (l >= 10000000000000L)) return 14; if ( (l >= 1000000000000L)) return 13; if ( (l >= 100000000000L)) return 12; if ( (l >= 10000000000L)) return 11; if ( (l >= 1000000000L)) return 10; if ( (l >= 100000000L)) return 9; if ( (l >= 10000000L)) return 8; if ( (l >= 1000000L)) return 7; if ( (l >= 100000L)) return 6; if ( (l >= 10000L)) return 5; if ( (l >= 1000L)) return 4; if ( (l >= 100L)) return 3; if ( (l >= 10L)) return 2; return 1;} public FastWriter write( long x){ if ( (x == Long.MIN_VALUE)) {return write(("" + x));} if ( ((ptr + 21) >= BUF_SIZE)) innerflush(); if ( (x < 0)) {write((byte)'-'); x = -x; } int d = countDigits(x); for ( int i = ((ptr + d) - 1);(i >= ptr);i--) {buf[i] = (byte)('0' + (x % 10)); x /= 10; }ptr += d; return this;} public FastWriter write( double x, int precision){ if ( (x < 0)) {write('-'); x = -x; } x += (Math.pow(10,-precision) / 2); write((long)x).write("."); x -= (long)x; for ( int i = 0;(i < precision);i++) {x *= 10; write((char)('0' + (int)x)); x -= (int)x; }return this;} public FastWriter writeln( char c){ return write(c).writeln();} public FastWriter writeln( int x){ return write(x).writeln();} public FastWriter writeln( long x){ return write(x).writeln();} public FastWriter writeln( double x, int precision){ return write(x,precision).writeln();} public FastWriter write( int... xs){ boolean first = true; for ( int x :xs) {if ( !first) write(' '); first = false; write(x); }return this;} public FastWriter write( long... xs){ boolean first = true; for ( long x :xs) {if ( !first) write(' '); first = false; write(x); }return this;} public FastWriter writeln(){ return write((byte)'\n');} public FastWriter writeln( int... xs){ return write(xs).writeln();} public FastWriter writeln( long... xs){ return write(xs).writeln();} public FastWriter writeln( char[] line){ return write(line).writeln();} public FastWriter writeln( char[]... map){ for ( char[] line :map) write(line).writeln(); return this;} public FastWriter writeln( String s){ return write(s).writeln();} private void innerflush(){ try{out.write(buf,0,ptr); ptr = 0; }catch (IOException e){ throw (new RuntimeException("innerflush"));} } public void flush(){ innerflush(); try{out.flush(); }catch (IOException e){ throw (new RuntimeException("flush"));} } public FastWriter print( byte b){ return write(b);} public FastWriter print( char c){ return write(c);} public FastWriter print( char[] s){ return write(s);} public FastWriter print( String s){ return write(s);} public FastWriter print( int x){ return write(x);} public FastWriter print( long x){ return write(x);} public FastWriter print( double x, int precision){ return write(x,precision);} public FastWriter println( char c){ return writeln(c);} public FastWriter println( int x){ return writeln(x);} public FastWriter println( long x){ return writeln(x);} public FastWriter println( double x, int precision){ return writeln(x,precision);} public FastWriter print( int... xs){ return write(xs);} public FastWriter print( long... xs){ return write(xs);} public FastWriter println( int... xs){ return writeln(xs);} public FastWriter println( long... xs){ return writeln(xs);} public FastWriter println( char[] line){ return writeln(line);} public FastWriter println( char[]... map){ return writeln(map);} public FastWriter println( String s){ return writeln(s);} public FastWriter println(){ return writeln();} } private boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
6	public class B2{ String s = null; String[] ss = null; int[][] sn = null; int n = 0; double ans = 1; int A = 0; public void run()throws Exception { BufferedReader br = null;  File file = new File("input.txt"); if ( file.exists()) {br = new BufferedReader(new FileReader("input.txt")); } else {br = new BufferedReader(new InputStreamReader(System.in)); }s = br.readLine(); ss = s.split(" "); n = Integer.parseInt(ss[0]); int k = Integer.parseInt(ss[1]); A = Integer.parseInt(ss[2]); sn = new int[n][2]; for ( int i = 0;(i < n);i++) {s = br.readLine(); ss = s.split(" "); sn[i][0] = Integer.parseInt(ss[0]); sn[i][1] = Integer.parseInt(ss[1]); } int num = 0; for ( int i = 0;(i < n);i++) {num += ((100 - sn[i][1]) / 10); }if ( (k >= num)) {System.out.println("1.0"); return ;} check(0,k,sn); ans = (1 - ans); System.out.println(ans); } void check( int i, int k, int[][] sn){ if ( ((i == n) && (k == 0))) {check2(sn); return ;} else if ( ((i == n) && (k > 0))) {return ;} else if ( (k == 0)) {check((i + 1),k,sn); } else {for ( int j = 0;(j <= k);j++) {if ( ((sn[i][1] + (j * 10)) <= 100)) { int[][] nsn = copy(sn); nsn[i][1] += (j * 10); check((i + 1),(k - j),nsn); } }}} void check2( int[][] sn){ List<Integer> target = new ArrayList<Integer>();  int h = 0; for ( int i = 0;(i < sn.length);i++) {if ( (sn[i][1] != 100)) {target.add(i); } else {h++; }}if ( (h > (n / 2))) {System.out.println("1.0"); System.exit(0); } int makemax = (n - h);  int makemin = ((n + 1) / 2);  double ma = 0; for ( int i = makemax;(i >= makemin);i--) { Combination c = new Combination(makemax,i);  Iterator<int[]> ite = c.iterator(); while(ite.hasNext()){ int[] ret = ite.next();  Set<Integer> make = new HashSet<Integer>(); for ( int j = 0;(j < ret.length);j++) {if ( (ret[j] > 0)) {make.add(target.get(j)); } } double makeK = 1;  int B = 0; for ( int j = 0;(j < n);j++) { int perc = 0; if ( make.contains(j)) {perc = (100 - sn[j][1]); B += sn[j][0]; } else {perc = sn[j][1]; }makeK *= ((double)perc / 100); }ma += (makeK * (1 - ((double)A / (A + B)))); }}ans = Math.min(ans,ma); } int[][] copy( int[][] sn){ int[][] csn = new int[sn.length][2]; for ( int i = 0;(i < sn.length);i++) {csn[i][0] = sn[i][0]; csn[i][1] = sn[i][1]; }return csn;} public static void main( String[] args)throws Exception { B2 t = new B2(); t.run(); } public class Combination implements Iterable<int[]>{ private final int max ; private final int select ; public Combination( int max, int select){ if ( ((max < 1) || (62 < max))) {throw (new IllegalArgumentException());} this.max = max; this.select = select; } public Iterator<int[]> iterator(){ return new CombinationIterator(max,select);} private class CombinationIterator implements Iterator<int[]>{ private long value ; private final long max ; private final int size ; private int[] ret = null; public CombinationIterator( int max, int select){ this.value = ((1L << select) - 1L); this.size = max; this.max = (1L << max); this.ret = new int[size]; } public boolean hasNext(){ return (value < max);} public int[] next(){ long stock = value; value = next(value); for ( int i = 0;(i < size);i++) { long tmp = (stock >> i); tmp = (tmp & 1); ret[i] = (int)tmp; }return ret;} private long next( long source){ long param1 = smallestBitOf(source);  long param2 = (param1 + source);  long param3 = smallestBitOf(param2);  long param5 = ((param3 / param1) >>> 1); return ((param5 - 1) + param2);} private long smallestBitOf( long source){ long result = 1L; while(((source % 2) == 0)){source >>>= 1; result <<= 1; }return result;} } } }
1	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int[][] x = new int[200010][10];  String a = sc.nextLine();  String b = sc.nextLine();  int n = a.length();  int m = b.length(); for ( int i = 1;(i <= m);i++) {for ( int j = 0;(j < 2);j++) {x[i][j] = x[(i - 1)][j]; }++x[i][(b.charAt((i - 1)) - '0')]; } long res = 0; for ( int i = 0,c ;(i < n);i++) {c = (a.charAt(i) - '0'); for ( int j = 0;(j < 2);j++) {res += (Math.abs((c - j)) * (x[(((m - n) + i) + 1)][j] - x[i][j])); }}System.out.println(res); } }
0	public class Main{ Scanner cin = new Scanner(new BufferedInputStream(System.in)); long n ; long maxlcm ; void run(){ n = cin.nextInt(); if ( ((n == 1) || (n == 2))) maxlcm = n; else if ( (n >= 3)) {if ( ((n % 2) != 0)) {maxlcm = ((n * (n - 1)) * (n - 2)); } else if ( ((n % 3) != 0)) maxlcm = ((n * (n - 1)) * (n - 3)); else maxlcm = (((n - 1) * (n - 2)) * (n - 3)); } System.out.println(maxlcm); } public static void main( String[] args){ new Main().run(); } }
2	public class Main{ public static void main( String[] args){ FastScanner in = new FastScanner();  long[] a = new long[16]; a[0] = 0; for ( int i = 1;(i < 16);++i) a[i] = (a[(i - 1)] + ((9 * (long)Math.pow(10,(i - 1))) * i)); long N = in.nextLong();  int pos = 0; for ( int i = 0;(i < 16);++i) {if ( (N <= a[i])) {pos = i; break;} }if ( (pos == 1)) {System.out.println(N); System.exit(0); } long prev = a[(pos - 1)];  long curr = N;  long rem = (curr - prev);  long ans = 0; for ( int i = 1;(i < pos);++i) {ans = ((ans * 10) + 9); } long g = ((rem + (pos - 1)) / pos);  long take = ((rem + (pos - 1)) % pos);  long number = (ans + g);  String str = Long.toString(number); System.out.println(str.charAt((int)take)); } static void sort( int[] a){ ArrayList<Integer> l = new ArrayList<>(); for ( int i :a) l.add(i); Collections.sort(l); for ( int i = 0;(i < a.length);i++) a[i] = l.get(i); } static class FastScanner{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); String next(){ while(!st.hasMoreTokens())try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } }
5	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int m = sc.nextInt();  long totalBlocks = 0;  long a[] = new long[n]; for ( int i = 0;(i < n);++i) {a[i] = sc.nextLong(); totalBlocks += a[i]; }Arrays.sort(a); long selected = 0; for ( int i = 0;(i < n);++i) {if ( (a[i] > selected)) selected++; } long leftCols = (a[(n - 1)] - selected);  long remBlocks = ((totalBlocks - leftCols) - n); System.out.print(remBlocks); } }
0	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);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, Scanner in, PrintWriter out){ int N = in.nextInt(); if ( ((N % 2) == 0)) {out.println(("4 " + (N - 4))); } else {out.println(("9 " + (N - 9))); }} }
6	public class E{ int bitcount( int x){ int c = 0; for ( ;(x != 0);c++) x &= (x - 1); return c;} boolean bit( int x, int i){ if ( (i < 0)) return false; return ((((x >> i) & 1) == 1)?true:false);} int solve( int n, int m){ if ( (m > n)) { int x = m; m = n; n = x; } int maxmask = (1 << m);  int[][][] dp = new int[(n + 1)][maxmask][maxmask]; for ( int i = 0;(i <= n);i++) for ( int j = 0;(j < maxmask);j++) for ( int k = 0;(k < maxmask);k++) dp[i][j][k] = inf; for ( int i = 0;(i < maxmask);i++) dp[0][0][i] = bitcount(i); for ( int i = 1;(i <= n);i++) for ( int b = 0;(b < maxmask);b++) for ( int c = 0;(c < maxmask);c++) for ( int a = 0;(a < maxmask);a++) { boolean nospider = false; for ( int j = 0;(j < m);j++) if ( not(((((bit(a,j) || bit(c,j)) || bit(b,(j - 1))) || bit(b,j)) || bit(b,(j + 1))))) {nospider = true; break;} if ( nospider) continue; dp[i][b][c] = Math.min(dp[i][b][c],(dp[(i - 1)][a][b] + bitcount(c))); } int res = inf; for ( int b = 0;(b < maxmask);b++) res = Math.min(res,dp[n][b][0]); return ((n * m) - res);} void main()throws IOException { int n ; while(((n = nextInt()) != EOF)){ int m = nextInt(); out.println(solve(n,m)); }} public static void main( String[] args){ new E().run(); } int inf = (int)1e9; final int EOF = -1; boolean not( boolean p){ return !p;} BufferedReader fin ; StringTokenizer st ; PrintWriter out ; public void run(){ try{fin = new BufferedReader(new InputStreamReader(System.in)); st = null; out = new PrintWriter(System.out); main(); fin.close(); out.close(); }catch (Exception e){ e.printStackTrace(); System.exit(1); } } int nextInt()throws IOException { return Integer.parseInt(nextToken());} String nextToken()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String line = fin.readLine(); if ( (line == null)) return "-1"; else st = new StringTokenizer(line); }return st.nextToken();} }
4	public class CF{ class W implements Comparable<W>{ int id ,sz ; W( int id, int sz){ this.id = id; this.sz = sz; } } int[] left ; int center ; boolean[] used ; boolean go( int v){ if ( used[v]) return false; used[v] = true; for ( int i = 0;(i < g[v].size());++i) { int to = g[v].get(i); if ( (to == center)) continue; if ( ((left[to] == -1) || go(left[to]))) {left[to] = v; return true;} }return false;} ArrayList<Integer>[] g ; void solve(){ int n = in.nextInt();  int m = in.nextInt(); used = new boolean[n]; g = new ArrayList[n]; for ( int i = 0;(i < n);i++) g[i] = new ArrayList<>(); for ( int i = 0;(i < m);i++) {g[(in.nextInt() - 1)].add((in.nextInt() - 1)); } long st = System.currentTimeMillis();  int ans = Integer.MAX_VALUE;  W[] a = new W[n]; for ( int i = 0;(i < n);i++) {a[i] = new W(i,g[i].size()); }left = new int[n]; Arrays.sort(a); for ( int centerId = 0;(centerId < n);centerId++) {center = a[centerId].id; if ( ((System.currentTimeMillis() - st) > 800)) break; int cost = (n - g[center].size()); Arrays.fill(left,-1); for ( int i = 0;(i < n);i++) if ( (i != center)) { boolean has = false; for ( int j = 0;(j < g[i].size());j++) {if ( (g[i].get(j) == center)) has = true; }Arrays.fill(used,false); if ( !go(i)) {if ( has) {cost += g[i].size(); } else {cost += (g[i].size() + 2); }} else {if ( has) {cost += (g[i].size() - 2); } else {cost += g[i].size(); }}} ans = Math.min(ans,cost); }out.println(ans); } FastScaner in ; PrintWriter out ; void run(){ in = new FastScaner(System.in); out = new PrintWriter(System.out); solve(); out.close(); } public static void main( String[] args){ Locale.setDefault(Locale.US); new CF().run(); } class FastScaner{ BufferedReader br ; StringTokenizer st ; FastScaner( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); } FastScaner( File f){ try{br = new BufferedReader(new FileReader(f)); }catch (FileNotFoundException e){ e.printStackTrace(); } } String next(){ while(((st == null) || !st.hasMoreElements())){ String s = null; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } if ( (s == null)) return null; st = new StringTokenizer(s); }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
0	public class Main{ public static Scanner scan = new Scanner(System.in); public static boolean bg = true; public static void main( String[] args)throws Exception { long n1 = Integer.parseInt(scan.next()); if ( (n1 == 1)) {System.out.println(1); System.exit(0); } if ( (n1 == 2)) {System.out.println(2); System.exit(0); } if ( (n1 == 3)) {System.out.println(6); System.exit(0); } if ( ((n1 % 2) == 0)) {if ( ((n1 % 3) == 0)) {n1 -= 1; n1 = ((n1 * (n1 - 1)) * (n1 - 2)); System.out.println(n1); } else {n1 = ((n1 * (n1 - 1)) * (n1 - 3)); System.out.println(n1); }} else {n1 = ((n1 * (n1 - 1)) * (n1 - 2)); System.out.println(n1); }} }
0	public class A{ public static void main( String[] args)throws IOException { InputReader sc = new InputReader(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt(); if ( (n < 3)) out.println(n); else {if ( ((n & 1) == 1)) out.println(lcm(n,lcm((n - 1),(n - 2)))); else out.println(Math.max(lcm((n - 1),lcm((n - 2),(n - 3))),lcm(n,lcm((n - 1),(n - 3))))); }out.flush(); out.close(); } static long gcd( long a, long b){ while((b != 0)){a = (a % b); b ^= a; a ^= b; b ^= a; }return a;} static long lcm( long a, long b){ return ((a / gcd(a,b)) * b);} } class InputReader{ private BufferedReader reader ; private StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); 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());} }
2	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);  TaskD solver = new TaskD(); solver.solve(1,in,out); out.close(); } } class TaskD{ public void solve( int testNumber, InputReader in, PrintWriter out){ long l = in.readLong(),r = in.readLong();  int pow = 62;  long mask = (1L << pow); while((((r | l) & mask) == 0)){pow--; mask = (1L << pow); }while(true){if ( ((((r ^ l) & mask) == mask) || (pow < 0))) {break;} mask >>= 1; l = (l & (1L << pow)); r = (r & (1L << pow)); pow--; }pow++; out.print(((1L << pow) - 1)); } } class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } public int read(){ if ( (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 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 static boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} }
6	public class Main{ static class TaskAdapter implements Runnable{ } public static void main( String[] args)throws Exception { Thread thread = new Thread(null,new TaskAdapter(),"",(1 << 28)); thread.start(); thread.join(); } static class EKeyboardPurchase{ private final int iinf = 1_000_000_000; public EKeyboardPurchase(){ } public void solve( int kase, InputReader in, Output pw){ int n = in.nextInt(),m = in.nextInt();  int[] arr = in.nextIntChar((o)->(o - 'a'));  int[][] sum = new int[m][(1 << m)]; { int[][] cnt = new int[m][m]; for ( int i = 0;(i < (n - 1));i++) { int a = arr[i],b = arr[(i + 1)]; cnt[a][b]++; cnt[b][a]++; }for ( int i = 0;(i < m);i++) {for ( int j = 1;(j < (1 << m));j++) { int x = (j & -j); sum[i][j] = (sum[i][(j ^ x)] + cnt[i][(31 - Integer.numberOfLeadingZeros(x))]); }}} int[] mbit = new int[(1 << m)]; for ( int i = 1;(i < (1 << m));i++) {mbit[i] = Integer.numberOfTrailingZeros((i & -i)); } int[] dp = new int[(1 << m)]; for ( int i = 1;(i < (1 << m));i++) { int ans = iinf,ci = i; for ( int j = mbit[ci];(ci > 0);ci -= (1 << j),j = mbit[ci]) { int cur = (dp[(i ^ (1 << j))] + sum[j][(i ^ (1 << j))]);  int x = (((1 << m) - 1) ^ i);  int cm = i; for ( int k = mbit[cm];(cm > 0);cm -= (1 << k),k = mbit[cm]) {cur += sum[k][x]; }cur -= sum[j][x]; ans = Math.min(ans,cur); }dp[i] = ans; }pw.println(dp[(dp.length - 1)]); } } static interface InputReader{ String next(); int nextInt(); default int[] nextIntChar( Function<Character,Integer> f){ String s = next();  int[] ret = new int[s.length()]; for ( int i = 0;(i < s.length());i++) {ret[i] = f.apply(s.charAt(i)); }return ret;} } static class FastReader implements InputReader{ private final int BUFFER_SIZE = (1 << 16); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ; private int bytesRead ; public FastReader( InputStream is){ din = new DataInputStream(is); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String next(){ StringBuilder ret = new StringBuilder(64);  byte c = skip(); while(((c != -1) && !isSpaceChar(c))){ret.appendCodePoint(c); c = read(); }return ret.toString();} public int nextInt(){ int ret = 0;  byte c = skipToDigit();  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;} private boolean isSpaceChar( byte b){ return (((((b == ' ') || (b == '\r')) || (b == '\n')) || (b == '\t')) || (b == '\f'));} private byte skip(){ byte ret ; while(isSpaceChar(ret = read()));return ret;} private boolean isDigit( byte b){ return ((b >= '0') && (b <= '9'));} private byte skipToDigit(){ byte ret ; while((!isDigit(ret = read()) && (ret != '-')));return ret;} private void fillBuffer(){ try{bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); }catch (IOException e){ e.printStackTrace(); throw (new InputMismatchException());} if ( (bytesRead == -1)) {buffer[0] = -1; } } private byte read(){ if ( (bytesRead == -1)) {throw (new InputMismatchException());} else if ( (bufferPointer == bytesRead)) {fillBuffer(); } return buffer[bufferPointer++];} } static class Output implements Closeable,Flushable{ public StringBuilder sb ; public OutputStream os ; public int BUFFER_SIZE ; public String lineSeparator ; public Output( OutputStream os){ this(os,(1 << 16)); } public Output( OutputStream os, int bs){ BUFFER_SIZE = bs; sb = new StringBuilder(BUFFER_SIZE); this.os = new BufferedOutputStream(os,(1 << 17)); lineSeparator = System.lineSeparator(); } public void println( int i){ println(String.valueOf(i)); } public void println( String s){ sb.append(s); println(); } public void println(){ sb.append(lineSeparator); } private void flushToBuffer(){ try{os.write(sb.toString().getBytes()); }catch (IOException e){ e.printStackTrace(); } sb = new StringBuilder(BUFFER_SIZE); } public void flush(){ try{flushToBuffer(); os.flush(); }catch (IOException e){ e.printStackTrace(); } } public void close(){ flush(); try{os.close(); }catch (IOException e){ e.printStackTrace(); } } } }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,dd ,bb ; int[] uu ,vv ,uv ,cost ; boolean[] iq ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; dd = new int[n_]; bb = new int[n_]; iq = new boolean[n_]; uu = new int[m_]; vv = new int[m_]; uv = new int[m_]; cost = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; uv[h] = (u ^ v); cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } boolean dijkstra( int s, int t){ Arrays.fill(pi,INF); pi[s] = 0; TreeSet<Integer> pq = new TreeSet<>((u,v)->((pi[u] != pi[v])?(pi[u] - pi[v]):((dd[u] != dd[v])?(dd[u] - dd[v]):(u - v)))); pq.add(s); iq[s] = true; Integer first ; while(((first = pq.pollFirst()) != null)){ int u = first; iq[u] = false; int d = (dd[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost[h]:-cost[h]));  int v = (u ^ uv[h]); if ( ((pi[v] > p) || ((pi[v] == p) && (dd[v] > d)))) {if ( iq[v]) {pq.remove(v); iq[v] = false; } pi[v] = p; dd[v] = d; bb[v] = h_; pq.add(v); iq[v] = true; } } }return (pi[t] != INF);} void push1( int s, int t){ for ( int u = t,h_ ,h ;(u != s);u ^= uv[h]) {h = ((h_ = bb[u]) >> 1); cc[h_]--; cc[(h_ ^ 1)]++; }} int edmonds_karp( int s, int t){ while(dijkstra(s,t))push1(s,t); int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
4	public class Sol{ public static void main( String[] args){ int t = 1; while((t-- > 0)){ int n = ni(); mod = nl(); precomp(); long dp[][] = new long[405][405]; dp[0][0] = 1l; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= i);j++) {for ( int k = 1;((k + i) <= n);k++) {dp[((i + k) + 1)][(j + k)] += (((dp[i][j] * p2[(k - 1)]) % mod) * Comb[(k + j)][k]); dp[((i + k) + 1)][(j + k)] %= mod; }}} long sum = 0l; for ( int i = 0;(i <= n);i++) sum = ((sum + dp[(n + 1)][i]) % mod); out.println(sum); }out.close(); } static long Comb[][] = new long[405][405]; static long p2[] = new long[405]; static long inv[] = new long[405]; static long factorial[] = new long[405]; static void precomp(){ inv[0] = 1; factorial[0] = 1l; for ( long i = 1;(i < 405);i++) {factorial[(int)i] = (i * factorial[((int)i - 1)]); factorial[(int)i] %= mod; }for ( int i = 1;(i < 405);i++) {inv[i] = power(factorial[i],(mod - 2)); }for ( int i = 0;(i < 405);i++) {for ( int j = 0;(j <= i);j++) {Comb[i][j] = ((((factorial[i] * inv[j]) % mod) * inv[(i - j)]) % mod); }}for ( int i = 0;(i < 405);i++) p2[i] = power(2,i); } static int Max = Integer.MAX_VALUE; static long mod = 1000000007; public static long power( long x, long y){ long res = 1L; x = (x % mod); while((y > 0)){if ( ((y & 1) == 1)) res = ((res * x) % mod); y >>= 1; x = ((x * x) % mod); }return res;} static InputStream inputStream = System.in; static OutputStream outputStream = System.out; static FastReader in = new FastReader(inputStream); static PrintWriter out = new PrintWriter(outputStream); static class FastReader{ BufferedReader br ; StringTokenizer st ; FastReader( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); } public String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} String nextLine(){ String str = ""; try{str = br.readLine(); }catch (IOException e){ e.printStackTrace(); } return str;} } static int ni(){ return in.nextInt();} static long nl(){ return in.nextLong();} }
2	public class A{ FastScanner in ; PrintWriter out ; final long mod = ((long)1e9 + 9); public void solve()throws IOException { long n = in.nextInt();  long m = in.nextInt();  long k = in.nextInt();  long l = (n / k);  long c = (n - m);  long mul2 = Math.max(0,(l - c)); if ( (mul2 == 0)) {out.println(m); return ;} long ans = power(2,(mul2 + 1),mod); ans = (((ans + mod) - 2) % mod); ans = ((ans * k) % mod); long z = (mul2 * k);  long r = (m - z); ans = ((ans + r) % mod); out.print(ans); } public long power( long x, long pow, long mod){ if ( (pow == 0)) {return 1;} if ( ((pow % 2) == 0)) {return power(((x * x) % mod),(pow / 2),mod);} else {return ((power(x,(pow - 1),mod) * x) % mod);}} public void run(){ try{in = new FastScanner(System.in); out = new PrintWriter(System.out); solve(); out.close(); }catch (IOException e){ e.printStackTrace(); } } class FastScanner{ BufferedReader br ; StringTokenizer st ; FastScanner( File f){ try{br = new BufferedReader(new FileReader(f)); }catch (FileNotFoundException e){ e.printStackTrace(); } } public FastScanner( InputStream in){ br = new BufferedReader(new InputStreamReader(in)); } String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } public static void main( String[] arg){ new A().run(); } }
2	public class B{ public static void main( String[] args){ Scanner qwe = new Scanner(System.in);  int n = qwe.nextInt();  int x11 = bins(true,1,2,n,qwe,true);  int y11 = bins(true,1,2,n,qwe,false);  int x12 = bins(false,0,1,n,qwe,true);  int y12 = bins(false,0,1,n,qwe,false);  int x21 = bins(true,0,1,n,qwe,true);  int y21 = bins(true,0,1,n,qwe,false);  int x22 = bins(false,1,2,n,qwe,true);  int y22 = bins(false,1,2,n,qwe,false);  int[] xsl = {x11,x21};  int[] xsr = {x12,x22};  int[] ysl = {y11,y21};  int[] ysr = {y12,y22};  int[] ans = new int[8]; for ( int xpl = 0;(xpl < 2);xpl++) {for ( int xpr = 0;(xpr < 2);xpr++) for ( int ypl = 0;(ypl < 2);ypl++) {for ( int ypr = 0;(ypr < 2);ypr++) {if ( ((((xsl[xpl] <= xsr[xpr]) && (xsl[(1 - xpl)] <= xsr[(1 - xpr)])) && (ysl[ypl] <= ysr[ypr])) && (ysl[(1 - ypl)] <= ysr[(1 - ypr)]))) {System.out.printf("? %d %d %d %d",xsl[xpl],ysl[ypl],xsr[xpr],ysr[ypr]); System.out.println(); System.out.flush(); int response1 = qwe.nextInt(); System.out.printf("? %d %d %d %d",xsl[(1 - xpl)],ysl[(1 - ypl)],xsr[(1 - xpr)],ysr[(1 - ypr)]); System.out.println(); System.out.flush(); int response2 = qwe.nextInt(); if ( ((response1 == 1) && (response2 == 1))) {ans = new int[]{xsl[xpl],ysl[ypl],xsr[xpr],ysr[ypr],xsl[(1 - xpl)],ysl[(1 - ypl)],xsr[(1 - xpr)],ysr[(1 - ypr)]}; } } }}}System.out.printf("! %d %d %d %d %d %d %d %d",ans[0],ans[1],ans[2],ans[3],ans[4],ans[5],ans[6],ans[7]); System.out.println(); System.out.flush(); qwe.close(); } static int bins( boolean leftbound, int small, int big, int n, Scanner qwe, boolean isx){ int min = 0;  int max = n; if ( leftbound) {min++; max++; } int y1 = 1;  int y2 = n;  int x1 = 1;  int x2 = n; while(((min + 1) < max)){ int med = ((min + max) / 2); if ( isx) {if ( !leftbound) x2 = med; else x1 = med; } else {if ( !leftbound) y2 = med; else y1 = med; }System.out.printf("? %d %d %d %d",x1,y1,x2,y2); System.out.println(); System.out.flush(); int response = qwe.nextInt(); if ( leftbound) {if ( (response >= big)) min = med; else max = med; } else {if ( (response < big)) {min = med; } else {max = med; }}}if ( leftbound) max--; return max;} }
6	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ double special( int[] loyalties, int[] levels, int playerlevelsum){ int poss = (1 << loyalties.length);  double res = 0; for ( int pos = 0;(pos < poss);pos++) { double occurs = 1;  int happy = 0;  int badlevelssum = 0; for ( int i = 0;(i < loyalties.length);i++) {if ( (((pos >> i) & 1) == 1)) {happy++; occurs *= ((double)loyalties[i] / 100); } else {badlevelssum += levels[i]; occurs *= ((double)(100 - loyalties[i]) / 100); }} double winprob = ((happy <= (levels.length / 2))?((double)playerlevelsum / (playerlevelsum + badlevelssum)):1); res += (occurs * winprob); }return res;} public void solve( int testNumber, InputReader in, OutputWriter out){ int senators = in.readInt();  int sweets = in.readInt();  int playerlevelsum = in.readInt();  int[] levels = new int[senators];  int[] loyalties = new int[senators]; IOUtils.readIntArrays(in,levels,loyalties); ArrayList<ArrayList<Integer>> possibilities = new ArrayList<>(Arrays.asList(new ArrayList<>())); for ( int senator = 0;(senator < senators);senator++) { ArrayList<ArrayList<Integer>> newpossibilities = new ArrayList<>(); for ( ArrayList<Integer> al :possibilities) { int sumsofar = 0; for ( int val :al) sumsofar += val; int minadd = ((senator == (senators - 1))?(sweets - sumsofar):0); for ( int moar = minadd;(moar <= (sweets - sumsofar));moar++) { ArrayList<Integer> copy = new ArrayList<>(al); copy.add(moar); newpossibilities.add(copy); }}possibilities = newpossibilities; } double res = 0; for ( ArrayList<Integer> al :possibilities) { int[] newloyalties = new int[senators]; for ( int i = 0;(i < senators);i++) newloyalties[i] = Math.min(100,(loyalties[i] + (10 * al.get(i)))); double special = special(newloyalties,levels,playerlevelsum);  double tot = special; res = Math.max(res,tot); }out.printLine(res); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private SpaceCharFilter filter ; 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 boolean isSpaceChar( int c){ if ( (filter != null)) return filter.isSpaceChar(c); return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } } }
0	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);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, InputReader in, PrintWriter out){ long n = in.readInt(); if ( (n < 3)) {out.print(n); } else if ( ((n % 2) != 0)) {out.print(((n * (n - 1)) * (n - 2))); } else if ( ((n % 3) == 0)) {out.print((((n - 1) * (n - 2)) * (n - 3))); } else {out.print(((n * (n - 1)) * (n - 3))); }} } class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private SpaceCharFilter filter ; 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 boolean isSpaceChar( int c){ if ( (filter != null)) return filter.isSpaceChar(c); return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } }
6	public class TemnayaAssambleya implements Runnable{ public static void main( String[] args){ new Thread(new TemnayaAssambleya()).run(); } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer in ; PrintWriter out = new PrintWriter(System.out); public String nextToken()throws IOException { while(((in == null) || !in.hasMoreTokens())){in = new StringTokenizer(br.readLine()); }return in.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(nextToken());} int[] l ; int[] ln ; int[] pw ; int[] p ; int A ; double max = 0; public void gen( int n, int k){ if ( (n == 0)) {n = p.length; p[0] = k; for ( int i = 0;(i < n);i++) {ln[i] = (l[i] + (p[i] * 10)); if ( (ln[i] > 100)) ln[i] = 100; } double ans = 0; for ( int mask = 0;(mask < (1 << n));mask++) { int z = 0;  double pos = 1;  int power = 0; for ( int i = 0;(i < n);i++) {if ( ((mask & (1 << i)) > 0)) {z++; pos *= ((ln[i] * 1.) / 100); } else {pos *= (((100 - ln[i]) * 1.) / 100); power += pw[i]; }}if ( (z > (n / 2))) {ans += pos; } else {ans += ((pos * A) / (A + power)); }}max = Math.max(ans,max); return ;} for ( int i = 0;(i <= Math.min(k,(10 - (l[n] / 10))));i++) {p[n] = i; gen((n - 1),(k - i)); }} public void solve()throws IOException { int n = nextInt();  int k = nextInt(); A = nextInt(); p = new int[n]; pw = new int[n]; l = new int[n]; ln = new int[n]; for ( int i = 0;(i < n);i++) {pw[i] = nextInt(); l[i] = nextInt(); }gen((n - 1),k); out.println(max); } public void run(){ try{solve(); out.close(); }catch (Exception e){ e.printStackTrace(); System.exit(1); } } }
4	public class B{ static PrintWriter out ; static InputReader in ; public static void main( String[] args){ out = new PrintWriter(System.out); in = new InputReader(); new B(); out.flush(); out.close(); } B(){ solve(); } void solve(){ int n = in.nextInt(),mod = in.nextInt();  long dp[][] = new long[(n + 1)][(n + 1)];  long ncr[][] = new long[810][410]; ncr[0][0] = 1; for ( int i = 1;(i < 810);i++) {for ( int j = 0;(j < 410);j++) {ncr[i][j] = ((ncr[(i - 1)][j] + ((j > 0)?ncr[(i - 1)][(j - 1)]:0)) % mod); }}for ( int i = 1;(i <= n);i++) dp[i][i] = 1; for ( int i = 1;(i < n);i++) {for ( int j = 1;((j + i) <= n);j++) { int end = (i + j); dp[j][end] = ((dp[(j + 1)][end] + dp[j][(end - 1)]) % mod); }} long value[] = new long[(n + 1)]; for ( int i = 1;(i <= n);i++) {value[i] = dp[1][i]; } long fdp[][] = new long[(n + 2)][(n + 2)]; fdp[0][0] = 1; long ans = 0; for ( int b = 1;(b <= ((n + 1) / 2));b++) {for ( int i = 1;(i <= n);i++) {for ( int k = Math.max(0,(b - 2));(k < i);k++) {fdp[(i + 1)][b] = ((fdp[(i + 1)][b] + ((((fdp[k][(b - 1)] * value[(i - k)]) % mod) * ncr[(((((k - b) + 2) + i) - k) - 1)][(i - k)]) % mod)) % mod); }}ans = ((ans + fdp[(n + 1)][b]) % mod); }out.print(ans); } public static class InputReader{ BufferedReader br ; StringTokenizer st ; InputReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public int nextInt(){ return Integer.parseInt(next());} public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ } }return st.nextToken();} } }
3	public class Practice{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } static class TaskA{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  String[] arr1 = new String[n];  String[] arr2 = new String[n]; for ( int i = 0;(i < n);i++) {arr1[i] = in.next(); }for ( int i = 0;(i < n);i++) {arr2[i] = in.next(); } int ans = 0;  boolean arr[] = new boolean[n];  boolean found = false; for ( int i = 0;(i < arr1.length);i++) {for ( int j = 0;(j < arr1.length);j++) {found = false; if ( (arr1[i].equals(arr2[j]) && !arr[j])) {found = true; arr[j] = true; break;} }if ( !found) {ans++; } }out.println(ans); } } public long GCD( long a, long b){ if ( (b == 0)) {return a;} return GCD(b,(a % b));} 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());} } }
2	public class mad{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int cura = 0,curb = 0;  int ver ; System.out.println("? 0 0"); System.out.flush(); ver = sc.nextInt(); for ( int i = 29;(i >= 0);i--) {System.out.println(((("? " + (cura + (1 << i))) + " ") + curb)); System.out.flush(); int temp1 = sc.nextInt(); System.out.println(((("? " + cura) + " ") + (curb + (1 << i)))); System.out.flush(); int temp2 = sc.nextInt(); if ( (temp1 != temp2)) {if ( (temp2 == 1)) {cura += (1 << i); curb += (1 << i); } } else {if ( (ver == 1)) cura += (1 << i); if ( (ver == -1)) curb += (1 << i); ver = temp1; }}System.out.println(((("! " + cura) + " ") + curb)); } }
4	public class Main{ static boolean LOCAL = (System.getSecurityManager() == null); Scanner in = new Scanner(System.in); private int[] B ; private int[] A ; private int n ; private int m ; void run(){ n = in.nextInt(); m = in.nextInt(); A = new int[m]; B = new int[m]; for ( int i = 0;(i < m);i++) {A[i] = (in.nextInt() - 1); B[i] = (in.nextInt() - 1); } int ans = Integer.MAX_VALUE; for ( int i = 0;(i < n);i++) {ans = min(ans,solve(i)); }out.println(ans); } int solve( int x){ int ans = (((3 * (n - 1)) + 1) + m);  V[] vs = new V[(n * 2)]; for ( int i = 0;(i < vs.length);i++) vs[i] = new V(); for ( int i = 0;(i < m);i++) {if ( ((A[i] == x) || (B[i] == x))) ans -= 2; else vs[A[i]].connect(vs[(n + B[i])]); }return (ans - (2 * bipartiteMatching(vs)));} class V extends ArrayList<V>{ V pair ; boolean used ; void connect( V v){ add(v); v.add(this); } } int bipartiteMatching( V[] vs){ int match = 0; for ( V v :vs) if ( (v.pair == null)) {for ( V u :vs) u.used = false; if ( dfs(v)) match++; } return match;} boolean dfs( V v){ v.used = true; for ( V u :v) { V w = u.pair; if ( ((w == null) || (!w.used && dfs(w)))) {v.pair = u; u.pair = v; return true;} }return false;} public static void main( String[] args){ if ( LOCAL) {try{System.setIn(new FileInputStream("./../../in.txt")); }catch (Throwable e){ LOCAL = false; } } long start = 0; if ( LOCAL) start = System.nanoTime(); new Main().run(); if ( LOCAL) System.err.printf("[Time : %.6f s]%n",((System.nanoTime() - start) * 1e-9)); } } class Scanner{ BufferedReader br ; StringTokenizer st ; Scanner( InputStream in){ br = new BufferedReader(new InputStreamReader(in)); eat(""); } void eat( String s){ st = new StringTokenizer(s); } String nextLine(){ try{return br.readLine(); }catch (IOException e){ return null;} } boolean hasNext(){ while(!st.hasMoreTokens()){ String s = nextLine(); if ( (s == null)) return false; eat(s); }return true;} String next(){ hasNext(); return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} }
4	public class B{ static int n ,t[] ,g[] ,MOD = ((int)1e9 + 7); static int[][][] memo1 ,memo2[] ,memo3[] ; static int dp1( int idx, int remCnt, int remSum){ if ( (idx == n)) return (((remSum == 0) && (remCnt == 0))?1:0); if ( ((remCnt < 0) || (remSum < 0))) return 0; if ( (memo1[idx][remCnt][remSum] != -1)) return memo1[idx][remCnt][remSum]; int ans = dp1((idx + 1),remCnt,remSum); if ( (g[idx] == 0)) {ans += dp1((idx + 1),(remCnt - 1),(remSum - t[idx])); if ( (ans >= MOD)) ans -= MOD; } return memo1[idx][remCnt][remSum] = ans;} static int dp2( int idx, int remCnt1, int remCnt2, int remSum){ if ( (idx == n)) return ((((remSum == 0) && (remCnt1 == 0)) && (remCnt2 == 0))?1:0); if ( (((remSum < 0) || (remCnt1 < 0)) || (remCnt2 < 0))) return 0; if ( (memo2[idx][remCnt1][remCnt2][remSum] != -1)) return memo2[idx][remCnt1][remCnt2][remSum]; int ans = dp2((idx + 1),remCnt1,remCnt2,remSum); if ( (g[idx] == 1)) ans += dp2((idx + 1),(remCnt1 - 1),remCnt2,(remSum - t[idx])); else if ( (g[idx] == 2)) ans += dp2((idx + 1),remCnt1,(remCnt2 - 1),(remSum - t[idx])); return memo2[idx][remCnt1][remCnt2][remSum] = ans;} static private int dp3( int cnt0, int cnt1, int cnt2, int last){ if ( (((cnt0 < 0) || (cnt1 < 0)) || (cnt2 < 0))) return 0; if ( (((cnt0 + cnt1) + cnt2) == 0)) return 1; if ( (memo3[last][cnt0][cnt1][cnt2] != -1)) return memo3[last][cnt0][cnt1][cnt2]; long ans = 0; if ( (last != 0)) ans += dp3((cnt0 - 1),cnt1,cnt2,0); if ( (last != 1)) ans += dp3(cnt0,(cnt1 - 1),cnt2,1); if ( (last != 2)) ans += dp3(cnt0,cnt1,(cnt2 - 1),2); return memo3[last][cnt0][cnt1][cnt2] = (int)(ans % MOD);} public static void main( String[] args)throws IOException { Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out); n = sc.nextInt(); int[] fac = new int[(n + 1)]; t = new int[n]; g = new int[n]; int[] cnt = new int[3]; fac[0] = 1; for ( int i = 1;(i <= n);i++) fac[i] = (int)(((i * 1L) * fac[(i - 1)]) % MOD); int T = sc.nextInt(); for ( int i = 0;(i < n);i++) {t[i] = sc.nextInt(); g[i] = (sc.nextInt() - 1); cnt[g[i]]++; }memo1 = new int[n][(cnt[0] + 1)][(T + 1)]; memo2 = new int[n][(cnt[1] + 1)][(cnt[2] + 1)][(T + 1)]; memo3 = new int[4][(cnt[0] + 1)][(cnt[1] + 1)][(cnt[2] + 1)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= cnt[0]);j++) Arrays.fill(memo1[i][j],-1); for ( int j = 0;(j <= cnt[1]);j++) for ( int k = 0;(k <= cnt[2]);k++) Arrays.fill(memo2[i][j][k],-1); }for ( int i = 0;(i < 4);i++) for ( int j = 0;(j <= cnt[0]);j++) for ( int k = 0;(k <= cnt[1]);k++) Arrays.fill(memo3[i][j][k],-1); int ans = 0; for ( int cnt0 = 0;(cnt0 <= cnt[0]);cnt0++) for ( int sum0 = 0;(sum0 <= T);sum0++) for ( int cnt1 = 0;(cnt1 <= cnt[1]);cnt1++) for ( int cnt2 = 0;(cnt2 <= cnt[2]);cnt2++) { long ways = (((dp1(0,cnt0,sum0) * 1L) * dp2(0,cnt1,cnt2,(T - sum0))) % MOD); ways = ((ways * dp3(cnt0,cnt1,cnt2,3)) % MOD); ways *= fac[cnt0]; ways %= MOD; ways *= fac[cnt1]; ways %= MOD; ways *= fac[cnt2]; ways %= MOD; ans += ways; if ( (ans >= MOD)) ans -= MOD; }out.println(ans); out.close(); } static class Scanner{ BufferedReader br ; StringTokenizer st ; Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } Scanner( String fileName)throws FileNotFoundException{ br = new BufferedReader(new FileReader(fileName)); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} boolean ready()throws IOException { return br.ready();} } }
5	public class Beacon8{ public static void main( String[] args)throws IOException { Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  Map<Integer,Integer> beacons = new TreeMap<>(); for ( int i = 0;(i < n);i++) { int index = scan.nextInt();  int power = scan.nextInt(); beacons.put(index,power); } int[] indicesArr = new int[n];  int arrInd = 0; for ( int index :beacons.keySet()) {indicesArr[arrInd] = index; arrInd++; } int[] nDestroys = new int[n]; for ( int i = 0;(i < n);i++) { int bIndex = Arrays.binarySearch(indicesArr,(indicesArr[i] - beacons.get(indicesArr[i]))); if ( (bIndex < 0)) bIndex = (bIndex + 1); nDestroys[i] = (i - bIndex); } int[] totalBeacons = new int[n];  int maxBeacons = 1; totalBeacons[0] = 1; for ( int i = 1;(i < n);i++) {if ( (nDestroys[i] == 0)) totalBeacons[i] = (totalBeacons[(i - 1)] + 1); else {if ( (((i - nDestroys[i]) - 1) >= 0)) totalBeacons[i] = (totalBeacons[((i - nDestroys[i]) - 1)] + 1); else totalBeacons[i] = 1; }if ( (totalBeacons[i] > maxBeacons)) maxBeacons = totalBeacons[i]; }System.out.println((n - maxBeacons)); } }
0	public class Codechef{ public static void main( String[] args)throws java.lang.Exception { Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int m = sc.nextInt();  int x = (m % (int)Math.pow(2,n)); System.out.println(x); } }
0	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long n = sc.nextLong();  long k = sc.nextLong(); System.out.println(solve(n,k)); sc.close(); } static long solve( long n, long k){ return Math.max(0,((Math.min(n,(k - 1)) - ((k + 2) / 2)) + 1));} }
1	public class Solution{ public static void main( String[] args)throws Exception { Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int k = sc.nextInt();  String s = sc.next();  StringBuilder ans = new StringBuilder();  int count = 0;  int open = 0; for ( int i = 0;(i < s.length());i++) {if ( (s.charAt(i) == '(')) {ans.append("("); count++; open++; } else {ans.append(")"); open--; }if ( (count == (k / 2))) {break;} }while((open > 0)){ans.append(")"); open--; }System.out.println(ans.toString()); } }
0	public class ProblemA{ public static void main( String[] args)throws Exception { Scanner sc = new Scanner(new InputStreamReader(System.in));  int n = sc.nextInt(); if ( ((n % 2) == 0)) {System.out.println((((n - 4) + " ") + 4)); } else {System.out.println((((n - 9) + " ") + 9)); }} }
2	public class C{ static private BufferedReader in ; static private StringTokenizer st ; static private PrintWriter out ; public static void main( String[] args)throws NumberFormatException,IOException { in = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(""); out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int n = nextInt();  int m = nextInt();  int k = nextInt();  int mod = (int)(1e9 + 9);  int correct = (n - (n / k));  int carry = (n % k);  long ans ; if ( (correct >= m)) {ans = m; } else {m -= correct; int block = (n / k);  BigInteger pow = BigInteger.valueOf(2).modPow(BigInteger.valueOf((m + 1)),BigInteger.valueOf(mod)); ans = (((pow.longValue() - 2) + mod) % mod); ans = ((ans * (long)k) % mod); ans = (((ans + ((long)(block - m) * (long)(k - 1))) + carry) % mod); }System.out.println(ans); } static String next()throws IOException { while(!st.hasMoreTokens()){st = new StringTokenizer(in.readLine()); }return st.nextToken();} static int nextInt()throws NumberFormatException,IOException { return Integer.parseInt(next());} }
1	public class Code{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  HashMap<Double,Integer> h = new HashMap<>();  double[] temp = new double[n];  int m = 0; for ( int i = 0;(i < n);i++) { String l = br.readLine();  int[] x = new int[4];  int k = 0;  boolean t = false; for ( int j = 0;(j < l.length());j++) {if ( ((((l.charAt(j) == '(') || (l.charAt(j) == '+')) || (l.charAt(j) == ')')) || (l.charAt(j) == '/'))) x[k++] = j; } double a = Integer.parseInt(l.substring((x[0] + 1),x[1]));  double b = Integer.parseInt(l.substring((x[1] + 1),x[2]));  double c = Integer.parseInt(l.substring((x[3] + 1))); temp[m++] = ((a + b) / c); if ( h.containsKey(((a + b) / c))) h.put(((a + b) / c),(h.get(((a + b) / c)) + 1)); else h.put(((a + b) / c),1); }for ( int i = 0;(i < n);i++) {System.out.print((h.get(temp[i]) + " ")); }} }
3	public class ProblemC{ public static void main( String[] args){ FastScanner input = new FastScanner();  int n = input.nextInt();  int radius = input.nextInt();  ArrayList<Integer> diskXToFall = new ArrayList<Integer>(); for ( int a = 0;(a < n);a++) {diskXToFall.add(input.nextInt()); } ArrayList<P> stationaryDisks = new ArrayList<P>(); for ( int a = 0;(a < n);a++) { double highCollision = radius; for ( P i :stationaryDisks) {if ( ((Math.abs((diskXToFall.get(a) - i.x)) - 1e-8) <= (2 * radius))) { double hypot = (2 * radius);  double leg = Math.abs((diskXToFall.get(a) - i.x));  double yOffset = Math.sqrt(Math.abs(((hypot * hypot) - (leg * leg)))); highCollision = Math.max(highCollision,(yOffset + i.y)); } }stationaryDisks.add(new P(diskXToFall.get(a),highCollision)); }for ( int a = 0;(a < n);a++) {System.out.print((stationaryDisks.get(a).y + " ")); }} static class P implements Comparable<P>{ final double x ,y ; P( double x, double y){ this.x = x; this.y = y; } P sub( P that){ return new P((x - that.x),(y - that.y));} P add( P that){ return new P((x + that.x),(y + that.y));} double dot( P that){ return ((x * that.x) + (y * that.y));} P scale( double s){ return new P((x * s),(y * s));} double length(){ return sqrt(((x * x) + (y * y)));} double length2(){ return ((x * x) + (y * y));} P rightNormal(){ return new P(y,-x);} P normalize(){ double n = length(); return ((n > 0)?new P((x / n),(y / n)):origin());} P scaleToLength( double l){ return normalize().scale(l);} P project( P a){ return scale((a.dot(this) / length2()));} P reflect( P a){ return project(a).scale(2.0).sub(a);} P rotateCCW( double sinT, double cosT){ return new P(((x * cosT) - (y * sinT)),((x * sinT) + (y * cosT)));} double theta(){ return atan2(y,x);} boolean isOrigin(){ return ((x == 0) && (y == 0));} public String toString(){ return String.format("(%f,%f)",this.x,this.y);} static P origin(){ return new P(0,0);} double det( P that){ return ((this.x * that.y) - (this.y * that.x));} double crossproduct( P that){ return this.det(that);} double dist( P to){ return sub(to).length();} double signedParallelogramArea( P b, P c){ return b.sub(this);} boolean isCollinearWith( P b, P c){ return (abs(signedParallelogramArea(b,c)) <= EPS);} boolean isCCW( P b, P c){ return (signedParallelogramArea(b,c) > 0);} P[] solveDotProductConstrainedByNorm( double b, double C){ P a = this; if ( a.isOrigin()) throw (new Error("degenerate case")); boolean transpose = (abs(a.x) > abs(a.y)); a = (transpose?new P(a.y,a.x):a); Double[] x = solvequadratic(a.length2(),((2.0 * b) * a.x),((b * b) - (((a.y * a.y) * C) * C)));  P[] p = new P[x.length]; for ( int i = 0;(i < x.length);i++) { double x1 = x[i];  double x2 = ((-b - (a.x * x1)) / a.y); p[i] = (transpose?new P(x2,x1):new P(x1,x2)); }return p;} @Override public int compareTo( P that){ if ( (abs((this.x - that.x)) > EPS)) return Double.compare(this.x,that.x); return Double.compare(this.y,that.y);} } static Double[] solvequadratic( double a, double b, double c){ double D = ((b * b) - ((4 * a) * c)); if ( (D < -EPS)) return new Double[]{}; D = max(D,0); if ( (D == 0)) return new Double[]{((-b / 2.0) / a)}; double d = sqrt(D); if ( (signum(b) == 0)) return new Double[]{((d / 2.0) / a),((-d / 2.0) / a)}; double x1 = ((-b - (signum(b) * d)) / (2 * a));  double x2 = (c / (a * x1)); return new Double[]{Math.min(x1,x2),Math.max(x1,x2)};} static double EPS = 1e-6; static class Line{ P p ,q ,d ; Line( P p, P q){ this.p = p; this.q = q; d = q.sub(p); } P getPointFromParameter( double t){ return p.add(d.scale(t));} P reflect( P d2){ return d.reflect(d2);} P project( P a){ return p.add(d.project(a.sub(p)));} @Override public String toString(){ return String.format("[%s => %s]",p,q);} double[] intersectionParameters( Line l){ P dneg = p.sub(q);  double D = l.d.det(dneg); if ( (D == 0.0)) return null; P rp = p.sub(l.p); return new double[]{(l.d.det(rp) / D),(rp.det(dneg) / D)};} P[] intersectsCircle( Circle c){ P x = project(c.c);  double D = x.dist(c.c); if ( (D > (c.R + EPS))) return new P[0]; double h = sqrt(max(0,((c.R * c.R) - (D * D)))); if ( (h == 0)) return new P[]{x}; return new P[]{x.add(d.scaleToLength(h)),x.add(d.scaleToLength(-h))};} boolean isInBounds( P r){ return (abs(((p.dist(q) - p.dist(r)) - q.dist(r))) <= EPS);} } static class Circle{ P c ; double R ; Circle( P c, double R){ this.c = c; this.R = R; } @Override public String toString(){ return String.format("{%s, %.03f}",c,R);} boolean isInside( P p){ return (R > (p.dist(c) - EPS));} P[] intersectsCircle( Circle that){ double r1 = this.R;  double r2 = that.R;  P m = that.c.sub(this.c);  P[] r1sol = m.solveDotProductConstrainedByNorm(((((r2 * r2) - (r1 * r1)) - m.length2()) / 2),r1);  P[] is = new P[r1sol.length]; for ( int i = 0;(i < r1sol.length);i++) is[i] = this.c.add(r1sol[i]); return is;} static Circle getCircumCircle( P a, P b){ P c = a.add(b).scale(.5); return new Circle(c,c.dist(a));} static Circle getCircumCircle( P a, P b, P c){ P B = b.sub(a);  P C = c.sub(a);  double d = (2 * B.crossproduct(C)); if ( (abs(d) < EPS)) return getCircumCircle(new P(min(a.x,min(b.x,c.x)),min(a.y,min(b.y,c.y))),new P(max(a.x,max(b.x,c.x)),max(a.y,max(b.y,c.y)))); double z1 = B.length2();  double z2 = C.length2();  P cc = new P(((C.y * z1) - (B.y * z2)),((B.x * z2) - (C.x * z1))).scale((1.0 / d)); return new Circle(cc.add(a),cc.length());} } static class Polygon{ P[] p ; Polygon( Collection<P> c){ this.p = c.toArray(new P[c.size()]); } Polygon( P[] p){ this.p = (P[])p.clone(); } double signedArea(){ double area = 0.0; for ( int i = 0;(i < p.length);i++) {area += p[i].det(p[((i + 1) % p.length)]); }return (area / 2.0);} public boolean contains_WN( P q){ int wn = 0;  int n = p.length; for ( int i = 0;(i < n);i++) { P p = this.p[i],pn = this.p[((i + 1) % n)]; if ( (p.y <= q.y)) {if ( (pn.y > q.y)) if ( p.isCCW(pn,q)) ++wn;  } else {if ( (pn.y <= q.y)) if ( !p.isCCW(pn,q)) --wn;  }}return (wn != 0);} @Override public String toString(){ return Arrays.toString(p);} } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( Reader in){ br = new BufferedReader(in); } public FastScanner(){ this(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} double nextDouble(){ return Double.parseDouble(next());} } }
2	public class DigitSequence{ public DigitSequence(){ } public static void main( String[] args){ Scanner in = new Scanner(System.in);  long k = in.nextLong();  long[] end = new long[12]; end[0] = -1; for ( int i = 1;(i < end.length);i++) {end[i] = (i * (long)Math.pow(10,i)); end[i] -= (((long)Math.pow(10,i) - 1) / 9); } int st = 0; for ( int i = 1;(i < end.length);i++) {if ( ((k >= (end[(i - 1)] + 1)) && (k <= end[i]))) st = i; } long diff = (k - end[(st - 1)]);  long mod = (((diff + st) - 1) % st);  long digit = -1;  int addOn = 0; if ( (mod == 0)) addOn = 1; if ( (mod == (st - 1))) addOn = -1; digit = (diff / (st * (long)Math.pow(10,((st - 1) - mod)))); digit += addOn; digit %= 10; System.out.println(digit); } }
5	public class stacks{ public static void main( String[] args)throws Exception { FastIO sc = new FastIO(System.in);  PrintWriter pw = new PrintWriter(System.out);  int n = sc.nextInt();  int m = sc.nextInt();  long remove = 0;  int[] heights = new int[(n + 1)]; for ( int i = 0;(i < n);i++) {heights[i] = sc.nextInt(); remove += heights[i]; }Arrays.sort(heights); long keep = 0; for ( int i = n;(i > 0);i--) {if ( (heights[(i - 1)] >= heights[i])) {heights[(i - 1)] = (heights[i] - 1); } keep += (heights[i] - heights[(i - 1)]); }pw.println((remove - keep)); pw.close(); } static class FastIO{ InputStream dis ; byte[] buffer = new byte[(1 << 17)]; int pointer = 0; public FastIO( String fileName)throws Exception{ dis = new FileInputStream(fileName); } public FastIO( InputStream is)throws Exception{ dis = is; } int nextInt()throws Exception { int ret = 0;  byte b ; do {b = nextByte(); }while((b <= ' ')); boolean negative = false; if ( (b == '-')) {negative = true; b = nextByte(); } while(((b >= '0') && (b <= '9'))){ret = (((10 * ret) + b) - '0'); b = nextByte(); }return (negative?-ret:ret);} byte nextByte()throws Exception { if ( (pointer == buffer.length)) {dis.read(buffer,0,buffer.length); pointer = 0; } return buffer[pointer++];} } }
2	public class A{ BufferedReader br ; PrintWriter out ; StringTokenizer st ; boolean eof ; void solve()throws IOException { int tot = nextInt();  int ok = nextInt();  int k = nextInt();  int maxBad = (tot / k); if ( ((tot - maxBad) >= ok)) {out.println(ok); return ;} int dbl = ((ok + (tot / k)) - tot);  int dblPoints = (pow(2,(dbl + 1)) - 2); while((dblPoints < 0))dblPoints += MOD; dblPoints = (int)(((long)dblPoints * k) % MOD); int rest = (ok - (dbl * k));  int ans = (dblPoints + rest); if ( (ans >= MOD)) ans -= MOD; out.println(ans); } static int pow( int a, int b){ int ret = 1; while((b != 0)){if ( ((b & 1) == 1)) ret = (int)(((long)ret * a) % MOD); a = (int)(((long)a * a) % MOD); b >>= 1; }return ret;} static final int MOD = 1000000009; A()throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.close(); } public static void main( String[] args)throws IOException { new A(); } String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ eof = true; return null;} }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
6	public class Main{ static int[][][] dp ; public static void main( String[] args){ Scanner r = new Scanner(System.in);  int n = r.nextInt();  int m = r.nextInt(); if ( (n > m)) { int t = n; n = m; m = t; } dp = new int[(m + 1)][(1 << 7)][(1 << 7)]; for ( int[][] i :dp) for ( int[] j :i) Arrays.fill(j,-1); int min = go(m,0,((1 << n) - 1),n,m); System.out.println(((n * m) - min)); } static private int go( int rem, int prev, int need, int n, int m){ if ( (rem == 0)) return ((prev == 0)?0:(1 << 20)); if ( (dp[rem][prev][need] != -1)) return dp[rem][prev][need]; int min = (1 << 20); for ( int now = 0;(now < (1 << n));now++) {if ( ((~now & prev) != 0)) continue; int after = (((need & ~now) & (now << 1)) & (now >> 1));  int next = (~now & ((1 << n) - 1));  int current = (Integer.bitCount(now) + go((rem - 1),after,next,n,m)); min = Math.min(min,current); }return dp[rem][prev][need] = min;} }
6	public class cf111c{ public static int n ,m ,maxm ; public static int[][][] dp ; public static int[] s ; public static int cal( int cur){ int res = 0; while((cur > 0)){res++; cur = (cur & (cur - 1)); }return res;} public static boolean check( int a, int b, int c){ int res = ((maxm - 1) & ((((b | (b << 1)) | (b >> 1)) | a) | c)); if ( (res == (maxm - 1))) return true; else return false;} public static void main( String[] argv){ Scanner in = new Scanner(System.in); n = in.nextInt(); m = in.nextInt(); if ( (n < m)) { int t = m; m = n; n = t; } maxm = (1 << m); int i ,j ,k ,l ; dp = new int[(n + 1)][(1 << m)][(1 << m)]; s = new int[(1 << m)]; for ( i = 0;(i < (n + 1));i++) {for ( j = 0;(j < maxm);j++) {Arrays.fill(dp[i][j],100); }}for ( i = 0;(i < maxm);i++) {s[i] = cal(i); dp[0][0][i] = 0; }for ( i = 1;(i <= n);i++) {for ( j = 0;(j < maxm);j++) {for ( k = 0;(k < maxm);k++) {for ( l = 0;(l < maxm);l++) {if ( ((dp[(i - 1)][k][l] != 100) && check(k,l,j))) {dp[i][l][j] = Math.min((dp[(i - 1)][k][l] + s[l]),dp[i][l][j]); } }}}} int ans = 100; for ( i = 0;(i < maxm);i++) ans = Math.min(dp[n][i][0],ans); System.out.println(((n * m) - ans)); return ;} }
6	public class ProblemB{ public static int _gnum ; public static int _cnum ; public static int _needs ; public static int _level ; public static double _maxans = 0; public static double votedfs( int[][] grl, int g, int votes){ if ( (votes >= _needs)) {return 1.0d;} if ( (g >= _gnum)) {return 0.0d;} double agrees = ((double)grl[g][1] / 100); return ((agrees * votedfs(grl,(g + 1),(votes + 1))) + ((1.0d - agrees) * votedfs(grl,(g + 1),votes)));} public static double battledfs( int[][] grl, int g, int votes, int levels){ if ( (votes >= _needs)) {return 0.0d;} if ( (g >= _gnum)) {return ((double)_level / (_level + levels));} double agrees = ((double)grl[g][1] / 100); return ((agrees * battledfs(grl,(g + 1),(votes + 1),levels)) + ((1.0d - agrees) * battledfs(grl,(g + 1),votes,(levels + grl[g][0]))));} public static void candydfs( int[][] grl, int g, int n){ if ( (g >= _gnum)) { double na = (votedfs(grl,0,0) + battledfs(grl,0,0,0)); _maxans = Math.max(_maxans,na); return ;} int rem = grl[g][1]; candydfs(grl,(g + 1),n); for ( int i = 1;(i <= n);i++) {if ( (grl[g][1] < 100)) {grl[g][1] += 10; candydfs(grl,(g + 1),(n - i)); } }grl[g][1] = rem; } public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String line = br.readLine();  String[] d = line.split(" ");  int gnum = Integer.valueOf(d[0]);  int cnum = Integer.valueOf(d[1]);  int level = Integer.valueOf(d[2]); _gnum = gnum; _cnum = cnum; _needs = ((gnum + 1) / 2); if ( ((gnum % 2) == 0)) {_needs += 1; } _level = level; int[][] grl = new int[gnum][2]; for ( int g = 0;(g < gnum);g++) {line = br.readLine(); String[] gg = line.split(" "); grl[g][0] = Integer.valueOf(gg[0]); grl[g][1] = Integer.valueOf(gg[1]); }for ( int a = 0;(a < gnum);a++) {for ( int b = 0;(b < (gnum - 1));b++) {if ( (grl[b][1] < grl[(b + 1)][1])) { int tmp = grl[b][0]; grl[b][0] = grl[(b + 1)][0]; grl[(b + 1)][0] = tmp; tmp = grl[b][1]; grl[b][1] = grl[(b + 1)][1]; grl[(b + 1)][1] = tmp; } }} int ag = 0;  int xnum = cnum; for ( int g = 0;(g < gnum);g++) { int needs = ((100 - grl[g][1]) / 10);  int roy = 0; if ( (needs <= xnum)) {xnum -= needs; roy = 100; } else {roy = (grl[g][1] + (xnum * 10)); xnum = 0; }if ( (roy >= 100)) {ag++; } }if ( (ag >= _needs)) {System.out.println(1.0); return ;} candydfs(grl,0,_cnum); System.out.println(_maxans); br.close(); } }
2	public class Quiz{ public static long pow( long base, long power){ if ( (power == 0)) return 1; long half = (pow(base,(power / 2)) % mod); half *= half; half %= mod; if ( ((power % 2) == 1)) half *= base; return (half % mod);} static long mod = (long)(1e9 + 9); public static void main( String[] args){ InputReader r = new InputReader(System.in);  int n = r.nextInt();  int m = r.nextInt();  int k = r.nextInt();  int buckets = (n / k);  int rem = (n - (buckets * k));  long low = 0,high = buckets,itr = 30; while((itr-- > 0)){ long mid = ((low + high) / 2);  long correct = (((mid * k) + rem) + ((buckets - mid) * (k - 1))); if ( (correct < m)) low = mid; else high = mid; } long pow = (((pow(2,(high + 1)) - 2) + mod) % mod); pow *= k; pow %= mod; long res = (((m - (high * k)) + pow) + (10 * mod)); res %= mod; System.out.println(res); } static class InputReader{ private BufferedReader reader ; private StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public InputReader( FileReader stream){ reader = new BufferedReader(stream); 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());} } }
2	public class D{ static long l ,r ; static long[][][][][] dp ; public static void main( String[] args)throws IOException { InputReader in = new InputReader(); l = in.nextLong(); r = in.nextLong(); dp = new long[65][2][2][2][2]; for ( int i = 0;(i < 65);i++) for ( int j = 0;(j < 2);j++) for ( int k = 0;(k < 2);k++) for ( int a = 0;(a < 2);a++) dp[i][j][k][a][0] = dp[i][j][k][a][1] = -1; System.out.println(go(63,0,0,0,0)); } public static long go( int i, int a1, int a2, int b1, int b2){ if ( (i == -1)) return 0; if ( (dp[i][a1][a2][b1][b2] != -1)) return dp[i][a1][a2][b1][b2]; int f1 = 3,f2 = 3;  int bl = ((int)(l >> i) & 1),br = (int)((r >> i) & 1); if ( ((a2 == 0) && (br == 0))) f1 &= 1; if ( ((a1 == 0) && (bl == 1))) f1 &= 2; if ( ((b2 == 0) && (br == 0))) f2 &= 1; if ( ((b1 == 0) && (bl == 1))) f2 &= 2;  long res = 0; for ( int x = 0;(x < 2);x++) {for ( int y = 0;(y < 2);y++) {if ( ((((f1 >> x) & 1) == 1) && (((f2 >> y) & 1) == 1))) {res = Math.max(res,(((long)(x ^ y) << i) + go((i - 1),(((x > bl) || (a1 == 1))?1:0),(((x < br) || (a2 == 1))?1:0),(((y > bl) || (b1 == 1))?1:0),(((y < br) || (b2 == 1))?1:0)))); } }}return dp[i][a1][a2][b1][b2] = res;} static class InputReader{ BufferedReader in ; StringTokenizer st ; public InputReader()throws IOException{ in = new BufferedReader(new InputStreamReader(System.in)); st = new StringTokenizer(in.readLine()); } public String next()throws IOException { while(!st.hasMoreElements())st = new StringTokenizer(in.readLine()); return st.nextToken();} public long nextLong()throws NumberFormatException,IOException { return Long.parseLong(next());} } }
5	public class kMultRedo{ static int n ; static int k ; public static void main( String[] args){ Set<Integer> set = new HashSet<Integer>(1000000);  FastScanner s = new FastScanner(); n = s.nextInt(); k = s.nextInt(); int[] a = new int[n]; for ( int i = 0;(i < n);i++) {a[i] = s.nextInt(); }Arrays.sort(a); for ( int i = 0;(i < n);i++) {if ( ((a[i] % k) != 0)) {set.add(a[i]); } else {if ( !set.contains((a[i] / k))) {set.add(a[i]); } }}System.out.println(set.size()); } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( String s){ try{br = new BufferedReader(new FileReader(s)); }catch (FileNotFoundException e){ 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){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(nextToken());} } }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ public void solve( int testNumber, InputReader in, OutputWriter out){ int N = in.nextInt();  int r = in.nextInt();  int i ,j ;  BigDecimal initial = new BigDecimal(10); initial = initial.pow(100); int x[] = new int[N];  BigDecimal y[] = new BigDecimal[N]; Arrays.fill(y,initial); for ( i = 0;(i < N);i++) {x[i] = in.nextInt(); }for ( i = 0;(i < N);i++) { BigDecimal y2 = new BigDecimal(r); for ( j = 0;(j < i);j++) {if ( (Math.abs((x[i] - x[j])) <= (2 * r))) { double xDiff = (x[i] - x[j]); xDiff *= xDiff; xDiff = (((4 * r) * r) - xDiff); xDiff = Math.sqrt(xDiff); BigDecimal yNew = new BigDecimal(xDiff); yNew = yNew.add(y[j]); if ( (yNew.compareTo(y2) > 0)) {y2 = yNew; } } }y[i] = y2; }for ( i = 0;(i < N);i++) {out.print((y[i] + " ")); }} } static class InputReader{ BufferedReader in ; StringTokenizer tokenizer = null; public InputReader( InputStream inputStream){ in = new BufferedReader(new InputStreamReader(inputStream)); } public String next(){ try{while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(in.readLine()); }return tokenizer.nextToken(); }catch (IOException e){ return null;} } public int nextInt(){ return Integer.parseInt(next());} } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void close(){ writer.close(); } } }
2	public class Solution{ static BufferedReader br ; static int[] ans ; public static void main( String[] args)throws Exception { br = new BufferedReader(new InputStreamReader(System.in)); ans = new int[8]; int n = Integer.parseInt(br.readLine()); System.out.println((((("?" + "1 1 ") + n) + " ") + n)); System.out.flush(); int q = Integer.parseInt(br.readLine()); cut(n); System.out.print("! "); for ( int i = 0;(i < 8);i++) System.out.print((ans[i] + " ")); System.out.println(); } public static void solve( int x1, int y1, int x2, int y2, int t)throws Exception { int l = x1,r = x2;  int xx1 ,yy1 ,xx2 ,yy2 ; while((l < r)){ int mid = ((l + r) / 2); if ( (query(x1,y1,mid,y2) == 1)) r = mid; else l = (mid + 1); }xx2 = l; l = x1; r = x2; while((r > l)){ int mid = (((l + r) + 1) / 2); if ( (query(mid,y1,x2,y2) == 1)) l = mid; else r = (mid - 1); }xx1 = l; l = y1; r = y2; while((l < r)){ int mid = ((l + r) / 2); if ( (query(x1,y1,x2,mid) == 1)) r = mid; else l = (mid + 1); }yy2 = l; l = y1; r = y2; while((r > l)){ int mid = (((l + r) + 1) / 2); if ( (query(x1,mid,x2,y2) == 1)) l = mid; else r = (mid - 1); }yy1 = l; ans[t] = xx1; ans[(t + 1)] = yy1; ans[(t + 2)] = xx2; ans[(t + 3)] = yy2; } public static void cut( int n)throws Exception { int l = 1,r = n; while((l < r)){ int mid = ((l + r) / 2); if ( (query(1,1,n,mid) == 0)) l = (mid + 1); else r = mid; }if ( ((query(1,1,n,l) == 1) && (query(1,(l + 1),n,n) == 1))) {solve(1,1,n,l,0); solve(1,(l + 1),n,n,4); return ;} l = 1; r = n; while((l < r)){ int mid = ((l + r) / 2); if ( (query(1,1,mid,n) == 0)) l = (mid + 1); else r = mid; }solve(1,1,l,n,0); solve((l + 1),1,n,n,4); } public static int query( int x1, int y1, int x2, int y2)throws Exception { System.out.println(((((((("?" + x1) + " ") + y1) + " ") + x2) + " ") + y2)); System.out.flush(); int q = Integer.parseInt(br.readLine()); return q;} }
3	public class Codeshefcode{ public static void main( String[] args)throws IOException { Solver Machine = new Solver(); Machine.Solve(); Machine.Finish(); } } class Solver{ Reader ip = new Reader(System.in); PrintWriter op = new PrintWriter(System.out); public void Solve()throws IOException { int n = ip.i();  int r = ip.i();  double x[] = new double[n];  double y[] = new double[n]; for ( int i = 0;(i < n);i++) x[i] = ip.i(); for ( int i = 0;(i < n);i++) { double my = 0; for ( int j = 0;(j < i);j++) my = max(my,func(x[j],y[j],r,x[i])); y[i] = my; }for ( int i = 0;(i < n);i++) p(((y[i] + r) + " ")); pln(""); } double abd( double x, double y){ return ((x > y)?(x - y):(y - x));} double func( double x1, double y1, double r, double x2){ if ( (abd(x1,x2) > (2 * r))) return 0; if ( (abd(x1,x2) == (2 * r))) return y1; double dx = (x1 - x2);  double dx2 = (dx * dx);  double val = sqrt((((4 * r) * r) - dx2)); return (y1 + val);} void Finish(){ op.flush(); op.close(); } void p( Object o){ op.print(o); } void pln( Object o){ op.println(o); } } class Reader{ BufferedReader reader ; StringTokenizer tokenizer ; Reader( InputStream input){ reader = new BufferedReader(new InputStreamReader(input)); tokenizer = new StringTokenizer(""); } String s()throws IOException { while(!tokenizer.hasMoreTokens()){tokenizer = new StringTokenizer(reader.readLine()); }return tokenizer.nextToken();} int i()throws IOException { return Integer.parseInt(s());} }
4	public class E{ FastScanner in ; PrintWriter out ; private int M ; public static void main( String[] args){ new E().solve(); } private void solve(){ in = new FastScanner(System.in); out = new PrintWriter(System.out); solveCase(); out.close(); } long[][] comb = new long[512][512]; private void solveCase(){ int n = in.nextInt(); this.M = in.nextInt(); calcComb(n,M); for ( int i = 0;(i < 512);i++) {for ( int j = 0;(j < 512);j++) {memoDivide[i][j] = -1; memoDP[i][j] = -1; dpG[i] = -1; }} long res = g(n); for ( int i = 1;(i <= (n - 1));i++) {res = ((res + dp(n,i)) % M); }out.println(res); } long[] dpG = new long[512]; private long g( int n){ if ( (n < 2)) return 1; if ( (n == 2)) return 2; if ( (dpG[n] != -1)) return dpG[n]; long res = 0; for ( int divide = 0;(divide < n);divide++) {res = ((res + divider(divide,((n - divide) - 1))) % M); }return dpG[n] = res;} long[][] memoDivide = new long[512][512]; private long divider( int a, int b){ if ( ((a == 0) || (b == 0))) return 1; if ( (memoDivide[a][b] != -1)) return memoDivide[a][b]; return memoDivide[a][b] = ((divider((a - 1),b) + divider(a,(b - 1))) % M);} long[][] memoDP = new long[512][512]; private long dp( int n, int i){ if ( ((n > 0) && (i == 0))) return 0; if ( ((n == 0) && (i > 0))) return 0; if ( (i > n)) return 0; if ( ((n == 0) && (i == 0))) return 1; if ( (i == n)) return g(n); if ( (i <= 1)) return 0; if ( (memoDP[n][i] != -1)) return memoDP[n][i]; long res = 0; for ( int failure = 1;((failure < (n - 1)) && ((i - failure) >= 1));failure++) {res += (((g(failure) * comb[i][failure]) % M) * dp(((n - failure) - 1),(i - failure))); res %= M; }return memoDP[n][i] = res;} private void calcComb( int n, int m){ for ( int i = 0;(i < 512);i++) {comb[0][i] = 0; }for ( int i = 0;(i < 512);i++) {comb[i][0] = 1; }for ( int i = 1;(i <= n);i++) {for ( int j = 1;(j <= n);j++) {comb[i][j] = ((comb[(i - 1)][j] + comb[(i - 1)][(j - 1)]) % m); }}} static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( File f){ try{br = new BufferedReader(new FileReader(f)); }catch (FileNotFoundException e){ e.printStackTrace(); } } public FastScanner( InputStream f){ br = new BufferedReader(new InputStreamReader(f)); } String next(){ while(((st == null) || !st.hasMoreTokens())){ String s = null; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } if ( (s == null)) return null; st = new StringTokenizer(s); }return st.nextToken();} boolean hasMoreTokens(){ while(((st == null) || !st.hasMoreTokens())){ String s = null; try{s = br.readLine(); }catch (IOException e){ e.printStackTrace(); } if ( (s == null)) return false; st = new StringTokenizer(s); }return true;} int nextInt(){ return Integer.parseInt(next());} } }
4	public class E14G{ static int[][] choose ; public static void main( String[] args)throws IOException { init_io(); int N = nint(),M = nint(); choose = new int[(N + 1)][]; long[] ways = new long[(N + 1)]; ways[0] = 1; ways[1] = 1; for ( int i = 0;(i <= N);i++) choose[i] = new int[(i + 1)]; for ( int i = 0;(i <= N);i++) {choose[i][0] = choose[i][i] = 1; for ( int j = 1;(j < i);j++) {choose[i][j] = ((choose[(i - 1)][(j - 1)] + choose[(i - 1)][j]) % M); }}for ( int i = 2;(i <= N);i++) {for ( int j = 0;(j < i);j++) {ways[i] = ((ways[i] + choose[(i - 1)][j]) % M); }} long[][] dp = new long[(((N + 1) / 2) + 1)][(N + 1)]; dp[0][0] = 1; for ( int i = 1;(i <= ((N + 1) / 2));i++) {for ( int j = 1;(j <= N);j++) {for ( int k = 1;(k <= j);k++) {dp[i][j] = ((dp[i][j] + ((((ways[k] * choose[j][k]) % M) * dp[(i - 1)][(j - k)]) % M)) % M); }}} long ans = 0; for ( int i = 1;(i <= ((N + 1) / 2));i++) {ans = ((ans + dp[i][(N - (i - 1))]) % M); }out.println(ans); out.close(); } static StreamTokenizer in ; static PrintWriter out ; static BufferedReader br ; static int nint()throws IOException { in.nextToken(); return (int)in.nval;} static void init_io()throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); in = new StreamTokenizer(br); out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); } }
6	public class cfe{ static DataReader input ; static int LARGE_INT = 1000000007; static final int[] BM = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,(1 << 17),(1 << 18),(1 << 19),(1 << 20)}; public static void main( String[] args)throws IOException { input = new DataReader(); PrintWriter out = new PrintWriter(System.out);  int N = nextInt(),M = nextInt(),P = (1 << M);  String x = nextStr();  int c1 = (x.charAt(0) - 'a');  int[][] pair_count = new int[M][M]; for ( int i = 1;(i < N);i++) { int c2 = (x.charAt(i) - 'a'); if ( (c1 < c2)) pair_count[c1][c2]++; else if ( (c1 > c2)) pair_count[c2][c1]++; c1 = c2; } int[] group_count = new int[P]; for ( int mask = 1;(mask < P);mask++) { int j ; for ( j = 0;(j < M);j++) {if ( ((mask & BM[j]) > 0)) break; } int nmask = (mask ^ BM[j]);  int val = group_count[nmask]; for ( int i = 0;(i < j);i++) {if ( ((mask & BM[i]) > 0)) val -= pair_count[i][j]; else val += pair_count[i][j]; }for ( int i = (j + 1);(i < M);i++) {if ( ((mask & BM[i]) > 0)) val -= pair_count[j][i]; else val += pair_count[j][i]; }group_count[mask] = val; } int[][] dp = new int[(M + 1)][P]; for ( int mask = 1;(mask < P);mask++) {dp[0][mask] = 0; int k = Integer.bitCount(mask);  int val = LARGE_INT; for ( int j = 0;(j < M);j++) {if ( ((mask & BM[j]) > 0)) { int nmask = (mask ^ BM[j]); val = Math.min(val,(dp[(k - 1)][nmask] + group_count[nmask])); } }dp[k][mask] = val; }out.println(dp[M][(P - 1)]); out.flush(); out.close(); } static int nextInt()throws IOException { return Integer.parseInt(input.next());} static String nextStr()throws IOException { return input.next();} static class DataReader{ BufferedReader br ; StringTokenizer st ; public DataReader()throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); } boolean hasNext()throws IOException { while(((st == null) || !st.hasMoreElements())){ String line = br.readLine(); if ( (line == null)) {return false;} st = new StringTokenizer(line); }return true;} String next()throws IOException { if ( hasNext()) return st.nextToken(); else return null;} } }
0	public class A235{ public static void main( String[] args)throws Exception { BufferedReader ip = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(ip.readLine());  int a ,b ,c ;  int x = 0,y = 0,z = 0;  BigInteger l ,t ; if ( ((n - 2) > 1)) {a = n; b = (n - 1); c = (n - 2); } else {a = n; if ( ((n - 1) > 1)) b = (n - 1); else b = 1; c = 1; System.out.println((a * b)); return ;}if ( ((n - 3) > 1)) {x = (n - 1); y = (n - 2); z = (n - 3); } if ( ((n % 2) == 0)) if ( ((n % 3) == 0)) l = BigInteger.valueOf(x).multiply(BigInteger.valueOf(y).multiply(BigInteger.valueOf(z))); else {l = BigInteger.valueOf(a).multiply(BigInteger.valueOf(b).multiply(BigInteger.valueOf((c - 1)))); t = BigInteger.valueOf(x).multiply(BigInteger.valueOf(y).multiply(BigInteger.valueOf(z))); if ( (l.compareTo(t) < 0)) l = t; } else l = BigInteger.valueOf(a).multiply(BigInteger.valueOf(b).multiply(BigInteger.valueOf(c))); System.out.println(l); } }
4	public class D{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni(),m = ni();  int[] from = new int[m];  int[] to = new int[m]; for ( int i = 0;(i < m);i++) {from[i] = (ni() - 1); to[i] = (ni() - 1); } int[] nfrom = new int[m];  int[] nto = new int[m];  int min = 999999999; for ( int i = 0;(i < n);i++) { int p = 0; for ( int j = 0;(j < m);j++) {if ( ((from[j] != i) && (to[j] != i))) {nfrom[p] = from[j]; nto[p] = to[j]; p++; } } int[][] g = packD(n,nfrom,nto,p);  int mat = doBipartiteMatchingHKNoRec(g,n);  int ch = ((p - mat) + ((n - 1) - mat)); ch += (((2 * n) - 1) - (m - p)); min = Math.min(min,ch); }out.println(min); } public static int doBipartiteMatchingHKNoRec( int[][] g, int m){ int n = g.length; if ( (n == 0)) return 0; int[] from = new int[m];  int[] to = new int[n]; Arrays.fill(to,-1); Arrays.fill(from,n); int[] d = new int[(n + 1)];  int mat = 0;  int[] stack = new int[(n + 1)];  int[] adjind = new int[(n + 1)]; while(true){Arrays.fill(d,-1); int[] q = new int[n];  int r = 0; for ( int i = 0;(i < n);i++) {if ( (to[i] == -1)) {d[i] = 0; q[r++] = i; } }for ( int p = 0;(p < r);p++) { int cur = q[p]; for ( int adj :g[cur]) { int nex = from[adj]; if ( (d[nex] == -1)) {if ( (nex != n)) q[r++] = nex; d[nex] = (d[cur] + 1); } }}if ( (d[n] == -1)) break; for ( int i = 0;(i < n);i++) {if ( (to[i] == -1)) { int sp = 1; stack[0] = i; adjind[0] = 0; boolean prevB = false; outer:while((sp >= 1)){ int cur = stack[(sp - 1)]; if ( (cur == n)) {prevB = true; sp--; continue;} for ( ;(adjind[(sp - 1)] < (2 * g[cur].length));) { int adj = g[cur][(adjind[(sp - 1)] / 2)]; if ( ((adjind[(sp - 1)] % 2) == 0)) { int nex = from[adj]; if ( (d[nex] == (d[cur] + 1))) {stack[sp] = nex; adjind[sp] = 0; adjind[(sp - 1)]++; sp++; continue outer;} else {adjind[(sp - 1)] += 2; }} else {if ( prevB) {to[cur] = adj; from[adj] = cur; prevB = true; sp--; continue outer;} adjind[(sp - 1)]++; }}d[cur] = -1; prevB = false; sp--; }if ( prevB) mat++; } }}return mat;} public static int[][] packD( int n, int[] from, int[] to, int sup){ int[][] g = new int[n][];  int[] p = new int[n]; for ( int i = 0;(i < sup);i++) p[from[i]]++; for ( int i = 0;(i < n);i++) g[i] = new int[p[i]]; for ( int i = 0;(i < sup);i++) {g[from[i]][--p[from[i]]] = to[i]; }return g;} 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 D().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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
4	public class Main{ static PrintWriter out ; static Reader in ; public static void main( String[] args)throws IOException { input_output(); Main solver = new Main(); solver.solve(); out.close(); out.flush(); } static long INF = (long)1e18; static int MAXN = ((int)1e7 + 5); static int mod = 998_244_353; static int n ,m ,q ,t ; static double pi = Math.PI; void solve()throws IOException { t = in.nextInt(); int[] div = new int[MAXN]; Arrays.fill(div,1); for ( int i = 2;(i < MAXN);i++) {if ( (div[i] == 1)) {for ( int j = i;(j < MAXN);j += i) {div[j] = i; }} }while((t-- > 0)){n = in.nextInt(); int k = in.nextInt();  int[] arr = new int[(n + 1)]; for ( int i = 1;(i <= n);i++) {arr[i] = in.nextInt(); int tmp = arr[i],newn = 1; while((div[arr[i]] != 1)){ int elm = div[arr[i]],cnt = 0; while((div[arr[i]] == elm)){cnt++; arr[i] /= elm; }if ( ((cnt % 2) == 1)) newn *= elm; }newn *= arr[i]; arr[i] = newn; } int[] close = new int[(n + 1)];  List<Node> list = new ArrayList<>(); for ( int i = 1;(i <= n);i++) list.add(new Node(arr[i],i)); Collections.sort(list); for ( int i = 0;(i < n);i++) {if ( ((i == (n - 1)) || (list.get((i + 1)).val != list.get(i).val))) {close[list.get(i).idx] = -1; } else {close[list.get(i).idx] = list.get((i + 1)).idx; }} int[][] next = new int[(n + 1)][(k + 1)];  List<Integer> upd = new ArrayList<>();  List<Integer> nupd = new ArrayList<>(); for ( int i = 0;(i <= k);i++) next[n][i] = n; for ( int i = (n - 1);(i >= 1);i--) {nupd.clear(); if ( (close[i] == -1)) {for ( int j = 0;(j <= k);j++) next[i][j] = next[(i + 1)][j]; } else { int tmp = (close[i] - 1),cnt = 0; if ( ((upd.size() == 0) || (tmp < upd.get(0)))) {nupd.add(tmp); tmp = -1; } for ( int j = 0;(j < upd.size());j++) {if ( (((nupd.size() < (k + 1)) && (tmp != -1)) && (tmp < upd.get(j)))) {nupd.add(tmp); tmp = -1; } if ( (nupd.size() < (k + 1))) nupd.add(upd.get(j)); }if ( ((tmp != -1) && (nupd.size() < (k + 1)))) nupd.add(tmp); for ( int j = 0;(j < nupd.size());j++) next[i][j] = nupd.get(j); for ( int j = nupd.size();(j <= k);j++) next[i][j] = n; upd.clear(); for ( int j = 0;(j < nupd.size());j++) upd.add(nupd.get(j)); }} int[][] dp = new int[(n + 1)][(k + 1)]; for ( int i = 1;(i <= n);i++) for ( int j = 0;(j <= k);j++) dp[i][j] = n; for ( int i = 0;(i < n);i++) {for ( int cur = 0;(cur <= k);cur++) {for ( int ncur = cur;(ncur <= k);ncur++) {dp[next[(i + 1)][(ncur - cur)]][ncur] = Math.min(dp[next[(i + 1)][(ncur - cur)]][ncur],(dp[i][cur] + 1)); }}} int ans = n; for ( int i = 0;(i <= k);i++) ans = Math.min(ans,dp[n][i]); out.println(ans); }} static class Node implements Comparable<Node>{ int val ,idx ; Node( int val, int idx){ this.val = val; this.idx = idx; } } static class Reader{ private InputStream mIs ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public Reader(){ this(System.in); } public Reader( InputStream is){ mIs = is; } public int read(){ if ( (numChars == -1)) {throw (new InputMismatchException());} if ( (curChar >= numChars)) {curChar = 0; try{numChars = mIs.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) {return -1;} } return buf[curChar++];} 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 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 boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} } static void input_output()throws IOException { File f = new File("in.txt"); if ( (f.exists() && !f.isDirectory())) {in = new Reader(new FileInputStream("in.txt")); } else in = new Reader(); f = new File("out.txt"); if ( (f.exists() && !f.isDirectory())) {out = new PrintWriter(new File("out.txt")); } else out = new PrintWriter(System.out); } }
5	public class A implements Runnable{ BufferedReader in ; PrintWriter out ; StringTokenizer tok ; public static void main( String[] args){ new Thread(null,new A(),"",((64 * 1024) * 1024)).start(); } String readString()throws IOException { while(!tok.hasMoreTokens()){ String line = in.readLine(); if ( (line == null)) return null; tok = new StringTokenizer(line); }return tok.nextToken();} int readInt()throws IOException { return Integer.parseInt(readString());} long readLong()throws IOException { return Long.parseLong(readString());} void debug( Object... o){ if ( LOCAL) {System.err.println(Arrays.deepToString(o)); } } static final boolean LOCAL = (System.getProperty("ONLINE_JUDGE") == null); void solve()throws IOException { int n = readInt();  long k = readLong(); if ( (k == 1)) {out.println(n); return ;} long[] a = new long[n]; for ( int i = 0;(i < n);i++) {a[i] = readLong(); }Mergesort.sort(a); int ans = 0;  boolean[] processed = new boolean[n]; debug(a); for ( int i = 0;(i < n);i++) {if ( processed[i]) {continue;} processed[i] = true; long cur = a[i]; ans++; int index = Arrays.binarySearch(a,(cur * k)); if ( (index >= 0)) {processed[index] = true; } }out.println(ans); } }
0	public class TwentyFive{ public static void main( String[] args){ System.out.println(25); } }
3	public class C{ FastScanner in ; PrintWriter out ; boolean systemIO = true; public void solve(){ int n = in.nextInt();  int r = (2 * in.nextInt());  int[] x = new int[n]; for ( int i = 0;(i < x.length);i++) {x[i] = in.nextInt(); } double[] y = new double[n]; for ( int i = 0;(i < y.length);i++) {y[i] = (r / 2); }for ( int i = 0;(i < y.length);i++) {for ( int j = 0;(j < i);j++) {if ( (Math.abs((x[i] - x[j])) == r)) {y[i] = Math.max(y[i],y[j]); } else if ( (Math.abs((x[i] - x[j])) < r)) {y[i] = Math.max(y[i],(y[j] + Math.sqrt(((r * r) - ((x[j] - x[i]) * (x[j] - x[i])))))); } }}for ( int i = 0;(i < y.length);i++) {out.print((y[i] + " ")); }} public void run(){ try{if ( systemIO) {in = new FastScanner(System.in); out = new PrintWriter(System.out); } else {in = new FastScanner(new File("segments.in")); out = new PrintWriter(new File("segments.out")); }solve(); out.close(); }catch (IOException e){ e.printStackTrace(); } } class FastScanner{ BufferedReader br ; StringTokenizer st ; FastScanner( File f){ try{br = new BufferedReader(new FileReader(f)); }catch (FileNotFoundException e){ e.printStackTrace(); } } FastScanner( InputStream f){ br = new BufferedReader(new InputStreamReader(f)); } String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } public static void main( String[] arg){ new C().run(); } }
0	public class Test{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); if ( ((n % 2) == 0)) {System.out.println(((4 + " ") + (n - 4))); } else {System.out.println(((9 + " ") + (n - 9))); }} }
2	public class DigitSequenceA{ public static void main( String[] args)throws IOException { FastReader in = new FastReader();  double digit = in.nextDouble();  double temp = digit;  long[] seq = new long[13]; for ( int i = 1;(i < 13);i++) {seq[i] = ((9 * (long)Math.pow(10,(i - 1))) * (i)+seq[(i - 1)]); } int power = 0; for ( int i = 0;(i < 13);i++) {if ( ((temp - seq[i]) > 0)) {continue;} else {power = i; break;}} long place = (long)Math.ceil((digit - seq[(power - 1)])); place = (long)Math.ceil((place / power)); if ( (((digit - seq[(power - 1)]) % power) > 0)) {place++; } long num = (long)((place + Math.pow(10,(power - 1))) - 1);  String num2 = Long.toString(num);  long end = (seq[(power - 1)] + (place * power));  long answer = (long)(power - (end - digit)); System.out.println(num2.charAt(((int)answer - 1))); } static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} double nextDouble(){ return Double.parseDouble(next());} } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  BTheHat solver = new BTheHat(); solver.solve(1,in,out); out.close(); } static class BTheHat{ InputReader in ; OutputWriter out ; int n ; int ask( int student){ student %= n; out.println(("? " + (student + 1))); out.flush(); return in.nextInt();} public void solve( int testNumber, InputReader in, OutputWriter out){ this.in = in; this.out = out; n = in.nextInt(); int a = ask(0),b = ask((n / 2)); if ( (((a + b) % 2) != 0)) {out.println("! -1"); out.flush(); return ;} if ( (a == b)) {out.println("! 1"); out.flush(); return ;} int lo = 0,hi = (n / 2); while((lo < hi)){ int mid = ((lo + hi) / 2);  int f1 = ask(mid),f2 = ask((mid + (n / 2))); if ( (f1 == f2)) {out.println(("! " + (mid + 1))); return ;} if ( ((a > b) == (f1 > f2))) {lo = (mid + 1); } else {hi = (mid - 1); }}out.println(("! " + (lo + 1))); out.flush(); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[(1 << 16)]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } public int read(){ if ( (this.numChars == -1)) {throw (new InputMismatchException());} else {if ( (this.curChar >= this.numChars)) {this.curChar = 0; try{this.numChars = this.stream.read(this.buf); }catch (IOException var2){ throw (new InputMismatchException());} if ( (this.numChars <= 0)) {return -1;} } return this.buf[this.curChar++];}} public int nextInt(){ int c ; for ( c = this.read();isSpaceChar(c);c = this.read()) {;} byte sgn = 1; if ( (c == 45)) {sgn = -1; c = this.read(); } int res = 0; while(((c >= 48) && (c <= 57))){res *= 10; res += (c - 48); c = this.read(); if ( isSpaceChar(c)) {return (res * sgn);} }throw (new InputMismatchException());} public static boolean isSpaceChar( int c){ return (((((c == 32) || (c == 10)) || (c == 13)) || (c == 9)) || (c == -1));} } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }} public void println( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } public void flush(){ writer.flush(); } } }
2	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);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ int N ; public void solve( int testNumber, InputReader in, PrintWriter out){ N = in.nextInt(); int low = 1;  int lowVal = getval(1,out,in);  int high = ((N / 2) + 1);  int highVal = -lowVal; if ( ((Math.abs(lowVal) % 2) == 1)) {out.println("! -1"); out.flush(); } else {while((low < high)){ int mid = ((low + high) / 2);  int a = getval(mid,out,in); if ( (Integer.signum(a) == 0)) {out.println(("! " + mid)); out.flush(); return ;} else {if ( (Integer.signum(a) == Integer.signum(lowVal))) {low = (mid + 1); } else {high = mid; }}}out.println(("! " + low)); out.flush(); }} int getval( int i, PrintWriter out, InputReader in){ out.println(("? " + i)); out.flush(); int a = in.nextInt(); out.println(("? " + (i + (N / 2)))); out.flush(); int b = in.nextInt(); return (a - b);} } 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());} } }
6	public class CF16E{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  double[][] aa = new double[n][n]; for ( int i = 0;(i < n);i++) { StringTokenizer st = new StringTokenizer(br.readLine()); for ( int j = 0;(j < n);j++) aa[i][j] = Double.parseDouble(st.nextToken()); } double[][] pp = new double[(1 << n)][n]; for ( int k = 0;(k < n);k++) pp[(1 << k)][k] = 1; for ( int b = 1;(b < (1 << n));b++) { int c = 0; for ( int i = 0;(i < n);i++) {if ( ((b & (1 << i)) == 0)) continue; c++; for ( int j = (i + 1);(j < n);j++) {if ( ((b & (1 << j)) == 0)) continue; for ( int k = 0;(k < n);k++) {if ( ((b & (1 << k)) == 0)) continue; pp[b][k] += (aa[i][j] * pp[(b ^ (1 << j))][k]); pp[b][k] += (aa[j][i] * pp[(b ^ (1 << i))][k]); }}}if ( (c > 1)) { double p = (((double)c * (c - 1)) / 2); for ( int k = 0;(k < n);k++) pp[b][k] /= p; } } StringBuilder sb = new StringBuilder();  int b = ((1 << n) - 1); for ( int k = 0;(k < n);k++) sb.append(pp[b][k]).append(((k == (n - 1))?'\n':' ')); System.out.print(sb); } }
2	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);  TaskD solver = new TaskD(); solver.solve(1,in,out); out.close(); } } class TaskD{ public void solve( int testNumber, Scanner in, PrintWriter out){ out.println(solve(in.nextLong(),in.nextLong())); } long solve( long l, long r){ if ( (l == r)) return 0; long ans = (l ^ (l + 1)); for ( int i = 0;(i < 62);i++) {l |= (1l << i); if ( ((l + 1) <= r)) ans = ((1l << (i + 2l)) - 1); }return ans;} } class Scanner{ BufferedReader in ; StringTokenizer tok ; public Scanner( InputStream in){ this.in = new BufferedReader(new InputStreamReader(in)); tok = new StringTokenizer(""); } public String nextToken(){ if ( !tok.hasMoreTokens()) {try{ String newLine = in.readLine(); if ( (newLine == null)) throw (new InputMismatchException()); tok = new StringTokenizer(newLine); }catch (IOException e){ throw (new InputMismatchException());} return nextToken();} return tok.nextToken();} public long nextLong(){ return Long.parseLong(nextToken());} }
2	public class Main{ public static void main( String[] args){ try{ String str ;  BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  BufferedOutputStream bos = new BufferedOutputStream(System.out);  String eol = System.getProperty("line.separator");  byte[] eolb = eol.getBytes();  byte[] spaceb = " ".getBytes(); str = br.readLine(); int blank = str.indexOf(" ");  long l = Long.parseLong(str.substring(0,blank));  long r = Long.parseLong(str.substring((blank + 1)));  String one = "";  String two = ""; while((l > 0)){if ( ((l % 2) == 0)) {one = "0".concat(one); } else {one = "1".concat(one); }l /= 2; }while((r > 0)){if ( ((r % 2) == 0)) {two = "0".concat(two); } else {two = "1".concat(two); }r /= 2; }while((one.length() < 60)){one = "0".concat(one); }while((two.length() < 60)){two = "0".concat(two); } int iter = 0;  String xor = "";  boolean big = false;  boolean small = false; while((one.charAt(iter) == two.charAt(iter))){xor = xor.concat("0"); iter++; if ( (iter == 60)) {break;} }for ( int i = iter;(i < 60);i++) {xor = xor.concat("1"); }bos.write(new BigInteger(xor,2).toString().getBytes()); bos.write(eolb); bos.flush(); }catch (IOException ioe){ ioe.printStackTrace(); } } }
4	public class Main{ void run(){ Locale.setDefault(Locale.US); boolean oj = (System.getProperty("ONLINE_JUDGE") != null); try{if ( oj) {sc = new FastScanner(new InputStreamReader(System.in)); out = new PrintWriter(new OutputStreamWriter(System.out)); } else {sc = new FastScanner(new FileReader("in.txt")); out = new PrintWriter(new FileWriter("out.txt")); } }catch (Exception e){ System.exit(-1); } long tB = System.currentTimeMillis(); solve(); if ( !oj) System.err.println(("Time: " + ((System.currentTimeMillis() - tB) / 1e3))); out.flush(); } class FastScanner{ BufferedReader br ; StringTokenizer st = new StringTokenizer(""); FastScanner( InputStreamReader a){ br = new BufferedReader(a); } FastScanner( FileReader a){ br = new BufferedReader(a); } String next(){ while(!st.hasMoreTokens())try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ return null;} return st.nextToken();} String readLine(){ try{return br.readLine(); }catch (Exception e){ return null;} } int nextInt(){ return Integer.parseInt(next());} } FastScanner sc ; PrintWriter out ; public static void main( String[] args){ new Main().run(); } void exit( int val){ out.flush(); System.exit(val); } int n ,m ; boolean[][] grid ; ArrayList<Integer>[] gr ; int c ; int[] mt ; boolean[] u ; boolean try_kuhn( int v){ if ( u[v]) return false; u[v] = true; for ( int to :gr[v]) {if ( ((to == c) || !grid[v][to])) continue; if ( ((mt[to] == -1) || try_kuhn(mt[to]))) {mt[to] = v; return true;} }return false;} void solve(){ n = sc.nextInt(); m = sc.nextInt(); grid = new boolean[(n + 1)][(n + 1)]; gr = new ArrayList[(n + 1)]; for ( int v = 1;(v <= n);++v) gr[v] = new ArrayList<Integer>(); for ( int it = 0;(it < m);++it) { int a = sc.nextInt();  int b = sc.nextInt(); grid[a][b] = true; gr[a].add(b); } int ans = Integer.MAX_VALUE; for ( c = 1;(c <= n);++c) { int curAns = 0; for ( int v = 1;(v <= n);++v) if ( (v != c)) {if ( !grid[c][v]) ++curAns; if ( !grid[v][c]) ++curAns; } if ( !grid[c][c]) ++curAns; mt = new int[(n + 1)]; fill(mt,-1); for ( int i = 1;(i <= n);++i) if ( (i != c)) {u = new boolean[(n + 1)]; try_kuhn(i); } int szMt = 0; for ( int i = 1;(i <= n);++i) if ( (mt[i] != -1)) ++szMt; curAns += ((n - 1) - szMt); for ( int a = 1;(a <= n);++a) {for ( int b :gr[a]) {if ( (((a == c) || (b == c)) || !grid[a][b])) continue; if ( (a == mt[b])) ++curAns; }}ans = min(ans,curAns); }out.println(ans); } }
5	public class Template{ BufferedReader in ; PrintWriter out ; StringTokenizer st ; String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (Exception e){ } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} public void run()throws Exception { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); Long start = System.currentTimeMillis();  int n = nextInt();  long k = nextLong();  long[] a = new long[n];  TreeMap<Long,Integer> st = new TreeMap<Long,Integer>(); for ( int i = 0;(i < n);i++) {a[i] = nextLong(); st.put(a[i],1); }Arrays.sort(a); for ( int i = 0;(i < n);i++) {if ( ((a[i] % k) == 0)) { long x = (a[i] / k); if ( st.containsKey(x)) { int y = st.get(x); st.remove(a[i]); st.put(a[i],(y + 1)); } } } int ans = 0; for ( int i = 0;(i < n);i++) {ans += ((st.get(a[((n - i) - 1)]) + 1) / 2); if ( ((a[((n - i) - 1)] % k) == 0)) { long x = (a[((n - i) - 1)] / k); if ( st.containsKey(x)) {st.remove(x); st.put(x,0); } } }out.println(ans); Long end = System.currentTimeMillis(); out.close(); } public static void main( String[] args)throws Exception { new Template().run(); } }
3	public class naloga1{ static BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter out = new PrintWriter(System.out); public static void main( String[] args)throws Exception { StringTokenizer st = new StringTokenizer(in.readLine());  int n = Integer.parseInt(st.nextToken());  int r = Integer.parseInt(st.nextToken());  int[] x = new int[n]; st = new StringTokenizer(in.readLine()); for ( int i = 0;(i < n);i++) {x[i] = Integer.parseInt(st.nextToken()); } sim a = new sim(n,r); for ( int i :x) {a.add(i); }for ( double d :a.cy) {out.print((d + " ")); }out.println(); out.close(); } } class sim{ double[] cx ; int[] ccx ; double[] cy ; int count ; int n ; int r ; sim( int nn, int rr){ r = rr; n = nn; cx = new double[n]; ccx = new int[n]; cy = new double[n]; count = 0; } void add( int x){ double lowest = r; for ( int i = 0;(i < count);i++) {if ( (Math.abs((ccx[i] - x)) <= (2 * r))) { double dy = Math.sqrt((((4 * r) * r) - ((ccx[i] - x) * (ccx[i] - x)))); lowest = Math.max(lowest,(cy[i] + dy)); } }ccx[count] = x; cy[count] = lowest; cx[count++] = x; } }
4	public class SolutionE extends Thread{ static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } static private final FastReader scanner = new FastReader(); static private final PrintWriter out = new PrintWriter(System.out); public static void main( String[] args){ new Thread(null,new SolutionE(),"Main",(1 << 26)).start(); } static final int[] primeFactors = getSmallestPrimeFactorInIntervalInclusive(10_000_000); public static int[] getSmallestPrimeFactorInIntervalInclusive( int maxN){ int[] result = new int[(maxN + 1)]; result[1] = 1; for ( int i = 2;(i <= maxN);i++) {if ( (result[i] == 0)) {for ( int j = i;(j <= maxN);j += i) {result[j] = (((result[(j / i)] % i) == 0)?(result[(j / i)] / i):(result[(j / i)] * i)); }} }return result;} static private void solve(){ int n = scanner.nextInt();  int k = scanner.nextInt();  int[] a = new int[n]; for ( int i = 0;(i < n);i++) {a[i] = primeFactors[scanner.nextInt()]; } Map<Integer,Integer> lastSeenIndex = new HashMap<>();  int[] revertPointers = new int[n]; for ( int i = 0;(i < n);i++) {if ( (lastSeenIndex.get(a[i]) != null)) {revertPointers[i] = lastSeenIndex.get(a[i]); } else {revertPointers[i] = -1; }lastSeenIndex.put(a[i],i); } int[][] maxSegment = new int[n][(k + 1)]; for ( int j = 0;(j <= k);j++) { int pointerLeft = 0;  int pointerRight = 0;  boolean[] changed = new boolean[n];  int amountChanged = 0; while((pointerLeft < n)){if ( ((pointerRight < n) && (revertPointers[pointerRight] < pointerLeft))) {pointerRight++; } else if ( (((pointerRight < n) && (revertPointers[pointerRight] >= pointerLeft)) && (amountChanged < j))) {changed[revertPointers[pointerRight]] = true; pointerRight++; amountChanged++; } else {if ( changed[pointerLeft]) {amountChanged--; } maxSegment[pointerLeft][j] = pointerRight; pointerLeft++; }}} int[][] dp = new int[(n + 1)][(k + 1)]; for ( int j = 0;(j <= k);j++) {dp[n][j] = 0; }for ( int i = (n - 1);(i >= 0);i--) {for ( int j = 0;(j <= k);j++) {dp[i][j] = (n + 1); for ( int x = 0;(x <= j);x++) { int nextJumpTo = maxSegment[i][x]; dp[i][j] = Math.min(dp[i][j],(dp[nextJumpTo][(j - x)] + 1)); }}}out.println(dp[0][k]); } }
2	public class B{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  int n = sc.nextInt();  int half = (n / 2); pw.println("? 1"); pw.flush(); int a = sc.nextInt(); pw.println(("? " + (1 + half))); pw.flush(); int b = sc.nextInt(); if ( ((a - b) == 0)) {pw.println("! 1"); } else if ( (((a - b) % 2) != 0)) {pw.println("! -1"); } else { boolean greater = (a > b);  int lo = 1;  int hi = half;  boolean ans = false; while((lo <= hi)){ int mid = ((lo + hi) / 2); pw.println(("? " + mid)); pw.flush(); a = sc.nextInt(); pw.println(("? " + (mid + half))); pw.flush(); b = sc.nextInt(); if ( (a == b)) {pw.println(("! " + mid)); ans = true; break;} if ( ((a > b) != greater)) {hi = (mid - 1); } else {lo = (mid + 1); greater = (a > b); }}if ( !ans) {pw.println("! -1"); } }pw.flush(); pw.close(); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public Scanner( String s)throws FileNotFoundException{ br = new BufferedReader(new FileReader(new File(s))); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public boolean ready()throws IOException { return br.ready();} } }
0	public class Problem1{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  long n = Long.parseLong(br.readLine()); if ( ((n % 2) == 0)) {System.out.println(((4 + " ") + (n - 4))); } else {System.out.println(((9 + " ") + (n - 9))); }} }
6	public class Main{ public static void main( String[] args)throws Exception { Thread thread = new Thread(null,new TaskAdapter(),"",(1 << 27)); thread.start(); thread.join(); } static class TaskAdapter implements Runnable{ } static class TaskC{ SubsetGenerator sg = new SubsetGenerator(); Node[] nodes ; int n ; Map<Long,Node> map ; long notExist ; long[] mask2Key ; Map<Long,LongList> sequence ; DigitUtils.BitOperator bo = new DigitUtils.BitOperator(); boolean[] dp ; public void solve( int testNumber, FastInput in, FastOutput out){ n = in.readInt(); nodes = new Node[n]; for ( int i = 0;(i < n);i++) {nodes[i] = new Node(); nodes[i].id = i; }map = new LinkedHashMap<>(200000); for ( int i = 0;(i < n);i++) { int k = in.readInt(); for ( int j = 0;(j < k);j++) { long x = in.readInt(); map.put(x,nodes[i]); nodes[i].sum += x; }} long total = 0; for ( Node node :nodes) {total += node.sum; }if ( ((total % n) != 0)) {out.println("No"); return ;} long avg = (total / n); notExist = (long)1e18; mask2Key = new long[(1 << n)]; Arrays.fill(mask2Key,notExist); sequence = new HashMap<>(200000); for ( Map.Entry<Long,Node> kv :map.entrySet()) {for ( Node node :nodes) {node.handled = false; } long key = kv.getKey();  Node node = kv.getValue(); node.handled = true; int mask = bo.setBit(0,node.id,true);  LongList list = new LongList(15); list.add(key); long req = (avg - (node.sum - key));  boolean valid = true; while(true){if ( (req == key)) {break;} Node next = map.get(req); if ( ((next == null) || next.handled)) {valid = false; break;} next.handled = true; list.add(req); req = (avg - (next.sum - req)); mask = bo.setBit(mask,next.id,true); }if ( !valid) {continue;} mask2Key[mask] = key; sequence.put(key,list); }dp = new boolean[(1 << n)]; for ( int i = 0;(i < (1 << n));i++) {dp[i] = (mask2Key[i] != notExist); sg.setSet(i); while((!dp[i] && sg.hasNext())){ int next = sg.next(); if ( ((next == 0) || (next == i))) {continue;} dp[i] = (dp[i] || (dp[next] && dp[(i - next)])); }}if ( !dp[((1 << n) - 1)]) {out.println("No"); return ;} populate(((1 << n) - 1)); out.println("Yes"); for ( Node node :nodes) {out.append(node.out).append(' ').append((node.to + 1)).append('\n'); }} public void populate( int mask){ if ( (mask2Key[mask] != notExist)) { LongList list = sequence.get(mask2Key[mask]);  int m = list.size(); for ( int i = 0;(i < m);i++) { long v = list.get(i);  long last = list.get(DigitUtils.mod((i - 1),m));  Node which = map.get(v);  Node to = map.get(last); which.out = v; which.to = to.id; }return ;} sg.setSet(mask); while(sg.hasNext()){ int next = sg.next(); if ( ((next == 0) || (next == mask))) {continue;} if ( (dp[next] && dp[(mask - next)])) {populate(next); populate((mask - next)); return ;} }} } static class LongList{ private int size ; private int cap ; private long[] data ; static private final long[] EMPTY = new long[0]; public LongList( int cap){ this.cap = cap; if ( (cap == 0)) {data = EMPTY; } else {data = new long[cap]; }} public LongList( LongList list){ this.size = list.size; this.cap = list.cap; this.data = Arrays.copyOf(list.data,size); } public LongList(){ this(0); } private void ensureSpace( int need){ int req = (size + need); if ( (req > cap)) {while((cap < req)){cap = Math.max((cap + 10),(2 * cap)); }data = Arrays.copyOf(data,cap); } } private void checkRange( int i){ if ( ((i < 0) || (i >= size))) {throw (new ArrayIndexOutOfBoundsException());} } public long get( int i){ checkRange(i); return data[i];} public void add( long x){ ensureSpace(1); data[size++] = x; } public int size(){ return size;} public String toString(){ return Arrays.toString(Arrays.copyOf(data,size));} } static class SubsetGenerator{ private int[] meanings = new int[33]; private int[] bits = new int[33]; private int remain ; private int next ; public void setSet( int set){ int bitCount = 0; while((set != 0)){meanings[bitCount] = (set & -set); bits[bitCount] = 0; set -= meanings[bitCount]; bitCount++; }remain = (1 << bitCount); next = 0; } public boolean hasNext(){ return (remain > 0);} private void consume(){ remain = (remain - 1); int i ; for ( i = 0;(bits[i] == 1);i++) {bits[i] = 0; next -= meanings[i]; }bits[i] = 1; next += meanings[i]; } public int next(){ int returned = next; consume(); return returned;} } static class Node{ int id ; long sum ; boolean handled ; long out ; long to ; } static class FastInput{ private final InputStream is ; private byte[] buf = new byte[(1 << 13)]; private int bufLen ; private int bufOffset ; private int next ; public FastInput( InputStream is){ this.is = is; } private int read(){ while((bufLen == bufOffset)){bufOffset = 0; try{bufLen = is.read(buf); }catch (IOException e){ bufLen = -1; } if ( (bufLen == -1)) {return -1;} }return buf[bufOffset++];} public void skipBlank(){ while(((next >= 0) && (next <= 32))){next = read(); }} public int readInt(){ int sign = 1; skipBlank(); if ( ((next == '+') || (next == '-'))) {sign = ((next == '+')?1:-1); next = read(); } int val = 0; if ( (sign == 1)) {while(((next >= '0') && (next <= '9'))){val = (((val * 10) + next) - '0'); next = read(); }} else {while(((next >= '0') && (next <= '9'))){val = (((val * 10) - next) + '0'); next = read(); }}return val;} } static class FastOutput implements AutoCloseable,Closeable{ private StringBuilder cache = new StringBuilder((10 << 20)); private final Writer os ; public FastOutput( Writer os){ this.os = os; } public FastOutput( OutputStream os){ this(new OutputStreamWriter(os)); } public FastOutput append( char c){ cache.append(c); return this;} public FastOutput append( long c){ cache.append(c); return this;} public FastOutput println( String c){ cache.append(c).append('\n'); return this;} public FastOutput flush(){ try{os.append(cache); os.flush(); cache.setLength(0); }catch (IOException e){ throw (new UncheckedIOException(e));} return this;} public void close(){ flush(); try{os.close(); }catch (IOException e){ throw (new UncheckedIOException(e));} } public String toString(){ return cache.toString();} } }
3	public class CC{ public static void main( String[] args)throws Throwable { MyScanner sc = new MyScanner();  PrintWriter pw = new PrintWriter(System.out);  int n = sc.nextInt();  int r = sc.nextInt();  int[] x = new int[n]; for ( int i = 0;(i < n);i++) x[i] = sc.nextInt(); double[] ans = new double[n]; ans[0] = r; for ( int i = 1;(i < n);i++) {ans[i] = r; for ( int j = 0;(j < i);j++) { double dx = Math.abs((x[i] - x[j])); if ( (dx > (2 * r))) continue; double y = Math.sqrt((((4 * r) * r) - (dx * dx))); ans[i] = Math.max(ans[i],(ans[j] + y)); }}for ( double z :ans) pw.print((z + " ")); pw.flush(); pw.close(); } static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
0	public class A{ public static void main( String[] args){ Scanner s = new Scanner(System.in);  int n = s.nextInt(); System.out.println(((n / 2) * 3)); } }
2	public class Main{ public static void main( String[] args)throws Exception { Thread thread = new Thread(null,new TaskAdapter(),"",(1 << 29)); thread.start(); thread.join(); } static class TaskAdapter implements Runnable{ } static class BSearchingRectangles{ FastInput in ; FastOutput out ; int n ; public void solve( int testNumber, FastInput in, FastOutput out){ this.in = in; this.out = out; n = in.readInt(); IntBinarySearch upDown = new IntBinarySearch(){public boolean check( int mid){ return (query(1,n,1,mid) >= 1);} };  IntBinarySearch leftRight = new IntBinarySearch(){public boolean check( int mid){ return (query(1,mid,1,n) >= 1);} };  int threshold = upDown.binarySearch(1,n);  int[] r1 ;  int[] r2 ; if ( ((query(1,n,1,threshold) == 1) && (query(1,n,(threshold + 1),n) == 1))) {r1 = find(1,n,1,threshold); r2 = find(1,n,(threshold + 1),n); } else {threshold = leftRight.binarySearch(1,n); r1 = find(1,threshold,1,n); r2 = find((threshold + 1),n,1,n); }out.append("! "); output(r1); output(r2); out.flush(); } public void output( int[] ans){ for ( int x :ans) {out.append(x).append(' '); }} public int[] find( int l, int r, int d, int u){ IntBinarySearch downIBS = new IntBinarySearch(){public boolean check( int mid){ return (query(l,r,mid,u) == 0);} };  int y1 = downIBS.binarySearch(d,u); if ( (query(l,r,y1,u) == 0)) {y1--; } IntBinarySearch upIBS = new IntBinarySearch(){public boolean check( int mid){ return (query(l,r,d,mid) >= 1);} };  int y2 = upIBS.binarySearch(d,u);  IntBinarySearch leftIBS = new IntBinarySearch(){public boolean check( int mid){ return (query(mid,r,d,u) == 0);} };  int x1 = leftIBS.binarySearch(l,r); if ( (query(x1,r,d,u) == 0)) {x1--; } IntBinarySearch rightIBS = new IntBinarySearch(){public boolean check( int mid){ return (query(l,mid,d,u) >= 1);} };  int x2 = rightIBS.binarySearch(l,r); return new int[]{x1,y1,x2,y2};} public int query( int l, int r, int d, int u){ if ( ((l > r) || (d > u))) {return 0;} out.printf("? %d %d %d %d",l,d,r,u).println().flush(); return in.readInt();} } abstract static class IntBinarySearch{ public abstract boolean check( int mid){ } public int binarySearch( int l, int r){ if ( (l > r)) {throw (new IllegalArgumentException());} while((l < r)){ int mid = DigitUtils.floorAverage(l,r); if ( check(mid)) {r = mid; } else {l = (mid + 1); }}return l;} } static class FastInput{ private final InputStream is ; private byte[] buf = new byte[(1 << 13)]; private int bufLen ; private int bufOffset ; private int next ; public FastInput( InputStream is){ this.is = is; } private int read(){ while((bufLen == bufOffset)){bufOffset = 0; try{bufLen = is.read(buf); }catch (IOException e){ bufLen = -1; } if ( (bufLen == -1)) {return -1;} }return buf[bufOffset++];} public void skipBlank(){ while(((next >= 0) && (next <= 32))){next = read(); }} public int readInt(){ int sign = 1; skipBlank(); if ( ((next == '+') || (next == '-'))) {sign = ((next == '+')?1:-1); next = read(); } int val = 0; if ( (sign == 1)) {while(((next >= '0') && (next <= '9'))){val = (((val * 10) + next) - '0'); next = read(); }} else {while(((next >= '0') && (next <= '9'))){val = (((val * 10) - next) + '0'); next = read(); }}return val;} } static class FastOutput implements AutoCloseable,Closeable,Appendable{ private StringBuilder cache = new StringBuilder((10 << 20)); private final Writer os ; public FastOutput append( CharSequence csq){ cache.append(csq); return this;} public FastOutput append( CharSequence csq, int start, int end){ cache.append(csq,start,end); return this;} public FastOutput( Writer os){ this.os = os; } public FastOutput( OutputStream os){ this(new OutputStreamWriter(os)); } public FastOutput append( char c){ cache.append(c); return this;} public FastOutput append( int c){ cache.append(c); return this;} public FastOutput append( String c){ cache.append(c); return this;} public FastOutput printf( String format, Object... args){ cache.append(String.format(format,args)); return this;} public FastOutput println(){ cache.append(System.lineSeparator()); return this;} public FastOutput flush(){ try{os.append(cache); os.flush(); cache.setLength(0); }catch (IOException e){ throw (new UncheckedIOException(e));} return this;} public void close(){ flush(); try{os.close(); }catch (IOException e){ throw (new UncheckedIOException(e));} } public String toString(){ return cache.toString();} } }
6	public class E4{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ for ( int T = ni();(T > 0);T--) { int n = ni(),m = ni();  int[][] a = new int[n][]; for ( int i = 0;(i < n);i++) a[i] = na(m); int[][] mx = new int[m][]; for ( int i = 0;(i < m);i++) { int u = 0; for ( int j = 0;(j < n);j++) {u = Math.max(u,a[j][i]); }mx[i] = new int[]{u,i}; }Arrays.sort(mx,new Comparator<int[]>(){}); int[] dp = new int[(1 << n)]; for ( int i = 0;((i < n) && (i < m));i++) { int c = mx[i][1];  int[] ls = new int[(1 << n)]; for ( int j = 1;(j < (1 << n));j++) {ls[j] = (ls[(j & (j - 1))] + a[Integer.numberOfTrailingZeros(j)][c]); }for ( int j = 1;(j < (1 << n));j++) { int r = rot(j,n); ls[r] = Math.max(ls[r],ls[j]); } int[] ndp = new int[(1 << n)]; for ( int j = 0;(j < (1 << n));j++) {if ( (rot(j,n) == j)) { int cur = j; for ( int sh = 0;(sh < n);sh++) {cur = ((cur >> 1) | ((cur & 1) << (n - 1))); int mask = (((1 << n) - 1) ^ cur); for ( int k = mask;(k >= 0);k--) {k &= mask; ndp[(k | cur)] = Math.max(ndp[(k | cur)],(dp[k] + ls[j])); }}} }dp = ndp; }out.println(dp[((1 << n) - 1)]); }} int rot( int x, int n){ int ret = x; for ( int i = 0;(i < n);i++) {x = ((x >>> 1) | ((x & 1) << (n - 1))); ret = Math.min(ret,x); }return 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 E4().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
5	public class Main{ static private BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); public static void main( String[] args)throws NumberFormatException,IOException { String[] s = br.readLine().trim().split(" ");  int n = Integer.parseInt(s[0]);  int m = Integer.parseInt(s[1]);  long b[] = new long[n]; s = br.readLine().trim().split(" "); for ( int i = 0;(i < n);i++) {b[i] = Integer.parseInt(s[i]); } long g[] = new long[m]; s = br.readLine().trim().split(" "); for ( int i = 0;(i < m);i++) {g[i] = Integer.parseInt(s[i]); }Arrays.sort(b); Arrays.sort(g); if ( (g[0] < b[(n - 1)])) {System.out.println("-1"); } else if ( (g[0] == b[(n - 1)])) { long ans = 0; for ( int i = 0;(i < m);i++) {ans += g[i]; }for ( int i = 0;(i < (n - 1));i++) {ans += (m * b[i]); }System.out.println(ans); } else { long ans = 0; for ( int i = 0;(i < m);i++) {ans += g[i]; }for ( int i = 0;(i < (n - 1));i++) {ans += (m * b[i]); }ans += (b[(n - 1)] - b[(n - 2)]); System.out.println(ans); }} }
0	public class Main{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int one ,two ; if ( ((n % 2) == 0)) {one = two = (n / 2); if ( (((one % 2) != 0) && ((two % 2) != 0))) {one--; two++; } } else {one = (n - 9); two = 9; }System.out.println(((one + " ") + two)); } }
6	public class E_fast{ static int g[][] ; static int n ,m ; static char[] s ; static int dp[] ,inf = (int)2e9; static int cost[][] ; public static void main( String[] args)throws Exception { Scanner in = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out); n = in.nextInt(); m = in.nextInt(); s = in.next().toCharArray(); g = new int[m][m]; for ( int i = 1;(i < n);i++) { int x = (s[(i - 1)] - 'a'),y = (s[i] - 'a'); if ( (x != y)) {g[x][y]++; g[y][x]++; } }cost = new int[m][(1 << m)]; for ( int i = 0;(i < m);i++) { int w = 0; for ( int j = 0;(j < m);j++) w += g[i][j]; pre(i,0,0,-w); }dp = new int[(1 << m)]; Arrays.fill(dp,-1); pw.println(solve(0,0)); pw.close(); } static void pre( int x, int pos, int mask, int w){ if ( (pos >= m)) {cost[x][mask] = w; return ;} pre(x,(pos + 1),mask,w); pre(x,(pos + 1),set(mask,pos),(w + (2 * g[x][pos]))); } static int solve( int pos, int mask){ if ( (pos >= m)) return 0; if ( (dp[mask] != -1)) return dp[mask]; int min = inf; for ( int i = 0;(i < m);i++) {if ( !check(mask,i)) { int res = ((cost[i][mask] * pos) + solve((pos + 1),set(mask,i))); min = min(min,res); } }return dp[mask] = min;} static boolean check( int N, int pos){ return ((N & (1 << pos)) != 0);} static int set( int N, int pos){ return N = (N | (1 << pos));} }
2	public class Codeforces{ public StreamTokenizer st ; public PrintWriter pw ; public static final int modulo = 1000000009; void init( String in, String out){ if ( in.isEmpty()) st = new StreamTokenizer(System.in); else {try{st = new StreamTokenizer(new BufferedReader(new FileReader(in))); }catch (FileNotFoundException e){ } }if ( out.isEmpty()) pw = new PrintWriter(System.out); else {try{pw = new PrintWriter(new FileWriter(out)); }catch (IOException e){ } }} private void close(){ pw.close(); } private long nL(){ try{st.nextToken(); }catch (IOException e){ } return (long)st.nval;} public static void qSort( int[] A, int low, int high){ int i = low;  int j = high;  int x = A[((low + high) / 2)]; do {while((A[i] < x))++i; while((A[j] > x))--j; if ( (i <= j)) { int temp = A[i]; A[i] = A[j]; A[j] = temp; i++; j--; } }while((i < j));if ( (low < j)) qSort(A,low,j); if ( (i < high)) qSort(A,i,high); } public static void main( String[] aslkdjlkgja)throws IOException { Codeforces z = new Codeforces(); z.init("",""); long l = z.nL();  long r = z.nL(); if ( (l == r)) {System.out.println(0); z.close(); return ;} List<Boolean> R = new ArrayList<Boolean>();  List<Boolean> L = new ArrayList<Boolean>();  long temp = r; while((temp != 0)){if ( ((temp % 2) == 1)) R.add(true); else R.add(false); temp /= 2; }Collections.reverse(R); temp = l; while((temp != 0)){if ( ((temp % 2) == 1)) L.add(true); else L.add(false); temp /= 2; } int n = (R.size() - L.size()); while((n != 0)){L.add(false); --n; }Collections.reverse(L); List<Boolean> res = new ArrayList<Boolean>();  int it = 0; while((R.get(0) == L.get(0))){res.add(false); R.remove(0); L.remove(0); }for ( int i = 0;(i < R.size());++i) res.add(true); long out = 0; it = 0; long add = 1; Collections.reverse(res); while((it < res.size())){if ( res.get(it)) out += add; add *= 2; ++it; }System.out.println(out); } }
1	public class round569d2b{ public static void main( String[] args){ FastScanner in = new FastScanner(System.in);  int n = in.nextInt();  int[] arr = new int[n]; for ( int i = 0;(i < n);i++) {arr[i] = in.nextInt(); }if ( ((n % 2) == 0)) {for ( int i = 0;(i < n);i++) {if ( (arr[i] >= 0)) {arr[i] = ((-1 * arr[i]) - 1); } }} else { int max = Integer.MIN_VALUE;  int maxIndex = 0; for ( int i = 0;(i < n);i++) { int elem = arr[i]; if ( (elem < 0)) {elem = ((-1 * elem) - 1); } if ( (elem > max)) {max = elem; maxIndex = i; } }for ( int i = 0;(i < n);i++) {if ( (i == maxIndex)) {if ( (arr[i] < 0)) {arr[i] = ((-1 * arr[i]) - 1); } } else {if ( (arr[i] >= 0)) {arr[i] = ((-1 * arr[i]) - 1); } }}} StringBuilder sb = new StringBuilder(); for ( int i = 0;(i < n);i++) {sb.append((arr[i] + " ")); }System.out.println(sb); } public static int gcd( int a, int b){ if ( (a == 0)) return b; return gcd((b % a),a);} static class Tuple3<X,Y,Z>{ public final X x ; public final Y y ; public final Z z ; public Tuple3( X x, Y y, Z z){ this.x = x; this.y = y; this.z = z; } public String toString(){ return (((((("(" + x) + ",") + y) + ",") + z) + ")");} } static Tuple3<Integer,Integer,Integer> gcdExtended( int a, int b, int x, int y){ if ( (a == 0)) {x = 0; y = 1; return new Tuple3(0,1,b);} int x1 = 1,y1 = 1;  Tuple3<Integer,Integer,Integer> tuple = gcdExtended((b % a),a,x1,y1);  int gcd = tuple.z; x1 = tuple.x; y1 = tuple.y; x = (y1 - ((b / a) * x1)); y = x1; return new Tuple3(x,y,gcd);} static int inv( int a, int m){ int m0 = m,t ,q ;  int x0 = 0,x1 = 1; if ( (m == 1)) return 0; while((a > 1)){q = (a / m); t = m; m = (a % m); a = t; t = x0; x0 = (x1 - (q * x0)); x1 = t; }if ( (x1 < 0)) x1 += m0; return x1;} static class FastScanner{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int chars ; public FastScanner( InputStream stream){ this.stream = stream; } int read(){ if ( (chars == -1)) throw (new InputMismatchException()); if ( (curChar >= chars)) {curChar = 0; try{chars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (chars <= 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 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();} } }
0	public class A{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(); System.out.println((int)(n + (n / 2))); } }
5	public class A4{ public BufferedReader input ; public PrintWriter output ; public StringTokenizer stoken = new StringTokenizer(""); public static void main( String[] args)throws IOException { new A4(); } A4()throws IOException{ input = new BufferedReader(new InputStreamReader(System.in)); output = new PrintWriter(System.out); run(); input.close(); output.close(); } private void run()throws IOException { int n = Math.toIntExact(nextLong());  int m = Math.toIntExact(nextLong());  int[] coor = new int[(n + 1)];  int[] ss = new int[(n + 1)]; for ( int i = 0;(i < n);i++) {coor[i] = Math.toIntExact(nextLong()); }coor[n] = 1000000000; Arrays.sort(coor); for ( int i = 0;(i < m);i++) { long x1 = nextLong();  long x2 = nextLong(); nextLong(); if ( ((x1 == 1) && (x2 >= coor[0]))) { int l = 0;  int r = (n + 1); while(((r - l) > 1)){ int mi = ((r + l) / 2); if ( (coor[mi] > x2)) {r = mi; } else {l = mi; }}ss[l]++; } } long[] ans = new long[(n + 1)]; ans[n] = (ss[n] + n); long min = ans[n]; for ( int i = (n - 1);(i > -1);i--) {ans[i] = ((ans[(i + 1)] - 1) + ss[i]); if ( (ans[i] < min)) {min = ans[i]; } }System.out.println(min); } private Long nextLong()throws NumberFormatException,IOException { return Long.parseLong(nextString());} private String nextString()throws IOException { while(!stoken.hasMoreTokens()){ String st = input.readLine(); stoken = new StringTokenizer(st); }return stoken.nextToken();} }
0	public class test{ public static void main( String[] args)throws InterruptedException { try{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br.readLine(); System.out.println(25); }catch (IOException io){ io.printStackTrace(); } } }
5	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);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, Scanner in, PrintWriter out){ int n = in.nextInt();  int k = in.nextInt();  Integer[] a = new Integer[n]; for ( int i = 0;(i < n);i++) {a[i] = in.nextInt(); } Set<Integer> vis = new TreeSet<Integer>(); Arrays.sort(a); int ans = 0; for ( int i = 0;(i < n);i++) {if ( (((a[i] % k) == 0) && vis.contains((a[i] / k)))) {++ans; vis.add(a[i]); } }out.println(ans); } } class Scanner{ BufferedReader in ; StringTokenizer tok ; public Scanner( InputStream in){ this.in = new BufferedReader(new InputStreamReader(in)); tok = new StringTokenizer(""); } public String nextToken(){ if ( !tok.hasMoreTokens()) {try{ String newLine = in.readLine(); if ( (newLine == null)) throw (new InputMismatchException()); tok = new StringTokenizer(newLine); }catch (IOException e){ throw (new InputMismatchException());} return nextToken();} return tok.nextToken();} public int nextInt(){ return Integer.parseInt(nextToken());} }
0	public class AgainTwentyfive{ public static void main( String[] args){ System.out.println("25"); } }
6	public class E{ public static void main( String[] args)throws Exception { FastScanner sc = new FastScanner(System.in);  FastPrinter out = new FastPrinter(System.out);  E runner = new E(); runner.run(sc,out); out.close(); } int N ,L ; long[][] mat ; long[] dp ; public void run( FastScanner sc, FastPrinter out)throws Exception { L = sc.nextInt(); N = sc.nextInt(); mat = new long[N][N]; char[] arr = sc.next().toCharArray(); for ( int i = 0;(i < (L - 1));i++) { int cur = (arr[i] - 'a');  int next = (arr[(i + 1)] - 'a'); if ( (cur != next)) {mat[cur][next]++; mat[next][cur]++; } }dp = new long[(1 << N)]; Arrays.fill(dp,-1); dp[((1 << N) - 1)] = 0; long ans = solve(0); out.println(ans); } private long solve( int mask){ if ( (dp[mask] == -1)) { long value = 0; for ( int i = 0;(i < N);i++) {if ( ((mask & (1 << i)) == 0)) {for ( int j = 0;(j < N);j++) {if ( ((mask & (1 << j)) != 0)) {value += mat[i][j]; } }} } long ans = Long.MAX_VALUE; for ( int i = 0;(i < N);i++) {if ( ((mask & (1 << i)) == 0)) { long temp = solve((mask | (1 << i))); if ( (temp < ans)) {ans = temp; } } }ans += value; dp[mask] = ans; } return dp[mask];} static class FastScanner{ private final int BUFFER_SIZE = (1 << 10); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ,bytesRead ; public FastScanner(){ this(System.in); } public FastScanner( InputStream stream){ din = new DataInputStream(stream); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public FastScanner( String fileName)throws IOException{ Path p = Paths.get(fileName); buffer = Files.readAllBytes(p); bytesRead = buffer.length; } boolean isEndline( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} String next()throws Exception { int c = readOutSpaces();  StringBuilder res = new StringBuilder(); do {res.appendCodePoint(c); c = read(); }while(!isSpaceChar(c));return res.toString();} boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} 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;} private void fillBuffer()throws IOException { if ( (din == null)) {bufferPointer = 0; bytesRead = -1; } else {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++];} private int readOutSpaces()throws IOException { while(true){if ( (bufferPointer == bytesRead)) fillBuffer();  int c = buffer[bufferPointer++]; if ( !isSpaceChar(c)) {return c;} }} public void close()throws IOException { if ( (din == null)) return ; din.close(); } } static class FastPrinter{ static final char ENDL = '\n'; StringBuilder buf ; PrintWriter pw ; public FastPrinter( OutputStream stream){ buf = new StringBuilder(); pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(stream))); } public FastPrinter( String fileName)throws Exception{ buf = new StringBuilder(); pw = new PrintWriter(new BufferedWriter(new FileWriter(fileName))); } public FastPrinter( StringBuilder buf){ this.buf = buf; } public void print( int a){ buf.append(a); } public void print( long a){ buf.append(a); } public void print( char a){ buf.append(a); } public void print( char[] a){ buf.append(a); } public void print( double a){ buf.append(a); } public void print( String a){ buf.append(a); } public void print( Object a){ buf.append(a.toString()); } public void println(){ buf.append(ENDL); } public void println( int a){ buf.append(a); buf.append(ENDL); } public void println( long a){ buf.append(a); buf.append(ENDL); } public void println( char a){ buf.append(a); buf.append(ENDL); } public void println( char[] a){ buf.append(a); buf.append(ENDL); } public void println( double a){ buf.append(a); buf.append(ENDL); } public void println( String a){ buf.append(a); buf.append(ENDL); } public void println( Object a){ buf.append(a.toString()); buf.append(ENDL); } public void close(){ pw.print(buf); pw.close(); } public void flush(){ pw.print(buf); pw.flush(); buf.setLength(0); } } }
2	public class LittleGirlAndMaximumXOR{ private InputStream input ; private PrintStream output ; private Scanner inputSc ; static final boolean ONE = true; static final boolean ZERO = false; char dp[][][] ; public LittleGirlAndMaximumXOR( InputStream input, PrintStream output){ this.input = input; this.output = output; init(); } private void init(){ inputSc = new Scanner(input); } public void solve(){ solveTestCase(1); } void fill( char[] a, long value){ String str = Long.toBinaryString(value);  char array[] = str.toCharArray();  int len = array.length;  int index = 63; while((len > 0)){a[index] = array[(len - 1)]; len--; index--; }} void init( char[] a){ for ( int i = 0;(i < 64);i++) {a[i] = '0'; }} private void solveTestCase( int testN){ long l = inputSc.nextLong();  long r = inputSc.nextLong();  char lBit[] = new char[64];  char rBit[] = new char[64]; init(lBit); init(rBit); fill(lBit,l); fill(rBit,r); int i = 0;  char ansBit[] = new char[64];  char a[] = new char[64];  char b[] = new char[64]; init(a); init(b); init(ansBit); for ( ;(i < 64);i++) {if ( ((lBit[i] == '0') && (rBit[i] == '0'))) {} else if ( ((lBit[i] == '1') && (rBit[i] == '0'))) {throw (new RuntimeException("Wrong Input"));} else if ( ((lBit[i] == '0') && (rBit[i] == '1'))) {a[i] = '0'; b[i] = '1'; break;} else {a[i] = '1'; b[i] = '1'; }} boolean aLessB = true;  boolean aBig = false;  boolean bSmall = false; for ( ;(i < 64);i++) {if ( ((lBit[i] == '0') && (rBit[i] == '0'))) {a[i] = '1'; b[i] = '0'; aBig = true; } else if ( ((lBit[i] == '1') && (rBit[i] == '0'))) {a[i] = '1'; b[i] = '0'; } else if ( ((lBit[i] == '0') && (rBit[i] == '1'))) {a[i] = '0'; b[i] = '1'; } else {a[i] = '1'; b[i] = '0'; bSmall = true; }}for ( i = 0;(i < 64);i++) {if ( ((a[i] == '0') && (b[i] == '0'))) {ansBit[i] = '0'; } else if ( ((a[i] == '1') && (b[i] == '0'))) {ansBit[i] = '1'; } else if ( ((a[i] == '0') && (b[i] == '1'))) {ansBit[i] = '1'; } else {ansBit[i] = '0'; }} String ansStr = new String(ansBit);  long ansValue = Long.parseLong(ansStr,2); output.println(ansValue); } public static void main( String[] args){ LittleGirlAndMaximumXOR lgamx = new LittleGirlAndMaximumXOR(System.in,System.out); lgamx.solve(); } }
1	public class Cf1017A{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  int result = 1;  int thomasSum = 0;  StringTokenizer stk ; stk = new StringTokenizer(br.readLine()); int first = Integer.parseInt(stk.nextToken());  int second = Integer.parseInt(stk.nextToken());  int third = Integer.parseInt(stk.nextToken());  int fourth = Integer.parseInt(stk.nextToken()); thomasSum = (((first + second) + third) + fourth); int tmp ; for ( int i = 1;(i < n);i++) {stk = new StringTokenizer(br.readLine()); first = Integer.parseInt(stk.nextToken()); second = Integer.parseInt(stk.nextToken()); third = Integer.parseInt(stk.nextToken()); fourth = Integer.parseInt(stk.nextToken()); tmp = (((first + second) + third) + fourth); if ( (tmp > thomasSum)) result++; }System.out.println(result); } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  DOlyaIMagicheskiiKvadrat solver = new DOlyaIMagicheskiiKvadrat(); solver.solve(1,in,out); out.close(); } static class DOlyaIMagicheskiiKvadrat{ long inf = ((long)1e18 + 1); long[] maxLen ; public void solve( int testNumber, InputReader in, OutputWriter out){ maxLen = new long[100]; maxLen[1] = 0; for ( int i = 1;(i < maxLen.length);i++) {maxLen[i] = Math.min(inf,((maxLen[(i - 1)] * 4) + 1)); }if ( false) {for ( int n = 1;(n <= 3);n++) {for ( int k = 1;(k <= (maxSplitCount(n) + 20));k++) {out.print((((n + " ") + k) + " ")); int res = solve(n,k); if ( (res == -1)) {out.printLine("NO"); } else {out.printLine(("YES " + res)); }}}return ;} int q = in.readInt(); while((q-- > 0)){ int n = in.readInt();  long k = in.readLong();  int res = solve(n,k); if ( (res == -1)) {out.printLine("NO"); continue;} out.printLine(("YES " + res)); }} long maxSplitCount( int n){ if ( (n >= maxLen.length)) {return inf;} return maxLen[n];} int solve( int n, long k){ if ( (maxSplitCount(n) < k)) {return -1;} int at = 0; while((maxSplitCount((at + 1)) <= k)){at++; } int curSideLog = (n - at); k -= maxSplitCount(at); double sideLen = Math.pow(2,(n - curSideLog));  double pathLen = ((sideLen * 2) - 1); if ( ((curSideLog > 0) && (pathLen <= k))) {return (curSideLog - 1);} double area = (sideLen * sideLen);  double otherArea = (area - pathLen); if ( ((otherArea * (double)maxSplitCount(curSideLog)) >= k)) {return curSideLog;} return -1;} } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputReader.SpaceCharFilter filter ; 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 boolean isSpaceChar( int c){ if ( (filter != null)) {return filter.isSpaceChar(c);} return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } } }
6	public class Main{ static double arr[][] ; public static void main( String[] args){ try{ Parserdoubt pd = new Parserdoubt(System.in);  PrintWriter pw = new PrintWriter(System.out);  int fishes = pd.nextInt(); arr = new double[fishes][fishes]; for ( int i = 0;(i < fishes);i++) for ( int j = 0;(j < fishes);j++) arr[i][j] = Double.parseDouble(pd.nextString()); double dp[] = new double[(1 << fishes)]; dp[(dp.length - 1)] = 1.0; for ( int c = (dp.length - 1);(c >= 0);c--) {if ( ((c & (c - 1)) == 0)) continue; for ( int i = 0;(i < fishes);i++) for ( int j = (i + 1);(j < fishes);j++) {if ( ((((1 << i) & c) != 0) && (((1 << j) & c) != 0))) {dp[(c & (1 << j))] += (arr[i][j] * dp[c]); dp[(c & (1 << i))] += (arr[j][i] * dp[c]); } }} double s = 0.0; for ( int i = 0;(i < fishes);i++) s += dp[(1 << i)]; for ( int i = 0;(i < fishes);i++) dp[(1 << i)] /= s; int i = 0; for ( i = 0;(i < (fishes - 1));i++) pw.printf("%.6f ",dp[(1 << i)]); pw.printf("%.6f\n",dp[(1 << i)]); pw.close(); }catch (Exception e){ } } } class Parserdoubt{ private final int BUFFER_SIZE = (1 << 17); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ,bytesRead ; public Parserdoubt( InputStream in){ din = new DataInputStream(in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public String nextString()throws Exception { StringBuffer sb = new StringBuffer("");  byte c = read(); while((c <= ' '))c = read(); do {sb.append((char)c); c = read(); }while((c > ' '));return sb.toString();} public int nextInt()throws Exception { int ret = 0;  byte c = read(); while((c <= ' '))c = read(); boolean neg = (c == '-'); if ( neg) c = read(); do {ret = (((ret * 10) + c) - '0'); c = read(); }while((c > ' '));if ( neg) return -ret; return ret;} private void fillBuffer()throws Exception { bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) buffer[0] = -1; } private byte read()throws Exception { if ( (bufferPointer == bytesRead)) fillBuffer(); return buffer[bufferPointer++];} }
6	public class E{ public static double[] dp ; public static double[][] data ; public static int n ; public static void main( String[] args){ Scanner in = new Scanner();  PrintWriter out = new PrintWriter(System.out); n = in.nextInt(); data = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {data[i][j] = in.nextDouble(); }}dp = new double[(1 << n)]; Arrays.fill(dp,-1); for ( int i = 0;(i < n);i++) { int a = (1 << i); out.print((cal(a) + " ")); }out.close(); } public static double cal( int mask){ if ( (mask == ((1 << n) - 1))) {return 1;} if ( (dp[mask] != -1)) {return dp[mask];} double result = 0;  int c = 0; for ( int i = 0;(i < n);i++) { int a = (1 << i); if ( ((a & mask) != 0)) {c++; for ( int j = 0;(j < n);j++) { int b = (1 << j); if ( ((b & mask) == 0)) {result += (data[i][j] * cal((mask | b))); } }} } int nC2 = (((c + 1) * c) / 2); dp[mask] = (result / nC2); return dp[mask];} static class Scanner{ BufferedReader br ; StringTokenizer st ; public Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ throw (new RuntimeException());} }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} public double nextDouble(){ return Double.parseDouble(next());} } }
6	public class Test{ static PrintWriter writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); int[][] a = new int[12][2000]; int[][] e = new int[(12 * 2000)][3]; Integer[] se = new Integer[(12 * 2000)]; boolean[] used = new boolean[2000]; int[] dp = new int[(1 << 12)]; int[] one = new int[(1 << 12)]; static int readInt(){ int ans = 0;  boolean neg = false; try{ boolean start = false; for ( int c = 0;((c = System.in.read()) != -1);) {if ( (c == '-')) {start = true; neg = true; continue;} else if ( ((c >= '0') && (c <= '9'))) {start = true; ans = (((ans * 10) + c) - '0'); } else if ( start) break; } }catch (IOException e){ } return (neg?-ans:ans);} public static void main( String[] args){ Test te = new Test(); te.start(); writer.flush(); } void start(){ int t = readInt(); while((t-- > 0)){ int n = readInt(),m = readInt(); for ( int i = 0;(i < n);i++) for ( int j = 0;(j < m);j++) {a[i][j] = readInt(); int k = ((i * m) + j); e[k][0] = a[i][j]; e[k][1] = j; e[k][2] = i; }for ( int i = ((n * m) - 1);(i >= 0);i--) se[i] = i; Arrays.sort(se,0,(n * m),(i,j)->{ int[] x = e[i],y = e[j]; return ((x[0] == y[0])?((x[1] == y[1])?Integer.compare(x[2],y[2]):Integer.compare(x[1],y[1])):Integer.compare(x[0],y[0]));}); Arrays.fill(used,0,m,false); Arrays.fill(dp,0,(1 << n),-1); dp[0] = 0; int cc = 0; for ( int x = ((n * m) - 1);(x >= 0);x--) { int c = e[se[x]][1]; if ( used[c]) continue; used[c] = true; cc++; if ( (cc > n)) break; Arrays.fill(one,0,(1 << n),0); for ( int i = ((1 << n) - 1);(i > 0);i--) {for ( int r = 0;(r < n);r++) { int sum = 0; for ( int j = 0;(j < n);j++) if ( (((i >> j) & 1) != 0)) sum += a[((j + r) % n)][c]; one[i] = Math.max(one[i],sum); }}for ( int i = ((1 << n) - 1);(i >= 0);i--) { int u = (((1 << n) - 1) - i);  int p = u; if ( (dp[i] >= 0)) while((p > 0)){dp[(i | p)] = Math.max(dp[(i | p)],(dp[i] + one[p])); p = ((p - 1) & u); } }}writer.println(dp[((1 << n) - 1)]); }} }
5	public class Main{ public static void main( String[] args){ try{new Main().solve(); }catch (Exception e){ e.printStackTrace(); } } ArrayList<Edge>[] edge ; int n ,m ,cnt = 0; int ord ; int[] order ; int[] vis ; Edge[] e ; private void solve()throws Exception { InputReader in = new InputReader(System.in);  PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out))); n = in.nextInt(); m = in.nextInt(); edge = new ArrayList[(n + 1)]; e = new Edge[m]; vis = new int[(n + 1)]; order = new int[(n + 1)]; for ( int i = 1;(i <= n);i++) {edge[i] = new ArrayList<>(); }for ( int i = 1;(i <= m);i++) { int s = in.nextInt(),t = in.nextInt(),c = in.nextInt(); edge[s].add(new Edge(s,t,c,i)); } int l = 0,r = 1000000000; while((l < r)){ int mid = ((l + r) >>> 1); if ( judge(mid,false)) r = mid; else l = (mid + 1); }out.print((l + " ")); judge(l,true); Arrays.sort(e,0,cnt,Comparator.comparingInt((x)->x.id)); int ans = 0;  int[] a = new int[m]; for ( int i = 0;(i < cnt);i++) {if ( (order[e[i].s] < order[e[i].t])) a[ans++] = e[i].id; }out.println(ans); for ( int i = 0;(i < ans);i++) {out.print((a[i] + " ")); }out.println(); out.flush(); } boolean judge( int min, boolean mod){ Arrays.fill(vis,0); cycle = false; for ( int i = 1;(i <= n);i++) {if ( (vis[i] == 0)) {dfs(i,min,mod); if ( cycle) return false; } }return true;} boolean cycle = false; void dfs( int cur, int min, boolean mod){ if ( cycle) return ; vis[cur] = 1; for ( Edge e :edge[cur]) {if ( (e.c <= min)) {if ( mod) this.e[cnt++] = e; continue;} if ( (vis[e.t] == 1)) {cycle = true; return ;} else if ( (vis[e.t] == 0)) dfs(e.t,min,mod); }vis[cur] = 2; if ( mod) order[cur] = ord++; } } class Edge{ int s ,t ,c ,id ; Edge( int a, int b, int c, int d){ s = a; t = b; this.c = c; id = d; } } class InputReader{ StreamTokenizer tokenizer ; public InputReader( InputStream stream){ tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(stream))); tokenizer.ordinaryChars(33,126); tokenizer.wordChars(33,126); } public String next()throws IOException { tokenizer.nextToken(); return tokenizer.sval;} public int nextInt()throws IOException { return Integer.parseInt(next());} }
2	public class OlyaAndMagicalSquare{ void solve(){ long[] dp = new long[32]; dp[0] = 0; for ( int i = 1;(i < 32);i++) {dp[i] = ((4 * dp[(i - 1)]) + 1); } int T = in.nextInt(); L:while((T-- > 0)){ int n = in.nextInt();  long k = in.nextLong(); if ( (n > 31)) {out.println(("YES " + (n - 1))); continue;} long tot = 0; for ( int a = (n - 1);(a >= 0);a--) {k -= ((1L << (n - a)) - 1); if ( (k < 0)) break; if ( (k == 0)) {out.println(("YES " + a)); continue L;} long limit = ((1L << ((n + 1) - a)) - 3); if ( ((k <= tot) || ((dp[a] > 0) && (((((k - tot) + dp[a]) - 1) / dp[a]) <= limit)))) {out.println(("YES " + a)); continue L;} tot += (dp[a] * limit); }out.println("NO"); }} public static void main( String[] args){ in = new FastScanner(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); new OlyaAndMagicalSquare().solve(); out.close(); } static FastScanner in ; static PrintWriter out ; static class FastScanner{ BufferedReader in ; StringTokenizer st ; public FastScanner( BufferedReader in){ this.in = in; } public String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(in.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} public int nextInt(){ return Integer.parseInt(nextToken());} public long nextLong(){ return Long.parseLong(nextToken());} } }
3	public class TaskC{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(),r = sc.nextInt();  int[] xcords = new int[n];  double[] ycords = new double[n];  double y = r,x = 0,px = 0,ty = 0; for ( int i = 0;(i < n);i++) {xcords[i] = sc.nextInt(); x = xcords[i]; y = r; for ( int j = 0;(j < i);j++) {px = xcords[j]; if ( (Math.abs((px - x)) > (r * 2))) continue; ty = (Math.sqrt((((4 * r) * r) - ((x - px) * (x - px)))) + ycords[j]); y = Math.max(y,ty); }ycords[i] = y; }for ( int i = 0;(i < n);i++) {System.out.print((ycords[i] + " ")); }} }
3	public class C{ public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt();  int r = sc.nextInt();  double ans[] = new double[n];  int[] x = new int[n]; for ( int i = 0;(i < n);i++) {x[i] = sc.nextInt(); }for ( int i = 0;(i < n);i++) {ans[i] = r; for ( int j = 0;(j < i);j++) { int d = Math.abs((x[i] - x[j])); if ( (d <= (2 * r))) {ans[i] = Math.max(ans[i],(ans[j] + Math.sqrt((((4 * r) * r) - (d * d))))); } }out.print((ans[i] + " ")); }out.println(); out.flush(); out.close(); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public Scanner( String file)throws FileNotFoundException{ br = new BufferedReader(new FileReader(file)); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public boolean ready()throws IOException { return br.ready();} } }
6	public class e{ private void main(){ Scanner stdin = new Scanner(System.in);  PrintStream stdout = System.out;  int n = stdin.nextInt();  double[][] p = new double[n][n];  double[][] ans = new double[(1 << n)][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) p[i][j] = stdin.nextDouble(); double[] dieChance = new double[n];  ArrayList<Integer> sel = new ArrayList<Integer>(); for ( int i = 0;(i < (1 << n));i++) {sel.clear(); for ( int k = 0;(k < n);k++) {if ( ((i & (1 << k)) != 0)) sel.add(k); }if ( (sel.size() == 1)) {ans[i][sel.get(0)] = 0; continue;} for ( int j :sel) dieChance[j] = 0; for ( int j :sel) for ( int k :sel) dieChance[k] += p[j][k]; for ( int j :sel) dieChance[j] /= ((sel.size() * (sel.size() - 1)) / 2); for ( int j :sel) {ans[i][j] = dieChance[j]; for ( int k :sel) ans[i][j] += (dieChance[k] * ans[(i - (1 << k))][j]); }}for ( double d :ans[((1 << n) - 1)]) stdout.format("%f ",(1 - d)); stdout.println(); } public static void main( String[] args){ new e().main(); } }
2	public class Main{ BufferedReader in ; StringTokenizer str = null; private String next()throws Exception { if ( ((str == null) || !str.hasMoreElements())) str = new StringTokenizer(in.readLine()); return str.nextToken();} private long nextLong()throws Exception { return Long.parseLong(next());} public void run()throws Exception { in = new BufferedReader(new InputStreamReader(System.in)); long l = nextLong();  long r = nextLong();  int bit = 63; while(((bit >= 0) && (hasBit(l,bit) == hasBit(r,bit)))){bit--; }System.out.println(((1L << (bit + 1)) - 1)); } private boolean hasBit( long x, int i){ return ((x & (1L << i)) > 0);} public static void main( String[] args)throws Exception { new Main().run(); } }
4	public class phoenix_and_computers{ public static void main( String[] args)throws NumberFormatException,IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String[] st = br.readLine().split(" ");  int n = Integer.parseInt(st[0]);  int m = Integer.parseInt(st[1]);  long[][] ncr = ncrcoll(405,405,m);  int[] p2 = new int[(n + 1)]; p2[0] = 1; for ( int i = 1;(i < p2.length);i++) {p2[i] = ((2 * p2[(i - 1)]) % m); } long[][] dp = new long[405][405]; dp[0][0] = 1; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= i);j++) {for ( int k = 1;((i + k) <= n);k++) {dp[((i + k) + 1)][(j + k)] += (((dp[i][j] * p2[(k - 1)]) % m) * ncr[(j + k)][k]); dp[((i + k) + 1)][(j + k)] %= m; }}} long ans = 0; for ( int i = 0;(i <= n);i++) {ans = ((ans + dp[(n + 1)][i]) % m); }System.out.println(ans); } static long[][] ncrcoll( int n, int k, int p){ long[][] arr = new long[(n + 1)][(k + 1)]; for ( int i = 1;(i < arr.length);i++) {arr[i][0] = 1; }for ( int i = 1;(i < arr.length);i++) {for ( int j = 1;((j <= i) && (j < arr[0].length));j++) {if ( ((i == 1) && (j == 1))) {arr[i][j] = 1; } else {arr[i][j] = ((arr[(i - 1)][j] + arr[(i - 1)][(j - 1)]) % p); }}}return arr;} }
6	public class E implements Runnable{ public static void main( String[] args){ new Thread(null,new E(),"_cf",(1 << 28)).start(); } int n ,m ; char[] str ; int[][] occs ,cost ; int[] dp ; int oo = (int)1e9; int min( int a, int b){ if ( (a < b)) return a; return b;} class FastScanner{ public int BS = (1 << 16); public char NC = (char)0; byte[] buf = new byte[BS]; int bId = 0,size = 0; char c = NC; double num = 1; BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } public char nextChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ num = 1; boolean neg = false; if ( (c == NC)) c = nextChar(); for ( ;((c < '0') || (c > '9'));c = nextChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = nextChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); num *= 10; }return (neg?-res:res);} public String next(){ StringBuilder res = new StringBuilder(); while((c <= 32))c = nextChar(); while((c > 32)){res.append(c); c = nextChar(); }return res.toString();} } }
5	public class div168C{ public static void main( String[] args)throws Exception { div168C a = new div168C();  Parserdoubt pd = new Parserdoubt(System.in);  StringBuffer sb = new StringBuffer();  ArrayList<Integer> arr = new ArrayList<Integer>();  int max = 0;  int n = pd.nextInt();  int k = pd.nextInt(); for ( int i = 0;(i < n);i++) {arr.add(pd.nextInt()); max = Math.max(max,arr.get(i)); }Collections.sort(arr); int count = 0;  int[] mat = new int[(n + 1)]; for ( int i = (n - 1);(i >= 0);i--) {if ( (mat[i] != 1)) { int x = arr.get(i); if ( ((x % k) == 0)) { int ans = Collections.binarySearch(arr,(x / k)); if ( ((ans >= 0) && (arr.get(ans) == (x / k)))) {count++; mat[ans] = 1; } else {count++; }} else {count++; }} }if ( (n == 1)) count = 1; System.out.println(count); } }
2	public class E extends Thread{ public E( String inputFileName, String outputFileName){ try{if ( (inputFileName != null)) {this.input = new BufferedReader(new FileReader(inputFileName)); } else {this.input = new BufferedReader(new InputStreamReader(System.in)); }if ( (outputFileName != null)) {this.output = new PrintWriter(outputFileName); } else {this.output = new PrintWriter(System.out); }this.setPriority(Thread.MAX_PRIORITY); }catch (Throwable e){ System.err.println(e.getMessage()); e.printStackTrace(); System.exit(666); } } private void solve()throws Throwable { long l = nextLong(),r = nextLong(); output.println(Math.max(((Long.highestOneBit((l ^ r)) * 2) - 1),0L)); } public static void main( String... args){ new E(null,null).start(); } private long nextLong()throws IOException { return Long.parseLong(next());} private String next()throws IOException { while(((tokens == null) || !tokens.hasMoreTokens())){tokens = new StringTokenizer(input.readLine()); }return tokens.nextToken();} private StringTokenizer tokens ; private BufferedReader input ; private PrintWriter output ; }
0	public class A{ private void solve()throws IOException { int n = nextInt();  int r = n; n *= 2; n -= (0.5 * r); System.out.println(n); } public static void main( String[] args){ new A().run(); } BufferedReader reader ; StringTokenizer tokenizer ; PrintWriter writer ; public void run(){ try{reader = new BufferedReader(new InputStreamReader(System.in)); tokenizer = null; writer = new PrintWriter(System.out); solve(); reader.close(); writer.close(); }catch (Exception e){ e.printStackTrace(); System.exit(1); } } int nextInt()throws IOException { return Integer.parseInt(nextToken());} long nextLong()throws IOException { return Long.parseLong(nextToken());} double nextDouble()throws IOException { return Double.parseDouble(nextToken());} String nextToken()throws IOException { while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(reader.readLine()); }return tokenizer.nextToken();} }
1	public class CF1009E{ static final int MD = 998244353; public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine());  StringTokenizer st = new StringTokenizer(br.readLine());  int[] aa = new int[(1 + n)]; for ( int i = 1,a = 0;(i <= n);i++) aa[i] = a = ((a + Integer.parseInt(st.nextToken())) % MD); int[] pp = new int[n]; pp[0] = 1; for ( int i = 1,p = 1;(i < n);i++) {pp[i] = p; p = ((p * 2) % MD); } int d = 0;  long ans = 0; for ( int i = (n - 1);(i >= 0);i--) {d = ((((d * 2) % MD) + aa[((n - 1) - i)]) % MD); ans = ((ans + ((long)(d + aa[(n - i)]) * pp[i])) % MD); }System.out.println(ans); } }
1	public class q1{ int m = ((int)1e9 + 7); public int mul( int a, int b){ a = (a % m); b = (b % m); return ((a * b) % m);} public static long gcd( long a, long b){ if ( (b == 0)) return a; else return gcd(b,(a % b));} public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  HashMap<Integer,Integer> h = new HashMap();  int[] a = new int[n];  int x = sc.nextInt(); for ( int i = 0;(i < n);i++) {a[i] = sc.nextInt(); if ( (h.get(a[i]) == null)) {h.put(a[i],1); } else {System.out.print(0); System.exit(0); }}for ( int i = 0;(i < n);i++) { int num = (a[i] & x); if ( (num == a[i])) continue; if ( (h.get(num) == null)) continue; else {System.out.print(1); System.exit(0); }}for ( int i = 0;(i < n);i++) { int num = (a[i] & x); if ( (num == a[i])) continue; if ( (h.get(num) == null)) h.put(num,1); else {System.out.print(2); System.exit(0); }}System.out.print(-1); } }
6	public class B implements Runnable{ int a ; int[] b ; int[] l ; public void solve()throws IOException { int n = in.nextInt();  int k = in.nextInt(); a = in.nextInt(); b = new int[n]; l = new int[n]; for ( int i = 0;(i < n);i++) {b[i] = in.nextInt(); l[i] = in.nextInt(); }out.println(best(0,k)); } double best( int cur, int left){ double r = 0.0; if ( (cur < l.length)) {for ( int i = 0;((i <= left) && ((l[cur] + (10 * i)) <= 100));i++) {l[cur] += (i * 10); r = Math.max(r,best((cur + 1),(left - i))); l[cur] -= (i * 10); }} else {for ( int m = 0;(m < (1 << l.length));m++) { int sum = 0;  double p = 1.0;  int pro = 0; for ( int i = 0;(i < l.length);i++) {if ( ((m & (1 << i)) == 0)) {p *= (1.0 - (l[i] * 0.01)); sum += b[i]; } else {p *= (l[i] * 0.01); pro++; }}if ( ((pro * 2) > l.length)) {r += p; } else {r += ((p * a) / (a + sum)); }}}return r;} public Scanner in ; public PrintWriter out ; B()throws IOException{ in = new Scanner(System.in); out = new PrintWriter(System.out); } void close()throws IOException { out.close(); } public static void main( String[] args)throws IOException { new Thread(new B()).start(); } }
2	public class Main{ public static void main( String[] args)throws IOException { FastScanner in = new FastScanner(System.in);  PrintWriter out = new PrintWriter(System.out); new Main().run(in,out); out.close(); } public static long mod = 17352642619633L; void run( FastScanner in, PrintWriter out){ long K = in.nextLong();  long lo = 1;  long hi = ((long)1e12 + 1); while((lo < hi)){ long m = ((lo + hi) >> 1);  long d = numDigitsLte(m); if ( (d <= K)) {lo = (m + 1); } else {hi = m; }} long numDigits = numDigitsLte(lo); if ( (numDigitsLte((lo - 1)) == K)) {out.println(((((lo - 1) % 10) + 10) % 10)); } else { int offset = (int)(numDigits - K);  List<Long> digits = new ArrayList<>(); while((lo > 0)){digits.add((lo % 10)); lo /= 10; }out.println(digits.get(offset)); }} static long[] dig = new long[15]; {for ( int i = 1;(i < dig.length);i++) {dig[i] = ((9 * (long)Math.pow(10,(i - 1))) * i); }for ( int i = 1;(i < dig.length);i++) {dig[i] += dig[(i - 1)]; }} long numDigitsLte( long m){ if ( (m <= 9)) return m; int numDigits = 0;  long M = m; while((M > 0)){numDigits++; M /= 10; } long ret = dig[(numDigits - 1)]; ret += (((m - (long)Math.pow(10,(numDigits - 1))) + 1) * numDigits); return ret;} static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( InputStream in){ br = new BufferedReader(new InputStreamReader(in)); st = null; } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} long nextLong(){ return Long.parseLong(next());} } }
3	public class Codeforces908C{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int r = sc.nextInt();  int[] x = new int[n];  double[] res = new double[n]; for ( int i = 0;(i < n);i++) {x[i] = sc.nextInt(); res[i] = (double)r; for ( int j = (i - 1);(j >= 0);j--) { int diff = (x[j] - x[i]); if ( (Math.abs((x[j] - x[i])) <= (2 * r))) {res[i] = Math.max(res[i],(res[j] + Math.sqrt((((4 * r) * r) - (diff * diff))))); } }}for ( int i = 0;(i < n);i++) {System.out.print((res[i] + " ")); }System.out.println(""); } }
0	public class Main{ public void solve()throws IOException { int n = nextInt(); output.println(((n / 2) * 3)); } public void run()throws IOException { input = new BufferedReader(new InputStreamReader(System.in)); output = new PrintWriter(System.out); solve(); input.close(); output.close(); } BufferedReader input ; PrintWriter output ; StringTokenizer tok ; String nextToken()throws IOException { while(((tok == null) || !tok.hasMoreTokens()))tok = new StringTokenizer(input.readLine()); return tok.nextToken();} int nextInt()throws IOException { return Integer.valueOf(nextToken());} public static void main( String[] args)throws IOException { new Main().run(); } }
0	public class Main{ private BufferedReader input ; private PrintWriter output ; private StringTokenizer stoken ; String fin = "input"; String fout = "output"; private void solve(){ long a = nextInt();  long res = ((a / 2) * 3); output.print(res); } Main()throws IOException{ input = new BufferedReader(new InputStreamReader(System.in)); output = new PrintWriter(System.out); solve(); input.close(); output.flush(); output.close(); } int nextInt(){ return Integer.parseInt(nextToken());} String nextToken(){ while(((stoken == null) || stoken.hasMoreTokens())){try{ String line = input.readLine(); stoken = new StringTokenizer(line); }catch (IOException e){ e.printStackTrace(); } }return stoken.nextToken();} public static void main( String[] args)throws IOException { new Main(); } }
2	public class A338{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long n = in.nextInt();  long m = in.nextInt();  long k = in.nextInt();  long x = (n - m);  long y = (n / k); if ( (x >= y)) System.out.println(m); else { long t = (y - x);  long ans = 0; ans += (k * (pow((t + 1)) - 2)); ans %= 1000000009; ans += (m - (t * k)); ans %= 1000000009; if ( (ans < 0)) ans += 1000000009; System.out.println(ans); }} public static long pow( long m){ if ( (m == 1)) return 2; long x = pow((m / 2)); x %= 1000000009; x *= x; if ( ((m % 2) != 0)) x *= 2; x %= 1000000009; return x;} }
0	public class A72{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(); System.out.println(((n * 3) / 2)); } }
2	public class B{ public static PrintWriter out ; public static BufferedReader bf ; public static int n ; public static int[] a ; public static void main( String[] args)throws Exception { bf = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(new OutputStreamWriter(System.out)); n = Integer.parseInt(bf.readLine()); a = new int[n]; Arrays.fill(a,Integer.MAX_VALUE); if ( (((n / 2) % 2) != 0)) {out.println(("! " + 1)); out.flush(); out.close(); System.exit(0); } ask(0); ask(opp(0)); int low = 0;  int high = opp(0); while(true){ int test = ((low + high) / 2); ask(test); ask(opp(test)); int l_1 = a[low];  int l_2 = a[test];  int r_1 = a[opp(low)];  int r_2 = a[opp(test)]; if ( (((1L * (l_1 - r_1)) * (l_2 - r_2)) < 0L)) {high = test; } else low = test; }} public static int ask( int i)throws Exception { out.println(("? " + (i + 1))); out.flush(); int k = Integer.parseInt(bf.readLine()); a[i] = k; if ( (a[i] == a[opp(i)])) {out.println(("! " + (i + 1))); out.flush(); out.close(); System.exit(0); } return k;} public static int opp( int k){ return ((k + (n / 2)) % n);} }
3	public class Main{ public static void main( String[] args){ InputReader reader = new InputReader(System.in);  PrintWriter pw = new PrintWriter(System.out);  int n = reader.nextInt();  int r = reader.nextInt();  int[] x = new int[n];  double[] y = new double[n]; for ( int i = 0;(i < n);++i) { int iniX = reader.nextInt();  double bestY = (double)r; for ( int j = 0;(j < i);++j) {if ( (Math.abs((iniX - x[j])) < (2 * r))) {bestY = Math.max(bestY,collisionY((double)x[j],y[j],(double)iniX,r)); } if ( (Math.abs((iniX - x[j])) == (2 * r))) {bestY = Math.max(bestY,y[j]); } }x[i] = iniX; y[i] = bestY; }for ( int i = 0;(i < n);++i) {pw.printf("%.9f ",y[i]); }pw.flush(); pw.close(); } public static double collisionY( double x1, double y1, double x2, double r){ double dhsq = (((r * r) * 4) - ((x1 - x2) * (x1 - x2))); return (y1 + Math.sqrt(dhsq));} 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());} } }
6	public class cf112e{ static int n ,m ,s ; static int[][][] memo ; public static void main( String[] args){ Scanner in = new Scanner(System.in); n = in.nextInt(); m = in.nextInt(); if ( (n > m)) { int tmp = n; n = m; m = tmp; } s = (1 << n); memo = new int[s][s][m]; for ( int i = 0;(i < s);i++) for ( int j = 0;(j < s);j++) Arrays.fill(memo[i][j],-1); int ret = go(0,0,0); System.out.println(((n * m) - ret)); } static int go( int last, int trans, int r){ if ( (r == m)) {if ( (trans == 0)) return 0; return 100;} if ( (memo[last][trans][r] != -1)) return memo[last][trans][r]; int best = 100; for ( int crnt = 0;(crnt < s);crnt++) {if ( ((trans & ~crnt) != 0)) continue; for ( int pass = 0;(pass < s);pass++) { int tmp = (((1 << n) - 1) & ~last); if ( ((pass & ~tmp) != 0)) continue; tmp = (tmp & ~pass); boolean fail = false; for ( int k = 0;(k < n);k++) if ( (isSet(tmp,k) && ((isSet(crnt,(k - 1)) || isSet(crnt,k)) || isSet(crnt,(k + 1))))) fail = true; if ( fail) continue; best = Math.min(best,(Integer.bitCount(crnt) + go(crnt,pass,(r + 1)))); }}return memo[last][trans][r] = best;} static boolean isSet( int x, int p){ if ( ((p < 0) || (p >= n))) return false; return ((x & (1 << p)) != 0);} }
4	public class Solve{ public static void main( String[] args)throws Exception { Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int size = ((int)1e7 + 1);  int[] pr = new int[size]; for ( int i = 0;(i < size);i++) {pr[i] = i; }for ( int i = 2;((i * i) < size);i++) { int val = (i * i); for ( int j = val;(j <= size);j += val) {pr[j] = (j / val); }} int t = sc.nextInt();  int[] dp = new int[size]; Arrays.fill(dp,-1); while((t-- > 0)){ int n = sc.nextInt();  int k = sc.nextInt();  int[] ar = new int[n]; for ( int i = 0;(i < n);i++) { int a = sc.nextInt(); ar[i] = pr[a]; } int[] ans = new int[(k + 1)];  int[] ind = new int[(k + 1)]; for ( int i = 0;(i < n);i++) {for ( int h = k;(h >= 0);h--) {if ( (dp[ar[i]] >= ind[h])) {ans[h]++; ind[h] = i; } if ( ((h > 0) && ((ans[(h - 1)] < ans[h]) || ((ans[(h - 1)] == ans[h]) && (ind[(h - 1)] > ind[h]))))) {ans[h] = ans[(h - 1)]; ind[h] = ind[(h - 1)]; } }dp[ar[i]] = i; }out.println((ans[k] + 1)); for ( int i = 0;(i < n);i++) dp[ar[i]] = -1; }out.close(); } }
0	public class Main{ public static void main( String[] args){ Scanner input = new Scanner(System.in); while(input.hasNext()){ long n = input.nextLong(); if ( ((n == 1) || (n == 2))) System.out.println(n); else if ( ((n % 2) == 1)) System.out.println(((n * (n - 1)) * (n - 2))); else if ( ((n % 3) != 0)) System.out.println(Math.max(((n * (n - 1)) * (n - 3)),(((n * (n - 1)) * (n - 2)) / 2))); else System.out.println(Math.max(Math.max((((n * (n - 1)) * (n - 3)) / 3),(((n * (n - 1)) * (n - 2)) / 2)),Math.max((((n - 2) * (n - 1)) * (n - 3)),(((n * (n - 2)) * (n - 3)) / 6)))); }} }
0	public class coins{ public static void main( String[] args)throws IOException { InputStreamReader read = new InputStreamReader(System.in);  BufferedReader in = new BufferedReader(read);  int i ,k ,n ,v ;  String a ; a = in.readLine(); for ( i = 0;(i < a.length());i++) {if ( (a.charAt(i) == ' ')) break; }n = Integer.parseInt(a.substring(0,i)); v = Integer.parseInt(a.substring((i + 1))); k = (v % n); v = (v / n); if ( (k > 0)) v++; System.out.println(v); } }
2	public class DigitSequence{ public static PrintWriter out ; public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer token = new StringTokenizer("");  String temp[] = br.readLine().split(" ");  long pos = Long.parseLong(temp[0]); out = new PrintWriter(new BufferedOutputStream(System.out)); if ( (pos < 10)) {out.println(pos); } else {out.println(findDigitSequence(pos)); }out.close(); } static private char findDigitSequence( long pos){ long min = 0;  long max = 9;  long dig = 1; while((pos > max)){dig++; min = (max + 1); max = (long)(max + ((9 * Math.pow(10,(dig - 1))) * dig)); }pos = (pos - min); long num = (long)((pos / dig) + Math.pow(10,(dig - 1)));  String st = String.valueOf(num); if ( (dig == 1)) {return st.charAt(0);} char result = st.charAt((int)(pos % dig)); return result;} }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ ArrayList<PointInt[]> al ; TaskB.Interactor interactor ; public void solve( int testNumber, InputReader in, OutputWriter out){ int n = in.nextInt(); interactor = new TaskB.IOInteractor(new Scanner(in.getStream()),out.getWriter()); Assert.assertTrue((interactor.query(1,1,n,n) == 2)); int lx = 1,rx = n,ly = 1,ry = n; for ( int it = 0;(it < 20);++it) { int tx = ((lx + rx) / 2); if ( (interactor.query(1,1,tx,n) >= 1)) rx = tx; else lx = tx; int ty = ((ly + ry) / 2); if ( (interactor.query(1,1,n,ty) >= 1)) ry = ty; else ly = ty; }al = new ArrayList<>(); if ( ((interactor.query(1,1,lx,n) == 1) && (interactor.query((lx + 1),1,n,n) == 1))) {dfs(1,1,lx,n); dfs((lx + 1),1,n,n); } else if ( ((interactor.query(1,1,rx,n) == 1) && (interactor.query((rx + 1),1,n,n) == 1))) {dfs(1,1,rx,n); dfs((rx + 1),1,n,n); } else if ( ((interactor.query(1,1,n,ly) == 1) && (interactor.query(1,(ly + 1),n,n) == 1))) {dfs(1,1,n,ly); dfs(1,(ly + 1),n,n); } else if ( ((interactor.query(1,1,n,ry) == 1) && (interactor.query(1,(ry + 1),n,n) == 1))) {dfs(1,1,n,ry); dfs(1,(ry + 1),n,n); } else {throw (new RuntimeException("WTF"));}Assert.assertTrue((al.size() == 2)); interactor.answer(al.get(0)[0].x,al.get(0)[0].y,al.get(0)[1].x,al.get(0)[1].y,al.get(1)[0].x,al.get(1)[0].y,al.get(1)[1].x,al.get(1)[1].y); } private void dfs( int x1, int y1, int x2, int y2){ int t ; t = x1; for ( int i = 0;(i < 20);++i) { int x = ((t + x2) / 2); if ( (interactor.query(x1,y1,x,y2) == 1)) x2 = x; else t = x; }if ( (interactor.query(x1,y1,t,y2) == 1)) x2 = t; t = x2; for ( int i = 0;(i < 20);++i) { int x = ((t + x1) / 2); if ( (interactor.query(x,y1,x2,y2) == 1)) x1 = x; else t = x; }if ( (interactor.query(t,y1,x2,y2) == 1)) x1 = t; t = y1; for ( int i = 0;(i < 20);++i) { int y = ((t + y2) / 2); if ( (interactor.query(x1,y1,x2,y) == 1)) y2 = y; else t = y; }if ( (interactor.query(x1,y1,x2,t) == 1)) y2 = t; t = y2; for ( int i = 0;(i < 20);++i) { int y = ((t + y1) / 2); if ( (interactor.query(x1,y,x2,y2) == 1)) y1 = y; else t = y; }if ( (interactor.query(x1,t,x2,y2) == 1)) y1 = t; al.add(new PointInt[]{new PointInt(x1,y1),new PointInt(x2,y2)}); } interface Interactor{ int query( int x1, int y1, int x2, int y2); void answer( int x11, int y11, int x12, int y12, int x21, int y21, int x22, int y22); } } static class InputReader{ private InputStream stream ; private byte[] buffer = new byte[10000]; private int cur ; private int count ; public InputReader( InputStream stream){ this.stream = stream; } public static boolean isSpace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public int read(){ if ( (count == -1)) {throw (new InputMismatchException());} try{if ( (cur >= count)) {cur = 0; count = stream.read(buffer); if ( (count <= 0)) return -1; } }catch (IOException e){ throw (new InputMismatchException());} return buffer[cur++];} public int readSkipSpace(){ int c ; do {c = read(); }while(isSpace(c));return c;} public int nextInt(){ int sgn = 1;  int c = readSkipSpace(); if ( (c == '-')) {sgn = -1; c = read(); } int res = 0; do {if ( ((c < '0') || (c > '9'))) {throw (new InputMismatchException());} res = (((res * 10) + c) - '0'); c = read(); }while(!isSpace(c));res *= sgn; return res;} public InputStream getStream(){ return stream;} } static class PointInt{ public int x ; public int y ; public PointInt( int x, int y){ this.x = x; this.y = y; } public PointInt(){ x = 0; y = 0; } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public PrintWriter getWriter(){ return writer;} public void close(){ writer.close(); } } }
4	public class Div1_429C{ static final long MOD = 1_000_000_007; static long[] fact = new long[305]; static long[] iFact = new long[305]; static final long I304 = 904487323; public static void main( String[] args)throws IOException { fact[0] = 1; for ( int i = 1;(i < 305);i++) {fact[i] = ((fact[(i - 1)] * i) % MOD); }iFact[304] = I304; for ( int i = 303;(i >= 0);i--) {iFact[i] = ((iFact[(i + 1)] * (i + 1)) % MOD); } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  PrintWriter printer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  int len = Integer.parseInt(reader.readLine());  long[] groups = new long[(len + 1)];  int[] gSizes = new int[(len + 1)];  int nG = 0;  StringTokenizer inputData = new StringTokenizer(reader.readLine()); for ( int i = 0;(i < len);i++) { long nxt = Integer.parseInt(inputData.nextToken()); for ( int j = 1;(j <= nG);j++) {if ( isSquare((nxt * groups[j]))) {gSizes[j]++; continue iLoop;} }groups[++nG] = nxt; gSizes[nG] = 1; } long[][] dp = new long[(nG + 1)][len]; dp[0][0] = 1; int fTotal = 0; for ( int fG = 0;(fG < nG);fG++) {for ( int fB = 0;(fB < len);fB++) {if ( (dp[fG][fB] == 0)) {continue;} int nGSize = gSizes[(fG + 1)]; for ( int nS = 1;(nS <= Math.min(nGSize,(fTotal + 1)));nS++) {for ( int nBR = 0;(nBR <= Math.min(fB,nS));nBR++) { long nW = ((((((((dp[fG][fB] * fact[nGSize]) % MOD) * comb((nGSize - 1),(nS - 1))) % MOD) * comb(fB,nBR)) % MOD) * comb(((fTotal + 1) - fB),(nS - nBR))) % MOD); dp[(fG + 1)][(((fB - nBR) + nGSize) - nS)] = ((dp[(fG + 1)][(((fB - nBR) + nGSize) - nS)] + nW) % MOD); }}}fTotal += gSizes[(fG + 1)]; }printer.println(dp[nG][0]); printer.close(); } static long comb( int a, int b){ if ( (b > a)) {return 0;} return ((((fact[a] * iFact[(a - b)]) % MOD) * iFact[b]) % MOD);} static boolean isSquare( long inp){ long sqrt = (long)Math.sqrt(inp); return (inp == (sqrt * sqrt));} }
0	public class Main{ public static void main( String[] args)throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringBuilder out = new StringBuilder();  StringTokenizer tk ;  long n = parseLong(in.readLine()); if ( (n <= 2)) System.out.println(n); else if ( ((n % 2) == 1)) System.out.println(((n * (n - 1)) * (n - 2))); else { long ans = (((n - 1) * (n - 2)) * (n - 3)); if ( (gcd((n * (n - 1)),(n - 3)) == 1)) ans = max(ans,((n * (n - 1)) * (n - 3))); System.out.println(ans); }} static long gcd( long a, long b){ return ((b == 0)?a:gcd(b,(a % b)));} }
0	public class Test{ static int pos = 0; static int arr[] ; static LinkedList l1 = new LinkedList(); public static void main( String[] args){ Scanner in = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  long n = in.nextLong();  long count = 1;  long temp = (n / 2); temp += count; System.out.println(temp); } }
6	public class b{ static int n ,k ,A ; static int[] l ,p ; static double[][][] memo ; public static void main( String[] args){ Scanner in = new Scanner(System.in); n = in.nextInt(); k = in.nextInt(); A = in.nextInt(); memo = new double[(n + 1)][(n + 1)][(1 << n)]; l = new int[n]; p = new int[n]; for ( int i = 0;(i < n);i++) {l[i] = in.nextInt(); p[i] = in.nextInt(); }System.out.printf("%.10f%n",go(0,k)); } static double go( int pos, int left){ if ( (pos == n)) {for ( int i = 0;(i <= n);i++) for ( int j = 0;(j <= n);j++) Arrays.fill(memo[i][j],-1); return go2(0,((n / 2) + 1),0);} double best = go((pos + 1),left); if ( (left == 0)) return best; if ( (p[pos] < 100)) {p[pos] += 10; best = Math.max(best,go(pos,(left - 1))); p[pos] -= 10; } return best;} static double go2( int pos, int needed, int mask){ if ( (needed == 0)) return 1.0; if ( (pos == n)) { int tot = 0; for ( int i = 0;(i < n);i++) if ( ((mask & (1 << i)) != 0)) tot += l[((n - i) - 1)]; return (A / ((A + tot) + 0.0));} if ( (memo[pos][needed][mask] != -1)) return memo[pos][needed][mask]; double a = ((p[pos] / 100.) * go2((pos + 1),(needed - 1),(mask * 2)));  double b = ((1 - (p[pos] / 100.)) * go2((pos + 1),needed,((mask * 2) + 1))); return memo[pos][needed][mask] = (a + b);} }
0	public class Main{ public static void main( String[] args)throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  int N = Integer.parseInt(f.readLine()); if ( ((N % 2) == 0)) out.println(("4 " + (N - 4))); if ( ((N % 2) == 1)) out.println(("9 " + (N - 9))); out.close(); System.exit(0); } }
6	public final class CF_599_D1_C{ static boolean verb = true; static void log( Object X){ if ( verb) System.err.println(X); } static void log( Object[] X){ if ( verb) {for ( Object U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X){ if ( verb) {for ( int U :X) System.err.print((U + " ")); System.err.println(""); } } static void log( int[] X, int L){ if ( verb) {for ( int i = 0;(i < L);i++) System.err.print((X[i] + " ")); System.err.println(""); } } static void log( long[] X){ if ( verb) {for ( long U :X) System.err.print((U + " ")); System.err.println(""); } } static void output( Object o){ outputWln((("" + o) + "\n")); } static void outputWln( Object o){ try{out.write(("" + o)); }catch (Exception e){ } } static long mod = 1000000007; static BufferedWriter out ; static InputReader reader ; static void explore( ArrayList<Integer>[] components, ArrayList<Integer> bob, int[][] move, ArrayList<int[]>[] howto, int[][] list){ for ( int x :bob) {if ( (components[x].size() == 1)) { int tm[] = howto[x].get(0);  int L = howto[x].size(); howto[x].add(tm); for ( int i = 0;(i < L);i++) { int[] cur = howto[x].get(i);  int[] nx = howto[x].get((i + 1));  int a = cur[0];  int a2 = nx[0];  int b2 = nx[1]; move[a2][0] = list[a2][b2]; move[a2][1] = a; }} else {explore(components,components[x],move,howto,list); }}} static void process()throws Exception { out = new BufferedWriter(new OutputStreamWriter(System.out)); reader = new InputReader(System.in); int k = reader.readInt();  int[][] list = new int[k][];  long[] sum = new long[k];  int[] L = new int[k];  HashMap<Integer,int[]> target = new HashMap<Integer,int[]>();  long tot = 0; for ( int i = 0;(i < k);i++) {L[i] = reader.readInt(); list[i] = new int[L[i]]; for ( int j = 0;(j < L[i]);j++) {list[i][j] = reader.readInt(); sum[i] += list[i][j]; target.put(list[i][j],new int[]{i,j}); }tot += sum[i]; } int MX = (1 << k);  int AX = 1000000001;  ArrayList<int[]>[] howto = new ArrayList[MX]; log("ok with the data"); if ( ((tot % k) != 0)) {output("No"); } else {tot /= k; for ( int i = 0;(i < k);i++) {if ( (sum[i] == tot)) { int mask = (1 << i);  ArrayList<int[]> cand = new ArrayList<int[]>(); cand.add(new int[]{i,0}); howto[mask] = cand; } else for ( int j = 0;(j < L[i]);j++) { int u = i;  int v = j;  boolean ok = true;  int src_u = u;  int src_v = v;  int mask = 0;  boolean goon = true;  ArrayList<int[]> cand = new ArrayList<int[]>(); while(goon){cand.add(new int[]{u,v}); ok = false; goon = false; long need = (tot - ((long)sum[u] - (long)list[u][v])); if ( (Math.abs(need) <= AX)) { int nd = (int)need;  int[] tm = target.get(nd); if ( (tm != null)) { int nxu = tm[0];  int nxv = tm[1]; if ( ((mask & (1 << nxu)) == 0)) {mask |= (1 << nxu); if ( (nxu == src_u)) {if ( (nxv == src_v)) ok = true; } else {u = nxu; v = nxv; ok = true; goon = true; }} } } }if ( ok) {if ( (howto[mask] == null)) {howto[mask] = cand; } } }}log("step 1 done"); ArrayList[] components = new ArrayList[MX]; for ( int m = 0;(m < MX);m++) {if ( (howto[m] != null)) {components[m] = new ArrayList<Integer>(); components[m].add(m); } } int[] msk = new int[MX];  int w = 0; for ( int a = 0;(a < MX);a++) {if ( (howto[a] != null)) { ArrayList<Integer> add = new ArrayList<Integer>();  int ww = w; for ( int i = 0;(i < ww);i++) { int b = msk[i]; if ( ((b & a) == 0)) { int c = (b | a); log((("creating c:" + c) + " ")); if ( (components[c] == null)) {components[c] = new ArrayList<Integer>(); components[c].add(a); components[c].add(b); msk[w++] = c; } } }msk[w++] = a; } }if ( (components[(MX - 1)] != null)) {output("Yes"); int[][] move = new int[k][2]; explore(components,components[(MX - 1)],move,howto,list); for ( int i = 0;(i < k);i++) {output(((move[i][0] + " ") + (move[i][1] + 1))); }} else {output("No"); }}try{out.close(); }catch (Exception e){ } } public static void main( String[] args)throws Exception { process(); } static final class InputReader{ private final InputStream stream ; private final byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read()throws IOException { if ( (curChar >= numChars)) {curChar = 0; numChars = stream.read(buf); if ( (numChars <= 0)) {return -1;} } return buf[curChar++];} public final int readInt()throws IOException { int c = read();  boolean neg = false; while(isSpaceChar(c)){c = read(); } char d = (char)c; if ( (d == '-')) {neg = true; c = read(); } int res = 0; do {res *= 10; res += (c - '0'); c = read(); }while(!isSpaceChar(c));if ( neg) return -res; return res;} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
6	public class C2{ Scanner in ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni();  int m = ni();  boolean[][] f = new boolean[99][99]; cache = new HashSet<Long>(); out.println(((n * m) - rec(f,n,m,0,0,0))); } Set<Long> cache ; long hash( boolean[][] f, int n, int m, int r, int c, int cur){ long x = 0; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {if ( f[i][j]) x |= (1L << ((i * m) + j)); }}x = ((x * n) + r); x = ((x * m) + c); x = ((x * 41) + cur); return x;} int rec( boolean[][] f, int n, int m, int r, int c, int cur){ if ( (r == n)) return cur; if ( (c >= m)) return rec(f,n,m,(r + 1),0,cur); long h = hash(f,n,m,r,c,cur); if ( cache.contains(h)) return 99999; cache.add(h); int min = (f[r][c]?rec(f,n,m,r,(c + 1),cur):99999); { boolean[] memo = new boolean[]{f[r][c],f[(r + 1)][c],f[r][(c + 1)]}; f[r][c] = true; f[(r + 1)][c] = true; f[r][(c + 1)] = true; min = Math.min(min,rec(f,n,m,r,(c + 2),(cur + 1))); f[r][c] = memo[0]; f[(r + 1)][c] = memo[1]; f[r][(c + 1)] = memo[2]; }{ boolean[] memo = new boolean[]{f[r][c],f[(r + 1)][c],f[(r + 2)][c],f[(r + 1)][(c + 1)],(((c - 1) >= 0)?f[(r + 1)][(c - 1)]:false)}; f[r][c] = true; f[(r + 1)][c] = true; f[(r + 2)][c] = true; f[(r + 1)][(c + 1)] = true; if ( ((c - 1) >= 0)) f[(r + 1)][(c - 1)] = true; min = Math.min(min,rec(f,n,m,r,(c + 1),(cur + 1))); f[r][c] = memo[0]; f[(r + 1)][c] = memo[1]; f[(r + 2)][c] = memo[2]; f[(r + 1)][(c + 1)] = memo[3]; if ( ((c - 1) >= 0)) f[(r + 1)][(c - 1)] = memo[4]; }{ boolean[] memo = new boolean[]{f[r][c],f[r][(c + 1)],f[r][(c + 2)],f[(r + 1)][(c + 1)]}; f[r][c] = true; f[r][(c + 1)] = true; f[r][(c + 2)] = true; f[(r + 1)][(c + 1)] = true; min = Math.min(min,rec(f,n,m,r,(c + 3),(cur + 1))); f[r][c] = memo[0]; f[r][(c + 1)] = memo[1]; f[r][(c + 2)] = memo[2]; f[(r + 1)][(c + 1)] = memo[3]; }return min;} void run()throws Exception { in = (oj?new Scanner(System.in):new Scanner(INPUT)); 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 C2().run(); } int ni(){ return Integer.parseInt(in.next());} boolean oj = (System.getProperty("ONLINE_JUDGE") != null); void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
3	public class C{ public C(){ int N = sc.nextInt();  int R = sc.nextInt();  int[] X = sc.nextInts();  double[] res = new double[N]; for ( int i :rep(N)) {res[i] = R; for ( int j :rep(i)) { int D = abs((X[i] - X[j])); if ( (D <= (2 * R))) { double H = sqrt((((4.0 * R) * R) - ((1.0 * D) * D))); res[i] = max(res[i],(res[j] + H)); } }}exit(res); } static private int[] rep( int N){ return rep(0,N);} static private int[] rep( int S, int T){ if ( (T <= S)) return new int[0]; int[] res = new int[(T - S)]; for ( int i = S;(i < T);++i) res[(i - S)] = i; return res;} static private final IOUtils.MyScanner sc = new IOUtils.MyScanner(); static private void exit( Object o, Object... A){ IOUtils.print(o,A); IOUtils.exit(); } public static void main( String[] args){ new C(); IOUtils.exit(); } }
6	public class Main implements Runnable{ int[] conf ,L ,B ; int n ,k ,A ,sz ; double[] kill ; double best = 0; double solv(){ double res = 0;  double[] a = new double[n]; for ( int i = 0;(i < n);i++) a[i] = (Math.min(100,(L[i] + (10 * conf[i]))) / 100.0); double[] dp1 = new double[sz];  double[] dp2 = new double[sz]; dp1[0] = 1; for ( int i = 0;(i < n);i++) {for ( int msk = 0;(msk < sz);msk++) {dp2[msk] += (dp1[msk] * a[i]); dp2[(msk | (1 << i))] += (dp1[msk] * (1 - a[i])); }for ( int msk = 0;(msk < sz);msk++) {dp1[msk] = dp2[msk]; dp2[msk] = 0; }}for ( int msk = 0;(msk < sz);msk++) {if ( ((n - Integer.bitCount(msk)) > (n / 2))) res += dp1[msk]; else res += (dp1[msk] * kill[msk]); }return res;} void gen( int n, int k){ if ( (n == 0)) {conf[0] = k; double x = solv(); if ( (x > best)) best = x; return ;} for ( int i = 0;(i <= k);i++) {conf[n] = i; gen((n - 1),(k - i)); }conf[n] = 0; } void solve()throws IOException { n = nextInt(); k = nextInt(); A = nextInt(); B = new int[n]; L = new int[n]; for ( int i = 0;(i < n);i++) {B[i] = nextInt(); L[i] = nextInt(); }sz = (1 << n); conf = new int[n]; kill = new double[sz]; for ( int msk = 0;(msk < sz);msk++) { int sum = 0; for ( int i = 0;(i < n);i++) if ( ((msk & (1 << i)) > 0)) {sum += B[i]; } kill[msk] = ((A * 1.) / (A + sum)); }gen((n - 1),k); out.printf(Locale.US,"%1.9f",best); } BufferedReader br ; StringTokenizer st ; PrintWriter out ; String next()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String s = br.readLine(); if ( (s == null)) return null; st = new StringTokenizer(s,", \t"); }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} public static void main( String[] args){ new Thread(new Main()).start(); } }
3	public class C{ public static void main( String[] args){ MyScanner in = new MyScanner();  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt();  int r = in.nextInt();  double[] y = new double[n];  int[] x = new int[n]; for ( int i = 0;(i < n);++i) {x[i] = in.nextInt(); double bestY = r; for ( int j = 0;(j < i);++j) {if ( (Math.abs((x[i] - x[j])) <= (2 * r))) { double ny = (y[j] + Math.sqrt((((4 * r) * r) - ((x[i] - x[j]) * (x[i] - x[j]))))); if ( (ny > bestY)) {bestY = ny; } } }y[i] = bestY; }for ( int i = 0;(i < n);++i) {out.println(y[i]); }out.close(); } public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
0	public class CF1068A{ public CF1068A(){ FS scan = new FS();  long n = scan.nextLong(),m = scan.nextLong(),k = scan.nextLong(),l = scan.nextLong();  long ceil = ((((k + l) + m) - 1) / m); if ( (((k + l) <= n) && ((ceil * m) <= n))) System.out.println(ceil); else System.out.println(-1); } class FS{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next(){ while(!st.hasMoreTokens()){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ e.printStackTrace(); } }return st.nextToken();} public long nextLong(){ return Long.parseLong(next());} } public static void main( String[] args){ new CF1068A(); } }
4	public class Main{ static PrintWriter out ; static int c[][] ; static int x[] ,y[] ,n ; static int degIn[] ; static ArrayList<ArrayList<Integer>> a = new ArrayList<ArrayList<Integer>>(); static int cnt = 0; static boolean b[] ; static private boolean dfs( int i){ if ( (i == -1)) return true; if ( b[i]) return false; b[i] = true; for ( Integer j :a.get(i)) if ( dfs(y[j])) {x[i] = j; y[j] = i; return true;} return false;} static private void find( int k){ int _cnt = -1; if ( (k >= 0)) {x[k] = k; y[k] = k; } while((_cnt != cnt)){_cnt = cnt; Arrays.fill(b,false); if ( (k >= 0)) b[k] = true; for ( int i = 0;(i < n);++i) if ( ((x[i] == -1) && dfs(i))) ++cnt; }if ( (k >= 0)) {x[k] = -1; y[k] = -1; } } public static void solve(){ n = in.nextInt(); int m = in.nextInt(); b = new boolean[n]; c = new int[n][n]; degIn = new int[n]; x = new int[n]; y = new int[n]; Arrays.fill(x,-1); Arrays.fill(y,-1); for ( int i = 0;(i < n);++i) a.add(new ArrayList<Integer>()); while((m-- > 0)){ int i = (in.nextInt() - 1),j = (in.nextInt() - 1); a.get(i).add(j); degIn[j]++; c[i][j] = 1; }find(-1); int kq = Integer.MAX_VALUE; for ( int k = 0;(k < n);++k) {if ( (x[k] != -1)) {y[x[k]] = -1; x[k] = -1; cnt--; } if ( (y[k] != -1)) {x[y[k]] = -1; y[k] = -1; cnt--; } find(k); int t = (((((n * 2) - 1) - a.get(k).size()) - degIn[k]) + c[k][k]); for ( int i = 0;(i < n);++i) if ( (i != k)) t = ((t + a.get(i).size()) - c[i][k]); t = (((t - cnt) + (n - 1)) - cnt); if ( (kq > t)) kq = t; }out.println(kq); } public static void main( String[] args)throws java.lang.Exception { long startTime = System.currentTimeMillis(); out = new PrintWriter(System.out); solve(); out.close(); } }
3	public class Solution{ public static void main( String[] args)throws Exception { MyReader reader = new MyReader(System.in);  MyWriter writer = new MyWriter(System.out); new Solution().run(reader,writer); writer.close(); } private void run( MyReader reader, MyWriter writer)throws Exception { char[] c = reader.nextCharArray();  int n = c.length;  int[] x = new int[n]; for ( int i = 0;(i < n);i++) {x[i] = (c[i] - '0'); } long mod = 1_000_000_007;  long[] p = new long[(n + 1)];  long[] s = new long[(n + 1)]; p[0] = 1; for ( int i = 1;(i <= n);i++) {p[i] = ((p[(i - 1)] * 10) % mod); }s[n] = 1; for ( int i = (n - 1);(i >= 0);i--) {s[i] = (((p[((n - i) - 1)] * x[i]) + s[(i + 1)]) % mod); } long[][][] d = new long[(n + 1)][(n + 1)][2];  long ans = 0; for ( int i = 1;(i < 10);i++) {for ( long[][] q :d) {for ( long[] w :q) {Arrays.fill(w,0); }}for ( int j = 0;(j <= n);j++) {d[j][0][0] = s[j]; d[j][0][1] = p[(n - j)]; }for ( int j = (n - 1);(j >= 0);j--) {for ( int k = 1;(k <= n);k++) {for ( int l = 1;(l >= 0);l--) { int lim = ((l == 1)?10:(x[j] + 1)); for ( int m = 0;(m < lim);m++) {d[j][k][l] += d[(j + 1)][(k - ((m >= i)?1:0))][(((l == 1) || (m < x[j]))?1:0)]; d[j][k][l] %= mod; }}if ( (j == 0)) {ans = ((ans + (p[(k - 1)] * d[0][k][0])) % mod); } }}}System.out.println(ans); } static class MyReader{ final BufferedInputStream in ; final int bufSize = (1 << 16); final byte buf[] = new byte[bufSize]; int i = bufSize; int k = bufSize; boolean end = false; final StringBuilder str = new StringBuilder(); MyReader( InputStream in){ this.in = new BufferedInputStream(in,bufSize); } int nextInt()throws IOException { return (int)nextLong();} int[] nextIntArray( int n)throws IOException { int[] m = new int[n]; for ( int i = 0;(i < n);i++) {m[i] = nextInt(); }return m;} long nextLong()throws IOException { int c ;  long x = 0;  boolean sign = true; while(((c = nextChar()) <= 32));if ( (c == '-')) {sign = false; c = nextChar(); } if ( (c == '+')) {c = nextChar(); } while((c >= '0')){x = ((x * 10) + (c - '0')); c = nextChar(); }return (sign?x:-x);} int nextChar()throws IOException { if ( (i == k)) {k = in.read(buf,0,bufSize); i = 0; } return ((i >= k)?-1:buf[i++]);} String nextString()throws IOException { if ( end) {return null;} str.setLength(0); int c ; while((((c = nextChar()) <= 32) && (c != -1)));if ( (c == -1)) {end = true; return null;} while((c > 32)){str.append((char)c); c = nextChar(); }return str.toString();} char[] nextCharArray()throws IOException { return nextString().toCharArray();} } static class MyWriter{ final BufferedOutputStream out ; final int bufSize = (1 << 16); final byte buf[] = new byte[bufSize]; int i = 0; final byte c[] = new byte[30]; static final String newLine = System.getProperty("line.separator"); MyWriter( OutputStream out){ this.out = new BufferedOutputStream(out,bufSize); } void print( long x)throws IOException { int j = 0; if ( ((i + 30) >= bufSize)) {flush(); } if ( (x < 0)) {buf[i++] = (byte)'-'; x = -x; } while(((j == 0) || (x != 0))){c[j++] = (byte)((x % 10) + '0'); x /= 10; }while((j-- > 0))buf[i++] = c[j]; } void print( int[] m)throws IOException { for ( int a :m) {print(a); print(' '); }} void print( long[] m)throws IOException { for ( long a :m) {print(a); print(' '); }} void print( String s)throws IOException { for ( int i = 0;(i < s.length());i++) {print(s.charAt(i)); }} void print( char x)throws IOException { if ( (i == bufSize)) {flush(); } buf[i++] = (byte)x; } void print( char[] m)throws IOException { for ( char c :m) {print(c); }} void println( String s)throws IOException { print(s); println(); } void println()throws IOException { print(newLine); } void flush()throws IOException { out.write(buf,0,i); out.flush(); i = 0; } void close()throws IOException { flush(); out.close(); } } }
6	public class C{ static int K ; static int sz[] ; static long vs[][] ; static long curSum[] ; static HashMap<Long,Integer> valToBucket ; static long sum ; static int maskIfPick[][] ; static int dp[] ; static int pickId[] ; static int newBox[] ; public static void main( String[] args){ FS in = new FS(); K = in.nextInt(); sz = new int[K]; valToBucket = new HashMap<Long,Integer>(); vs = new long[K][]; curSum = new long[K]; sum = 0; for ( int i = 0;(i < K);i++) {sz[i] = in.nextInt(); vs[i] = new long[sz[i]]; for ( int j = 0;(j < sz[i]);j++) { long v = in.nextLong(); sum += v; curSum[i] += v; vs[i][j] = v; valToBucket.put(v,i); }}if ( ((sum % K) != 0)) {System.out.println("No"); return ;} sum /= K; maskIfPick = new int[K][]; for ( int i = 0;(i < K);i++) {maskIfPick[i] = new int[sz[i]]; for ( int j = 0;(j < sz[i]);j++) { int mask = (1 << i);  boolean works = false;  long curLookfor = (sum - (curSum[i] - vs[i][j])); while(true){if ( !valToBucket.containsKey(curLookfor)) break; int nextBucket = valToBucket.get(curLookfor); if ( (nextBucket == i)) {works = (curLookfor == vs[i][j]); break;} else if ( ((mask & (1 << nextBucket)) > 0)) break; else {mask |= (1 << nextBucket); curLookfor = (sum - (curSum[nextBucket] - curLookfor)); }}if ( works) maskIfPick[i][j] = mask; }}dp = new int[(1 << K)]; Arrays.fill(dp,-1); int res = go(0); if ( (res == 0)) {System.out.println("No"); } else {System.out.println("Yes"); pickId = new int[K]; newBox = new int[K]; Arrays.fill(pickId,-1); buildback(0); for ( int i = 0;(i < K);i++) {System.out.println(((vs[i][pickId[i]] + " ") + (newBox[i] + 1))); }}} static void pick( int i, int j){ if ( (pickId[i] != -1)) return ; pickId[i] = j; long curLookfor = (sum - (curSum[i] - vs[i][j]));  int nextBucket = valToBucket.get(curLookfor); newBox[nextBucket] = i; for ( int k = 0;(k < sz[nextBucket]);k++) {if ( (vs[nextBucket][k] == curLookfor)) pick(nextBucket,k); }} static int go( int mask){ if ( ((mask + 1) == (1 << K))) return 1; if ( (dp[mask] != -1)) return dp[mask]; int bit = -1; for ( int i = 0;(i < K);i++) {if ( ((mask & (1 << i)) == 0)) {bit = i; break;} } int res = 0; for ( int take = 0;(take < sz[bit]);take++) { int newMask = maskIfPick[bit][take]; if ( ((newMask == 0) || ((mask & newMask) > 0))) continue; res = (res | go((mask | newMask))); }return dp[mask] = res;} static void buildback( int mask){ if ( ((mask + 1) == (1 << K))) return ; int bit = -1; for ( int i = 0;(i < K);i++) {if ( ((mask & (1 << i)) == 0)) {bit = i; break;} } int res = 0; for ( int take = 0;(take < sz[bit]);take++) { int newMask = maskIfPick[bit][take]; if ( ((newMask == 0) || ((mask & newMask) > 0))) continue; res = (res | go((mask | newMask))); if ( (res == 1)) {pick(bit,take); buildback((mask | newMask)); break;} }} static class FS{ BufferedReader br ; StringTokenizer st ; public FS(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ throw (null);} }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } }
0	public class ToyArmies{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long n = in.nextLong(); System.out.print(String.format("%d",(long)(n * 1.5))); } }
0	public class main1{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int a = (n / 2);  int b = (n - a); if ( ((n % 2) == 0)) {if ( ((a % 2) == 1)) {a++; b--; } System.out.println(((a + " ") + b)); } else {if ( ((a % 2) == 1)) { int x = a; a = b; b = x; } if ( ((b % 3) == 0)) {} else if ( ((b % 3) == 1)) {a -= 2; b += 2; } else {a += 2; b -= 2; }System.out.println(((a + " ") + b)); }} }
6	public class Main{ public Main(){ super(); } public static void main( String... args){ Main main = new Main(); main.start(); } public void start(){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  double a[][] = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) a[i][j] = Double.parseDouble(in.next()); int nn = (1 << n);  double p[] = new double[nn]; Arrays.fill(p,-1.0); p[(nn - 1)] = 1.0; DecimalFormat f = new DecimalFormat(); f.applyPattern("0.000000"); for ( int i = 0;(i < n);i++) {if ( (i != 0)) System.out.print(" "); System.out.print(f.format(this.probability(a,p,(1 << i)))); }} private double probability( double[][] a, double[] p, int i){ if ( (p[i] >= 0.0)) return p[i]; double ans = 0;  int count = Integer.bitCount(i);  int n = a.length; for ( int j = 0;(j < n);j++) { int jj = (1 << j); if ( ((jj & i) == 0)) { double d = this.probability(a,p,(jj | i));  double dPair = (2.0 / (double)((count + 1) * count));  double s = 0; for ( int l = 0;(l < n);l++) { int ll = (1 << l); if ( ((ll & i) != 0)) s += a[l][j]; }ans += ((d * dPair) * s); } }p[i] = ans; return p[i];} }
2	public class A{ static private Scanner in ; final int M = 1000000009; public void run(){ int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int z = (n - m); if ( (z >= (n / k))) {System.out.println(m); return ;} int f = (n - (k * z));  int last = ((f % k) + ((k - 1) * z)); f /= k; int ans = BigInteger.ONE.shiftLeft((f + 1)).remainder(BigInteger.valueOf(M)).intValue(); System.out.println((((((ans + M) - 2L) * k) + last) % M)); } public static void main( String[] args){ Locale.setDefault(Locale.US); in = new Scanner(System.in); new A().run(); in.close(); } }
0	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastScanner in = new FastScanner(inputStream);  FastPrinter out = new FastPrinter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, FastScanner in, FastPrinter out){ int n = in.nextInt(); if ( ((n == 1) || (n == 2))) {out.println(n); return ;} if ( (n == 4)) {out.println(12); return ;} long nn = n; if ( ((n % 2) == 1)) { long ans = ((nn * (nn - 1)) * (nn - 2)); out.println(ans); } else if ( ((n % 3) == 0)) {nn--; long ans = ((nn * (nn - 1)) * (nn - 2)); out.println(ans); } else { long ans = ((nn * (nn - 1)) * (nn - 3)); out.println(ans); }} } class FastScanner extends BufferedReader{ public FastScanner( InputStream is){ super(new InputStreamReader(is)); } public int read(){ try{ int ret = super.read(); return ret; }catch (IOException e){ throw (new InputMismatchException());} } static boolean isWhiteSpace( int c){ return ((c >= 0) && (c <= 32));} public int nextInt(){ int c = read(); while(isWhiteSpace(c)){c = read(); } int sgn = 1; if ( (c == '-')) {sgn = -1; c = read(); } int ret = 0; while(((c >= 0) && !isWhiteSpace(c))){if ( ((c < '0') || (c > '9'))) {throw (new NumberFormatException((("digit expected " + (char)c) + " found")));} ret = (((ret * 10) + c) - '0'); c = read(); }return (ret * sgn);} } class FastPrinter extends PrintWriter{ public FastPrinter( OutputStream out){ super(out); } public FastPrinter( Writer out){ super(out); } }
3	public class Main{ public static String taskName = ""; public class Task{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt();  int r = in.nextInt();  int[] x = new int[n]; for ( int i = 0;(i < n);i++) x[i] = in.nextInt(); double[] y = new double[n]; for ( int i = 0;(i < n);i++) {y[i] = r; for ( int j = 0;(j < i);j++) { int dx = Math.abs((x[i] - x[j])); if ( (dx <= (2 * r))) y[i] = Math.max(y[i],(y[j] + Math.abs(Math.sqrt((((4 * r) * r) - (dx * dx)))))); }System.out.print((y[i] + " ")); }System.out.println(); } } public static void main( String[] args)throws FileNotFoundException { if ( !taskName.isEmpty()) {System.setIn(new BufferedInputStream(new FileInputStream((taskName + ".in")))); System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream((taskName + ".out"))))); } InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  Main main = new Main(); main.run(in,out); out.close(); } public void run( InputReader in, PrintWriter out){ Task solver = new Task(); solver.solve(1,in,out); } 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());} } }
5	public class Main{ public static void main( String[] args){ Scanner scanner = new Scanner(System.in);  int n = scanner.nextInt(),m = scanner.nextInt();  int[] vertical = new int[n]; for ( int i = 0;(i < n);i++) {vertical[i] = scanner.nextInt(); }Arrays.sort(vertical); ArrayList<Integer> horisontal = new ArrayList<>();  int amount = 0; for ( int i = 0;(i < m);i++) { int x1 = scanner.nextInt(),x2 = scanner.nextInt(),y = scanner.nextInt(); if ( (x1 == 1)) {amount++; horisontal.add(x2); } }Collections.sort(horisontal); if ( (amount == 0)) {System.out.println(0); return ;} int minVal = amount,horSize = horisontal.size(),verLen = vertical.length;  int h = 0,v = 0; for ( ;((v < verLen) && (h < horSize));) {while(((h < horSize) && (horisontal.get(h) < vertical[v]))){h++; amount--; }minVal = Math.min(minVal,(amount + v)); while((((h < horSize) && (v < verLen)) && (horisontal.get(h) >= vertical[v]))){minVal = Math.min(minVal,(amount + v)); v++; }}if ( (horisontal.get((horSize - 1)) < 1E9)) {minVal = Math.min(minVal,v); } System.out.println(minVal); } }
0	public class Main{ public static void main( String[] args)throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in));  StringBuilder out = new StringBuilder();  StringTokenizer tk ;  long n = parseLong(in.readLine()); System.out.println("25"); } }
2	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);  TaskD solver = new TaskD(); solver.solve(1,in,out); out.close(); } } class TaskD{ public void solve( int testNumber, InputReader in, PrintWriter out){ long LL = in.nextLong();  long RR = in.nextLong();  long L = LL;  long R = RR;  long ans = 0L;  long X = Long.highestOneBit(R); while(((X > 0L) && ((L & X) == (R & X))))X >>= 1; while((X > 0L)){ long a = (L & X);  long b = (R & X); if ( ((a ^ b) == X)) ans |= X; else {if ( (b == 0L)) {if ( ((R | X) <= RR)) {R |= X; ans |= X; } else if ( ((L | X) <= RR)) {L |= X; ans |= X; } } else {if ( ((L ^ X) >= LL)) {L ^= X; ans |= X; } else if ( ((R ^ X) >= LL)) {R ^= X; ans |= X; } }}X >>= 1; }out.println(ans); } } class InputReader{ BufferedReader br ; StringTokenizer st ; public InputReader( InputStream in){ br = new BufferedReader(new InputStreamReader(in)); st = null; } public String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} public long nextLong(){ return Long.parseLong(next());} }
6	public class Fishes{ public static void main( String[] args){ Scanner s = new Scanner(System.in);  int n = s.nextInt();  double[][] p = new double[n][n];  double[] dp = new double[(1 << 18)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {p[i][j] = Double.parseDouble(s.next()); }} int last = (1 << n); dp[(last - 1)] = 1.0; for ( int i = (last - 2);(i > 0);i--) { int res = 0; for ( int j = 0;(j < n);j++) {if ( (((1 << j) & i) > 0)) res++; }res++; res = ((res * (res - 1)) / 2); for ( int j = 0;(j < n);j++) {if ( (((1 << j) & i) == 0)) {for ( int z = 0;(z < n);z++) {if ( (((1 << z) & i) > 0)) {dp[i] += (((dp[(i | (1 << j))] * 1.0) / res) * p[z][j]); } }} }}for ( int i = 0;(i < n);i++) {System.out.print((dp[(1 << i)] + " ")); }} }
2	public class LittleGirlAndXor{ static long L ,R ; static Long[][][][][] dp = new Long[64][2][2][2][2]; public static long go( int index, int low1, int high1, int low2, int high2){ if ( (index == -1)) {return 0;} if ( (dp[index][low1][high1][low2][high2] != null)) return dp[index][low1][high1][low2][high2]; int bit1 = (((L & (1L << index)) == 0)?0:1);  int bit2 = (((R & (1L << index)) == 0)?0:1);  long res = 0; for ( int i = 0;(i < 2);i++) {for ( int j = 0;(j < 2);j++) { int nl1 = low1,nh1 = high1,nl2 = low2,nh2 = high2;  boolean can = true; if ( (low1 == 0)) {if ( (i == bit1)) {nl1 = 0; } else if ( (i < bit1)) {can = false; } else if ( (i > bit1)) {nl1 = 1; } } if ( (high1 == 0)) {if ( (i == bit2)) {nh1 = 0; } else if ( (i < bit2)) {nh1 = 1; } else if ( (i > bit2)) {can = false; } } if ( (low2 == 0)) {if ( (j == bit1)) {nl2 = 0; } else if ( (j < bit1)) {can = false; } else if ( (j > bit1)) {nl2 = 1; } } if ( (high2 == 0)) {if ( (j == bit2)) {nh2 = 0; } else if ( (j < bit2)) {nh2 = 1; } else if ( (j > bit2)) {can = false; } } if ( can) { long xor = (i ^ j); res = Math.max(res,((xor << index) + go((index - 1),nl1,nh1,nl2,nh2))); } }}return dp[index][low1][high1][low2][high2] = res;} public static void main( String[] args){ InputReader r = new InputReader(System.in); L = r.nextLong(); R = r.nextLong(); System.out.println(go(63,0,0,0,0)); } static class InputReader{ private BufferedReader reader ; private StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); 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 long nextLong(){ return Long.parseLong(next());} } }
2	public class A1177{ public static long exponential( long a, long b){ long result = 1; for ( int i = 0;(i < b);i++) {result *= a; }return result;} public static void main( String[] args){ Scanner scanner = new Scanner(System.in);  long k = scanner.nextLong();  long sum = 0;  long i = 1; while(true){ long interval = ((9 * exponential(10,(i - 1))) * i); if ( ((sum + interval) >= k)) {break;} else {i++; sum += interval; }} long t = (k - sum);  long targetNumber = (exponential(10,(i - 1)) + ((t - 1) / i));  String s = ("" + targetNumber);  int hedef = (int)((t - 1) % i); System.out.println(s.charAt(hedef)); } }
4	public class B{ static int n ,t[] ,g[] ,MOD = ((int)1e9 + 7); static int[][][] memo1 ,memo2[] ,memo3[] ; static int dp1( int idx, int remCnt, int remSum){ if ( (idx == n)) return (((remSum == 0) && (remCnt == 0))?1:0); if ( (memo1[idx][remCnt][remSum] != -1)) return memo1[idx][remCnt][remSum]; int ans = dp1((idx + 1),remCnt,remSum); if ( (((g[idx] == 0) && (t[idx] <= remSum)) && (remCnt > 0))) {ans += dp1((idx + 1),(remCnt - 1),(remSum - t[idx])); if ( (ans >= MOD)) ans -= MOD; } return memo1[idx][remCnt][remSum] = ans;} static int dp2( int idx, int remCnt1, int remCnt2, int remSum){ int all = (remCnt1 + remCnt2); if ( (all == 0)) return ((remSum == 0)?1:0); if ( ((idx == n) || (remSum == 0))) return 0; if ( (memo2[idx][remCnt1][remCnt2][remSum] != -1)) return memo2[idx][remCnt1][remCnt2][remSum]; int ans = dp2((idx + 1),remCnt1,remCnt2,remSum); if ( (t[idx] <= remSum)) {if ( ((g[idx] == 1) && (remCnt1 > 0))) ans += dp2((idx + 1),(remCnt1 - 1),remCnt2,(remSum - t[idx])); else if ( ((g[idx] == 2) && (remCnt2 > 0))) ans += dp2((idx + 1),remCnt1,(remCnt2 - 1),(remSum - t[idx])); } return memo2[idx][remCnt1][remCnt2][remSum] = ans;} static private int dp3( int cnt0, int cnt1, int cnt2, int last){ if ( (((cnt0 + cnt1) + cnt2) == 0)) return 1; if ( (memo3[last][cnt0][cnt1][cnt2] != -1)) return memo3[last][cnt0][cnt1][cnt2]; long ans = 0; if ( ((cnt0 > 0) && (last != 0))) ans += dp3((cnt0 - 1),cnt1,cnt2,0); if ( ((cnt1 > 0) && (last != 1))) ans += dp3(cnt0,(cnt1 - 1),cnt2,1); if ( ((cnt2 > 0) && (last != 2))) ans += dp3(cnt0,cnt1,(cnt2 - 1),2); return memo3[last][cnt0][cnt1][cnt2] = (int)(ans % MOD);} public static void main( String[] args)throws IOException { Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out); n = sc.nextInt(); int[] fac = new int[(n + 1)]; t = new int[n]; g = new int[n]; int[] cnt = new int[3]; fac[0] = 1; for ( int i = 1;(i <= n);i++) fac[i] = (int)(((i * 1L) * fac[(i - 1)]) % MOD); int T = sc.nextInt(); for ( int i = 0;(i < n);i++) {t[i] = sc.nextInt(); g[i] = (sc.nextInt() - 1); cnt[g[i]]++; }memo1 = new int[n][(cnt[0] + 1)][(T + 1)]; memo2 = new int[n][(cnt[1] + 1)][(cnt[2] + 1)][(T + 1)]; memo3 = new int[4][(cnt[0] + 1)][(cnt[1] + 1)][(cnt[2] + 1)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= cnt[0]);j++) Arrays.fill(memo1[i][j],-1); for ( int j = 0;(j <= cnt[1]);j++) for ( int k = 0;(k <= cnt[2]);k++) Arrays.fill(memo2[i][j][k],-1); }for ( int i = 0;(i < 4);i++) for ( int j = 0;(j <= cnt[0]);j++) for ( int k = 0;(k <= cnt[1]);k++) Arrays.fill(memo3[i][j][k],-1); int ans = 0; for ( int cnt0 = 0;(cnt0 <= cnt[0]);cnt0++) for ( int sum0 = 0;(sum0 <= T);sum0++) for ( int cnt1 = 0;(cnt1 <= cnt[1]);cnt1++) for ( int cnt2 = 0;(cnt2 <= cnt[2]);cnt2++) { long ways = (((dp1(0,cnt0,sum0) * 1L) * dp2(0,cnt1,cnt2,(T - sum0))) % MOD); ways = ((ways * dp3(cnt0,cnt1,cnt2,3)) % MOD); ways *= fac[cnt0]; ways %= MOD; ways *= fac[cnt1]; ways %= MOD; ways *= fac[cnt2]; ways %= MOD; ans += ways; if ( (ans >= MOD)) ans -= MOD; }out.println(ans); out.close(); } static class Scanner{ BufferedReader br ; StringTokenizer st ; Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } Scanner( String fileName)throws FileNotFoundException{ br = new BufferedReader(new FileReader(fileName)); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} boolean ready()throws IOException { return br.ready();} } }
0	public class Main{ public static void main( String[] args){ try{ Parserdoubt pd = new Parserdoubt(System.in);  int n = pd.nextInt();  PrintWriter pw = new PrintWriter(System.out); pw.println(((n * 3) / 2)); pw.flush(); }catch (Exception e){ } } } class Parserdoubt{ private final int BUFFER_SIZE = (1 << 17); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ,bytesRead ; public Parserdoubt( InputStream in){ din = new DataInputStream(in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public int nextInt()throws Exception { int ret = 0;  byte c = read(); while((c <= ' '))c = read(); boolean neg = (c == '-'); if ( neg) c = read(); do {ret = (((ret * 10) + c) - '0'); c = read(); }while((c > ' '));if ( neg) return -ret; return ret;} private void fillBuffer()throws Exception { bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) buffer[0] = -1; } private byte read()throws Exception { if ( (bufferPointer == bytesRead)) fillBuffer(); return buffer[bufferPointer++];} }
4	public class PhoenixAndComputers{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int mod = Integer.parseInt(st.nextToken());  long[][] dp = new long[(n + 2)][(n + 1)];  long[] pow = new long[(n + 1)]; pow[0] = 1; for ( int i = 1;(i <= n);i++) {pow[i] = (pow[(i - 1)] * 2); pow[i] %= mod; } long[][] choose = new long[((n * 2) + 1)][(n + 1)]; for ( int i = 0;(i <= n);i++) {choose[i][i] = 1; }for ( int i = 1;(i <= (n * 2));i++) {for ( int j = 0;(j <= n);j++) {choose[i][j] = choose[(i - 1)][j]; if ( (j > 0)) {choose[i][j] += choose[(i - 1)][(j - 1)]; } choose[i][j] %= mod; }}dp[0][0] = 1; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= i);j++) {for ( int k = 1;((k + i) <= n);k++) {dp[((i + k) + 1)][(j + k)] += (((pow[(k - 1)] * choose[(j + k)][k]) % mod) * dp[i][j]); dp[((i + k) + 1)][(j + k)] %= mod; }}} long ans = 0; for ( int j = 0;(j <= n);j++) {ans += dp[(n + 1)][j]; ans %= mod; }System.out.println(ans); } }
2	public class d_169{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long x = sc.nextLong();  long y = sc.nextLong();  String s = Long.toBinaryString(x);  String p = Long.toBinaryString(y);  int id = (p.length() - s.length()); for ( int i = 1;(i <= id);i++) {s = ("0" + s); }if ( (x == y)) {System.out.println(0); return ;} for ( int i = 0;(i < p.length());i++) {if ( (s.charAt(i) != p.charAt(i))) {System.out.println(((long)Math.pow(2,(s.length() - i)) - 1)); return ;} }} }
5	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, InputReader in, OutputWriter out){ int N = in.readInt();  long K = in.readLong();  long[] a = new long[N]; for ( int i = 0;(i < N);++i) {a[i] = in.readLong(); } ArrayShuffler s = new ArrayShuffler(); s.shuffle(a); Arrays.sort(a); boolean[] taken = new boolean[N]; Arrays.fill(taken,true); int i = 0;  int j = (i + 1);  int res = N; while((i < a.length)){if ( (taken[i] == false)) {i++; if ( (j <= i)) j = (i + 1); continue;} while(((j < a.length) && (a[j] < (a[i] * K)))){j++; }if ( (j < a.length)) {if ( (a[j] == (a[i] * K))) {taken[j] = false; res--; } } i++; if ( (j <= i)) j = (i + 1); }out.printLine(res); } } class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } public int read(){ if ( (numChars == -1)) throw (new UnknownError()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = stream.read(buf); }catch (IOException e){ throw (new UnknownError());} 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(); } else if ( (c == '+')) {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 static boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(outputStream); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } } class ArrayShuffler{ static Random random = new Random(7428429L); public void shuffle( long[] p){ for ( int i = 0;(i < p.length);++i) { int j = (i + random.nextInt((p.length - i)));  long temp = p[i]; p[i] = p[j]; p[j] = temp; }} }
6	public class B{ public static void main( String[] args)throws Exception { new B().run(); } double ans = 0; int n ,candy ,A ,half ; void run()throws Exception { Scanner sc = new Scanner(System.in); n = sc.nextInt(); candy = sc.nextInt(); A = sc.nextInt(); half = (n / 2); S[] ss = new S[n]; for ( int i = 0;(i < n);i++) {ss[i] = new S(sc.nextInt(),sc.nextInt()); }Arrays.sort(ss); int need = 0; for ( int i = (n - 1);(i >= ((n - half) - 1));i--) need += ((100 - ss[i].loyal) / 10); if ( (need <= candy)) {System.out.println(1.0); return ;} tra(ss,0,candy); System.out.printf("%.10f\n",ans); } void tra( S[] ss, int pos, int rest){ if ( (pos == n)) { double sum = 0;  int lim = (1 << n); for ( int m = 0;(m < lim);m++) { int app = Integer.bitCount(m);  double p = 1;  int B = 0; for ( int i = 0;(i < n);i++) {if ( (((m >> i) & 1) == 1)) {p = ((p * ss[i].loyal) / 100); } else {p = ((p * (100 - ss[i].loyal)) / 100); B += ss[i].level; }}if ( (app > half)) sum += p; else {sum += ((p * A) / (A + B)); }}ans = max(ans,sum); return ;} for ( int i = 0;(i <= rest);i++) { int old = ss[pos].loyal;  int nl = (ss[pos].loyal + (i * 10)); if ( (nl > 100)) break; ss[pos].loyal = nl; tra(ss,(pos + 1),(rest - i)); ss[pos].loyal = old; }} } class S implements Comparable<S>{ int level ,loyal ; S( int a, int b){ level = a; loyal = b; } }
4	public class GeorgeAndInterestingGraph{ public static void main( String[] args){ MyScanner sc = new MyScanner();  int N = sc.nextInt();  int M = sc.nextInt();  int[] edgeFrom = new int[M];  int[] edgeTo = new int[M]; for ( int i = 0;(i < M);i++) {edgeFrom[i] = sc.nextInt(); edgeTo[i] = sc.nextInt(); } int best = Integer.MAX_VALUE;  boolean[][] adjMat = makeAdjMat(N,edgeFrom,edgeTo); for ( int i = 0;(i < N);i++) { boolean[][] mat = copyOfArray2d(adjMat); best = Math.min(best,count(mat,M,i)); }System.out.println(best); } public static boolean[][] copyOfArray2d( boolean[][] arr){ int N = arr.length;  int M = arr[0].length;  boolean[][] copy = new boolean[N][M]; for ( int i = 0;(i < N);i++) {System.arraycopy(arr[i],0,copy[i],0,M); }return copy;} public static int count( boolean[][] mat, int M, int center){ int N = mat.length;  int centerCount = (mat?1:0); for ( int i = 0;(i < N);i++) {if ( (i != center)) {if ( mat[i][center]) {centerCount++; } if ( mat[center][i]) {centerCount++; } } mat[i][center] = false; mat[center][i] = false; } int other = (M - centerCount);  int matches = bipartiteMatching(mat); return ((((((((2 * N) - 1) - centerCount) + other) - matches) + N) - 1) - matches);} public static boolean[][] makeAdjMat( int N, int[] edgeFrom, int[] edgeTo){ boolean[][] mat = new boolean[N][N]; for ( int i = 0;(i < edgeFrom.length);i++) { int from = (edgeFrom[i] - 1);  int to = (edgeTo[i] - 1); mat[from][to] = true; }return mat;} public static boolean bipartiteMatchingHelper( boolean[][] bpGraph, int u, boolean[] seen, int[] matchR){ int N = bpGraph[0].length; for ( int v = 0;(v < N);v++) {if ( (bpGraph[u][v] && !seen[v])) {seen[v] = true; if ( ((matchR[v] < 0) || bipartiteMatchingHelper(bpGraph,matchR[v],seen,matchR))) {matchR[v] = u; return true;} } }return false;} public static int bipartiteMatching( boolean[][] bpGraph, int[] matchIJ, int[] matchJI){ int ans = bipartiteMatching(bpGraph,matchJI); for ( int i = 0;(i < matchJI.length);i++) {matchIJ[i] = -1; }for ( int j = 0;(j < matchJI.length);j++) { int i = matchJI[j]; if ( (i >= 0)) {matchIJ[i] = j; } }return ans;} public static int bipartiteMatching( boolean[][] bpGraph, int[] matchJI){ int M = bpGraph.length;  int N = bpGraph[0].length; for ( int i = 0;(i < N);i++) {matchJI[i] = -1; } int ans = 0; for ( int u = 0;(u < M);u++) { boolean[] seen = new boolean[N]; if ( bipartiteMatchingHelper(bpGraph,u,seen,matchJI)) {ans++; } }return ans;} public static int bipartiteMatching( boolean[][] bpGraph){ int N = bpGraph[0].length;  int[] matchJI = new int[N]; return bipartiteMatching(bpGraph,matchJI);} public static int bipartiteMatching( int[][] intGraph){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph);} public static int bipartiteMatching( int[][] intGraph, int[] matchJI){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph,matchJI);} public static int bipartiteMatching( int[][] intGraph, int[] matchIJ, int[] matchJI){ boolean[][] bpGraph = intToBooleanAdjMat(intGraph); return bipartiteMatching(bpGraph,matchIJ,matchJI);} public static boolean[][] intToBooleanAdjMat( int[][] mat){ int M = mat.length;  int N = mat[0].length;  boolean[][] bMat = new boolean[M][N]; for ( int i = 0;(i < M);i++) {for ( int j = 0;(j < N);j++) {bMat[i][j] = (mat[i][j] != 0); }}return bMat;} public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } int nextInt(){ return Integer.parseInt(next());} String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} } }
5	public class Solution{ public static void main( String[] args){ Solution solution = new Solution(); System.out.println(solution.solve()); } private int solve(){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  int m = in.nextInt();  int[] a = new int[m]; for ( int i = 0;(i < m);++i) a[i] = in.nextInt(); if ( (n > m)) return 0; Map<Integer,Integer> map = new HashMap<>(); for ( int k :a) map.put(k,(map.getOrDefault(k,0) + 1)); List<Integer> keySet = new ArrayList<>(map.keySet());  int end = (m / n); keySet.sort((u,v)->-Integer.compare(u,v)); do { int count = 0; for ( int k :keySet) {count += (map.get(k) / end); if ( (count >= n)) return end; }}while((--end > 0));return 0;} }
2	public class CodeForces1177B{ public static char custBinSearch( long lower, long upper, long lowIndex, int ten, long position){ long half = Math.round(((lower + upper) / 2.0));  long lowBound = (lowIndex + ((half - lower) * (ten + 1)));  long upBound = (lowBound + ten); if ( (position < lowBound)) {return custBinSearch(lower,(half - 1),lowIndex,ten,position);} else if ( (position > upBound)) {lowIndex += (((half + 1) - lower) * (ten + 1)); return custBinSearch((half + 1),upper,lowIndex,ten,position);} else {return Long.toString(half).charAt((int)(position - lowBound));}} public static void main( String[] args)throws IOException { BufferedReader inputs = new BufferedReader(new InputStreamReader(System.in));  long indexPosition = Long.parseLong(inputs.readLine()); inputs.close(); int tenFactor = 0;  long lowerBound = 1;  long upperBound = (long)Math.pow(10,12);  long lowerIndexBound = 1;  long redIndex = 0; redIndex += indexPosition; while((redIndex > 0)){redIndex -= (long)((9 * Math.pow(10,tenFactor)) * (tenFactor + 1)); if ( (redIndex <= 0)) {lowerBound = (long)Math.pow(10,tenFactor); upperBound = (long)(Math.pow(10,(tenFactor + 1)) - 1); break;} lowerIndexBound += (long)((9 * Math.pow(10,tenFactor)) * (tenFactor + 1)); tenFactor++; }System.out.println(custBinSearch(lowerBound,upperBound,lowerIndexBound,tenFactor,indexPosition)); } }
4	public class CF1515E extends PrintWriter{ CF1515E(){ super(System.out,true); } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1515E o = new CF1515E(); o.main(); o.flush(); } void main(){ int n = sc.nextInt();  int md = sc.nextInt();  int k = ((n + 1) / 2);  int[][] dp = new int[(k + 1)][(n + 1)]; dp[0][0] = 1; for ( int h = 1;(h <= k);h++) for ( int l = h;(l <= ((n - h) + 1));l++) dp[h][l] = (int)((((dp[h][(l - 1)] * 2L) + dp[(h - 1)][(l - 1)]) * h) % md); int ans = 0; for ( int h = 1;(h <= k);h++) ans = ((ans + dp[h][((n - h) + 1)]) % md); println(ans); } }
6	public class B{ static Senator[] data ; public static void main( String[] args){ Scanner in = new Scanner(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt();  int k = in.nextInt();  int A = in.nextInt(); data = new Senator[n]; for ( int i = 0;(i < n);i++) {data[i] = new Senator(in.nextInt(),in.nextInt()); }out.println(cal(0,new int[n],A,k)); out.close(); } public static double cal( int index, int[] num, int A, int left){ if ( (index == (data.length - 1))) { int dif = ((100 - data[index].loyal) / 10); dif = ((left >= dif)?dif:left); num[index] = dif; double result = 0; for ( int k = 0;(k < (1 << num.length));k++) { double val = 1;  double total = 0; for ( int i = 0;(i < num.length);i++) {if ( (((1 << i) & k) != 0)) {val *= ((double)(data[i].loyal + (10 * num[i])) / 100); } else {val *= ((double)(100 - (data[i].loyal + (10 * num[i]))) / 100); total += data[i].level; }}if ( (countBit(k) > (num.length / 2))) {result += val; } else {result += (val * ((double)A / (A + total))); }}return result;} else { double result = 0; for ( int i = 0;(i <= left);i++) {if ( (((i * 10) + data[index].loyal) <= 100)) {num[index] = i; result = Math.max(result,cal((index + 1),num,A,(left - i))); } else {break;}}return result;}} public static int countBit( int val){ int result = 0; while((val > 0)){result += (val % 2); val >>= 1; }return result;} public static class Senator{ int level ,loyal ; public Senator( int level, int loyal){ this.level = level; this.loyal = loyal; } } public double pow( double a, int b){ if ( (b == 0)) {return 1;} if ( (b == 1)) {return a;} double val = pow(a,(b / 2)); if ( ((b % 2) == 0)) {return (val * val);} else {return ((val * val) * a);}} public static long gcd( long a, long b){ if ( (b == 0)) {return a;} return gcd(b,(a % b));} }
0	public class Ideone{ public static void main( String[] args)throws java.lang.Exception { int n ,a ,b ;  Scanner obj = new Scanner(System.in); n = obj.nextInt(); if ( ((n % 4) == 0)) {a = (n / 2); b = (n / 2); System.out.println(((a + " ") + b)); } else if ( (((n % 2) == 0) && ((n % 4) != 0))) {a = ((n / 2) - 1); b = ((n / 2) + 1); System.out.println(((a + " ") + b)); } else if ( ((n % 2) != 0)) {a = 4; b = 0; while((b != 1)){b = (n - a); if ( ((b % 3) == 0)) {System.out.println(((a + " ") + b)); break;} else {a = (a + 2); }}} } }
5	public class f{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  Hashtable<Long,Boolean> d = new Hashtable<Long,Boolean>();  int n = in.nextInt(),k = in.nextInt(),size = 0,a[] = new int[n]; for ( int i = 0;(i < n);i++) a[i] = in.nextInt(); Arrays.sort(a); for ( int i = 0;(i < n);i++) { long x = a[i]; if ( !d.containsKey(x)) {d.put((x * k),true); size++; } }System.out.println(size); } }
2	public class Main{ static int len( long n){ int res = 0; while((n > 0)){n /= 10; res++; }return res;} static long big( int len){ long p = 1; while((len-- > 0))p *= 10; return (p - 1);} static long small( int len){ return (big((len - 1)) + 1);} static long cnt( long n){ int len = len(n);  long cnt = 0; for ( int l = 1;(l < len);l++) cnt += ((1l * l) * ((big(l) - small(l)) + 1)); cnt += ((1l * len) * (n - small(len))); return cnt;} public static void main( String[] args)throws Exception { Scanner sc = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  long k = sc.nextLong(); if ( (k == 1)) {System.out.println(1); return ;} long lo = 1,hi = k,res = 1; while((lo <= hi)){ long mid = ((lo + hi) >> 1L); if ( (cnt(mid) < k)) {res = mid; lo = (mid + 1); } else {hi = (mid - 1); }} ArrayList<Integer> digits = new ArrayList<>();  long tmp = res; while((tmp > 0)){digits.add((int)(tmp % 10)); tmp /= 10; }Collections.reverse(digits); out.println(digits.get((int)((k - cnt(res)) - 1))); out.flush(); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public Scanner( FileReader f){ br = new BufferedReader(f); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public long nextLong()throws IOException { return Long.parseLong(next());} public boolean ready()throws IOException { return br.ready();} } }
3	public class _908C{ public void solve()throws FileNotFoundException { InputStream inputStream = System.in;  InputHelper in = new InputHelper(inputStream);  int n = in.readInteger();  double r = in.readInteger();  double[] x = new double[n]; for ( int i = 0;(i < n);i++) {x[i] = in.readInteger(); } double[] ans = new double[n]; ans[0] = r; for ( int i = 1;(i < n);i++) { double cans = r; for ( int j = 0;(j < i);j++) { double dis = Math.abs((x[j] - x[i])); if ( (dis <= (2 * r))) {if ( (dis == (2 * r))) {cans = Math.max(cans,ans[j]); continue;} else if ( (x[i] == x[j])) {cans = Math.max(cans,(ans[j] + (2 * r))); continue;} cans = Math.max(cans,(ans[j] + Math.sqrt(((4 * (r * r)) - (dis * dis))))); } }ans[i] = cans; }for ( int i = 0;(i < n);i++) {System.out.print((ans[i] + " ")); }} public static void main( String[] args)throws FileNotFoundException { new _908C().solve(); } class InputHelper{ StringTokenizer tokenizer = null; private BufferedReader bufferedReader ; public InputHelper( InputStream inputStream){ InputStreamReader inputStreamReader = new InputStreamReader(inputStream); bufferedReader = new BufferedReader(inputStreamReader,16384); } public String read(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{ String line = bufferedReader.readLine(); if ( (line == null)) {return null;} tokenizer = new StringTokenizer(line); }catch (IOException e){ e.printStackTrace(); } }return tokenizer.nextToken();} public Integer readInteger(){ return Integer.parseInt(read());} } }
4	public class x1515E{ static long MOD ; public static void main( String[] hi)throws Exception { BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(infile.readLine());  int N = Integer.parseInt(st.nextToken()); MOD = Long.parseLong(st.nextToken()); fac = new long[401]; invfac = new long[401]; fac[0] = invfac[0] = 1L; for ( int i = 1;(i <= 400);i++) {fac[i] = ((fac[(i - 1)] * i) % MOD); invfac[i] = power(fac[i],(MOD - 2),MOD); } long[] pow2 = new long[401]; for ( int i = 0;(i <= 400);i++) pow2[i] = power(2,i,MOD); long[][] dp = new long[(N + 1)][(N + 1)]; for ( int v = 1;(v <= N);v++) {dp[v][v] = pow2[(v - 1)]; for ( int k = 1;(k <= v);k++) for ( int block = 1;(block <= k);block++) {if ( (block == v)) continue; long temp = ((dp[((v - block) - 1)][(k - block)] * calc((k - block),block)) % MOD); temp = ((temp * pow2[(block - 1)]) % MOD); dp[v][k] += temp; if ( (dp[v][k] >= MOD)) dp[v][k] -= MOD; }} long res = 0L; for ( int v = 1;(v <= N);v++) {res += dp[N][v]; if ( (res >= MOD)) res -= MOD; }System.out.println(res); } static long[] fac ,invfac ; public static long calc( int a, int b){ long res = ((fac[(a + b)] * invfac[a]) % MOD); return ((res * invfac[b]) % MOD);} public static long power( long x, long y, long p){ long res = 1L; x = (x % p); while((y > 0)){if ( ((y & 1) == 1)) res = ((res * x) % p); y >>= 1; x = ((x * x) % p); }return res;} }
6	public class Ideone{ static double p[][] ; static double dp[] ; static int n ; public static int BitCount( int u){ int uCount ; uCount = ((u - ((u >> 1) & 033333333333)) - ((u >> 2) & 011111111111)); return (((uCount + (uCount >> 3)) & 030707070707) % 63);} public static double f( int mask){ if ( (dp[mask] > -0.5)) return dp[mask]; dp[mask] = 0; int ones = BitCount(mask);  double pairs = ((ones * (ones + 1)) >> 1); for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {if ( (((mask & (1 << i)) != 0) && ((mask & (1 << j)) == 0))) dp[mask] += ((f((mask | (1 << j))) * p[i][j]) / pairs); }}return dp[mask];} public static void main( String[] args)throws NumberFormatException,IOException { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in)); n = Integer.parseInt(bf.readLine()); p = new double[n][n]; for ( int i = 0;(i < n);i++) { StringTokenizer st = new StringTokenizer(bf.readLine()); for ( int j = 0;(j < n);j++) {p[i][j] = Double.parseDouble(st.nextToken()); }}dp = new double[(1 << n)]; Arrays.fill(dp,-1.0); dp[((1 << n) - 1)] = 1.; for ( int i = 0;(i < (n - 1));i++) {System.out.print((f((1 << i)) + " ")); }System.out.println(f((1 << (n - 1)))); } }
6	public class Template{ BufferedReader br ; PrintWriter out ; StringTokenizer st ; public static void main( String[] args)throws IOException { new Template().run(); } void run()throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); st = null; out = new PrintWriter(System.out); solve(); br.close(); out.close(); } double dm[] ; double a[][] ; boolean fil[] ; int p[] ; int n ; void solve()throws IOException { n = nextInt(); a = new double[n][n]; for ( int i = 0;(i < n);++i) for ( int j = 0;(j < n);++j) {a[i][j] = nextDouble(); }dm = new double[(1 << n)]; fil = new boolean[(1 << n)]; for ( int i = 0;(i < n);++i) {out.print((brute((1 << i)) + " ")); }} private double brute( int mask){ if ( (Integer.bitCount(mask) == n)) return 1; if ( fil[mask]) return dm[mask]; int c = Integer.bitCount(mask);  double res = 0;  double p = ((2.0 / (double)(c + 1)) / (double)c); for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < n);++j) {if ( (((mask & (1 << i)) == 0) && ((mask & (1 << j)) > 0))) {res += (a[j][i] * brute((mask ^ (1 << i)))); } }}res *= p; dm[mask] = res; fil[mask] = true; return dm[mask];} int nextInt()throws IOException { return Integer.parseInt(nextToken());} double nextDouble()throws IOException { return Double.parseDouble(nextToken());} String nextToken()throws IOException { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(br.readLine()); }return st.nextToken();} }
1	public class A{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int ans = 0; for ( int i = 1;(i <= n);i++) {ans += (((i * 2) <= n)?i:((n - i) + 1)); }System.out.println(ans); } }
0	public class Test3{ public static void main( String[] args)throws NumberFormatException,IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int x = Integer.parseInt(br.readLine());  int y = Integer.parseInt(br.readLine()); System.out.print((int)(y % Math.pow(2,x))); } }
2	public class con169_D{ static private final boolean DEBUG = false; public static void main(final String[] args)throws Exception { final BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); final String line = br.readLine(); final StringTokenizer tok = new StringTokenizer(line); final long L = Long.parseLong(tok.nextToken()); final long R = Long.parseLong(tok.nextToken()); System.out.println(solve(L,R)); } public static long solve(final long L,final long R){ if ( (L == R)) return (L ^ R); if ( DEBUG) System.out.printf("L=%d (%s), R=%d (%s)\n",L,Long.toBinaryString(L),R,Long.toBinaryString(R)); final int ld = length(L); final int ldm1 = (ld - 1); final int rd = length(R); if ( (ld < rd)) { long max = 1; while((length(max) < rd)){max <<= 1; } long min = 1; while((length(min) < (rd - 1))){min <<= 1; ++min; }if ( DEBUG) System.out.printf("min=%d (%s), max=%d (%s)\n",min,Long.toBinaryString(min),max,Long.toBinaryString(max)); return (min ^ max);} else {final char[] minStr = Long.toBinaryString(L).toCharArray(); final char[] maxStr = Long.toBinaryString(R).toCharArray(); final char[] res = new char[minStr.length]; Arrays.fill(res,'0'); { int i = 0; while((i < res.length)){if ( (minStr[i] == maxStr[i])) {res[i] = '0'; } else {break;}++i; }if ( DEBUG) System.out.println(("diff at pos: " + i)); if ( (minStr[i] == '0')) {res[i++] = '1'; for ( int j = i;(j < res.length);++j) {res[j] = '1'; }} else {throw (new IllegalArgumentException());}}return Long.parseLong(new String(res),2);}} static private int length( long l){ int res = 0; while((l > 0)){++res; l >>= 1; }return res;} }
0	public class Task1{ public static void main( String[] args){ int n = new Scanner(System.in).nextInt(); System.out.println(((n * 3) / 2)); } }
5	public class a{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt();  long k = in.nextLong();  Long[] a = new Long[n]; for ( int i = 0;(i < n);i++) a[i] = in.nextLong(); HashSet<Long> hash = new HashSet<Long>(); Arrays.sort(a); for ( int i = 0;(i < n);i++) if ( !hash.contains(a[i])) {hash.add((a[i] * k)); } System.out.println(hash.size()); } }
6	public class E{ public static void main( String[] args){ Locale.setDefault(Locale.US); Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  double[][] p = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {p[i][j] = sc.nextDouble(); }} double[] dp = new double[(1 << n)]; dp[((1 << n) - 1)] = 1; for ( int mask = ((1 << n) - 1);(mask > 0);mask--) { int t = Integer.bitCount(mask); if ( (t == 1)) continue; double p0 = (1.0 / ((t * (t - 1)) / 2)); for ( int i = 0;(i < n);i++) {if ( ((mask & (1 << i)) != 0)) {for ( int j = 0;(j < n);j++) {if ( ((j != i) && ((mask & (1 << j)) != 0))) dp[(mask ^ (1 << i))] += ((dp[mask] * p[j][i]) * p0); }} }}for ( int i = 0;(i < n);i++) {System.out.print((dp[(1 << i)] + " ")); }} }
4	public class Main{ public static void main( String[] args){ new Main().run(); } FastReader in = new FastReader(); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } long mod = 998244353; long gcd( long a, long b){ return ((a == 0)?b:gcd((b % a),a));} void work(){ int n = ni(); mod = nl(); long[] dp1 = new long[401];  long[][] dp2 = new long[(n + 1)][(n + 1)];  long[][] C = new long[401][401]; for ( int j = 0;(j <= 400);j++) {for ( int i = 0;(i <= j);i++) {if ( ((i == 0) || (j == i))) {C[i][j] = 1; } else {C[i][j] = ((C[(i - 1)][(j - 1)] + C[i][(j - 1)]) % mod); }}}for ( int i = 1;(i <= 400);i++) {for ( int j = 0;(j < i);j++) {dp1[i] = ((dp1[i] + C[j][(i - 1)]) % mod); }}for ( int i = 1;(i <= n);i++) {dp2[i][i] = dp1[i]; }for ( int i = 1;(i <= n);i++) {for ( int j = 1;(j < i);j++) {for ( int k = 1;(k < j);k++) {dp2[i][j] = (dp2[i][j] + ((((dp2[((i - k) - 1)][(j - k)] * dp1[k]) % mod) * C[k][j]) % mod)); dp2[i][j] %= mod; }}} long ret = 0; for ( int j = 1;(j <= n);j++) {ret = ((ret + dp2[n][j]) % mod); }out.println(ret); } private int ni(){ return in.nextInt();} private long nl(){ return in.nextLong();} } class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } public String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,kk ,bb ; int[] uu ,vv ,cost ,cost_ ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; kk = new int[n_]; bb = new int[n_]; uu = new int[m_]; vv = new int[m_]; cost = new int[m_]; cost_ = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } void dijkstra( int s){ Arrays.fill(pi,INF); pi[s] = 0; TreeSet<Integer> pq = new TreeSet<>((u,v)->((pi[u] != pi[v])?(pi[u] - pi[v]):((kk[u] != kk[v])?(kk[u] - kk[v]):(u - v)))); pq.add(s); Integer first ; while(((first = pq.pollFirst()) != null)){ int u = first;  int k = (kk[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost_[h]:-cost_[h]));  int v = ((u ^ uu[h]) ^ vv[h]); if ( ((pi[v] > p) || ((pi[v] == p) && (kk[v] > k)))) {if ( (pi[v] < INF)) pq.remove(v); pi[v] = p; kk[v] = k; bb[v] = h_; pq.add(v); } } }} void push( int s, int t){ int c = INF; for ( int u = t,h_ ,h ;(u != s);u ^= (uu[h] ^ vv[h])) {h = ((h_ = bb[u]) >> 1); c = Math.min(c,cc[h_]); }for ( int u = t,h_ ,h ;(u != s);u ^= (uu[h] ^ vv[h])) {h = ((h_ = bb[u]) >> 1); cc[h_] -= c; cc[(h_ ^ 1)] += c; }} int edmonds_karp( int s, int t){ System.arraycopy(cost,0,cost_,0,m_); while(true){dijkstra(s); if ( (pi[t] == INF)) break; push(s,t); for ( int h = 0;(h < m_);h++) { int u = uu[h],v = vv[h]; if ( ((pi[u] != INF) && (pi[v] != INF))) cost_[h] += (pi[u] - pi[v]); }} int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
3	public class NewYearCurling908C{ public static void main( String[] args)throws IOException { FastScanner in = new FastScanner();  int n = in.nextInt();  double r = (double)in.nextInt();  double[] answers = new double[n];  double[] xCoords = new double[n]; for ( int i = 0;(i < n);i++) xCoords[i] = (double)in.nextInt(); answers[0] = r; for ( int i = 1;(i < n);i++) { double bound = r; for ( int j = 0;(j < i);j++) { double xDif = (xCoords[i] - xCoords[j]);  double y = answers[j];  double yNew = (y + Math.sqrt((((4 * r) * r) - (xDif * xDif)))); if ( (yNew > bound)) bound = yNew; }answers[i] = bound; }for ( int i = 0;(i < n);i++) System.out.print((answers[i] + " ")); System.out.println(); } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( String s){ try{br = new BufferedReader(new FileReader(s)); }catch (FileNotFoundException e){ 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){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(nextToken());} } }
0	public class A{ static private StreamTokenizer in ; static private PrintWriter out ; static private int nextInt()throws Exception { in.nextToken(); return (int)in.nval;} {in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); out = new PrintWriter(System.out); }public static void main( String[] args)throws Exception { int n = nextInt(); out.println(((n * 3) / 2)); out.flush(); } }
6	public class E16{ static double[][] grid ; public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  int n = Integer.parseInt(br.readLine()); grid = new double[n][n]; for ( int i = 0;(i < n);i++) { StringTokenizer st = new StringTokenizer(br.readLine()); for ( int j = 0;(j < n);j++) {grid[i][j] = Double.parseDouble(st.nextToken()); }} boolean[] seen = new boolean[(1 << n)];  double[] prob = new double[(1 << n)]; prob[((1 << n) - 1)] = 1; LinkedList<Integer> q = new LinkedList<Integer>(); q.add(((1 << n) - 1)); while(!q.isEmpty()){ int curr = q.removeFirst(); if ( (Integer.bitCount(curr) == 1)) continue; for ( int i = 0;(i < n);i++) {if ( ((curr & (1 << i)) == 0)) continue; for ( int j = (i + 1);(j < n);j++) {if ( ((curr & (1 << j)) == 0)) continue; prob[(curr - (1 << i))] += (prob[curr] * grid[j][i]); prob[(curr - (1 << j))] += (prob[curr] * grid[i][j]); if ( !seen[(curr - (1 << i))]) {q.addLast((curr - (1 << i))); seen[(curr - (1 << i))] = true; } if ( !seen[(curr - (1 << j))]) {q.addLast((curr - (1 << j))); seen[(curr - (1 << j))] = true; } }}prob[curr] = 0; } double sum = 0; for ( int i = 0;(i < n);i++) {sum += prob[(1 << i)]; }for ( int i = 0;(i < (n - 1));i++) {System.out.print(((prob[(1 << i)] / sum) + " ")); }System.out.println((prob[(1 << (n - 1))] / sum)); } }
3	public class FUck{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  int n = scan.nextInt();  int k = scan.nextInt();  String t = scan.next();  int mx = 0; for ( int i = 1;(i < n);i++) { int gd = 1; for ( int j = 0;(j < i);j++) {if ( (t.charAt(j) != t.charAt(((n - i) + j)))) {gd = 0; } }if ( (gd == 1)) {mx = i; } }System.out.print(t); for ( int i = 2;(i <= k);i++) {for ( int j = mx;(j < n);j++) {System.out.print(t.charAt(j)); }}} }
2	public class Main{ public static void main( String[] args){ new Main().run(); } Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); void run(){ work(); out.flush(); } void work(){ long r = in.nextLong();  long b = 0; for ( ;;b++) { long num = ((9 * (long)Math.pow(10,(double)b)) * (b + 1)); if ( ((r - num) <= 0)) {break;} r -= num; } long base = (long)Math.pow(10,(double)b);  long c = ((r - 1) / (b + 1));  int m = (int)((r - 1) % (b + 1)); base += c; String str = (base + ""); out.println(str.charAt(m)); } }
6	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(); } } class TaskC{ public void solve( int testNumber, InputReader in, PrintWriter out){ n = in.nextInt(); m = in.nextInt(); if ( (n > m)) { int t = m; m = n; n = t; } f = new int[n][m]; res = Integer.MAX_VALUE; cur = 0; step = 1; numFree = (n * m); rec(0,0); out.println(((n * m) - res)); } private void rec( int x, int y){ if ( (numFree == 0)) {res = Math.min(res,cur); return ;} if ( (x >= n)) return ; if ( (y >= m)) {rec((x + 1),0); return ;} if ( (f[x][y] != 0)) {rec(x,(y + 1)); return ;} put(x,y); rec(x,(y + 1)); remove(x,y); if ( isValid((x + 1),y)) {put((x + 1),y); rec(x,(y + 1)); remove((x + 1),y); } if ( isValid(x,(y + 1))) {put(x,(y + 1)); rec(x,(y + 1)); remove(x,(y + 1)); } } private void put( int x, int y){ for ( int i = 0;(i < 5);++i) { int nx = (x + dx[i]);  int ny = (y + dy[i]); if ( isValid(nx,ny)) {if ( (f[nx][ny] == 0)) {--numFree; f[nx][ny] = step; } } }++step; ++cur; } private void remove( int x, int y){ --step; for ( int i = 0;(i < 5);++i) { int nx = (x + dx[i]);  int ny = (y + dy[i]); if ( isValid(nx,ny)) {if ( (f[nx][ny] == step)) {++numFree; f[nx][ny] = 0; } } }--cur; } private boolean isValid( int x, int y){ return ((((x >= 0) && (y >= 0)) && (x < n)) && (y < m));} int n ,m ; int[] dx = new int[]{-1,0,1,0,0}; int[] dy = new int[]{0,1,0,-1,0}; int step ; int numFree ; int cur ; int res ; int[][] f ; } class InputReader{ private BufferedReader reader ; private StringTokenizer stt ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); } public String nextLine(){ try{return reader.readLine().trim(); }catch (IOException e){ return null;} } public String nextString(){ while(((stt == null) || !stt.hasMoreTokens())){stt = new StringTokenizer(nextLine()); }return stt.nextToken();} public int nextInt(){ return Integer.parseInt(nextString());} }
5	public class MicroWorld{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int k = Integer.parseInt(st.nextToken());  int[] temp = new int[1000001];  StringTokenizer st1 = new StringTokenizer(br.readLine()); for ( int i = 0;(i < n);i++) {temp[Integer.parseInt(st1.nextToken())]++; } int b = (k + 1); for ( int i = 1000000;(i > 0);i--) {if ( (temp[i] > 0)) {if ( (b <= k)) {n -= temp[i]; } b = 1; } else {b++; }}System.out.println(n); } }
2	public class Main{ public static void main( String[] args){ Scanner scn = new Scanner(System.in);  long a ,b ; a = scn.nextLong(); b = scn.nextLong(); long diff = (b - a),tot = 0;  int ind = 0; while(true){ long res = (long)Math.pow(2.0,ind); if ( (res > b)) break; if ( (((a >> ind) != (b >> ind)) || (diff >= res))) tot += res; ind++; }System.out.println(tot); } }
0	public class Ideone{ public static void main( String[] args)throws java.lang.Exception { Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); if ( ((n % 2) == 0)) {System.out.println(((4 + " ") + (n - 4))); } else { int a = Math.min(9,(n - 9));  int b = Math.max(9,(n - 9)); System.out.println(((a + " ") + b)); }} }
2	public class A{ static private final int mod = ((int)1e9 + 9); final IOFast io = new IOFast(); long k ; boolean ok( long n, long m, long x){ long u = (k * x);  long val = u; val += (((m - u) / (k - 1)) * k); if ( (((m - u) % (k - 1)) == 0)) val -= 1; else val += ((m - u) % (k - 1)); return (val <= n);} long rec( long n, long m, long cur){ long pow = 1;  long p = 1000; for ( int i = 0;(i < p);i++) pow = ((pow * 2) % mod); while(true){if ( ok(n,m,0)) {return ((m + cur) % mod);} if ( !ok((n - (p * k)),(m - (p * k)),p)) {n -= (p * k); m -= (p * k); cur = ((cur * pow) % mod); cur += ((((pow - 1) * 2) * k) % mod); cur %= mod; continue;} n -= k; m -= k; cur += k; cur = ((cur * 2) % mod); }} public void run()throws IOException { long n = io.nextLong();  long m = io.nextLong(); k = io.nextLong(); io.out.println(rec(n,m,0)); if ( true) return ; long low = -1,high = ((m / k) + 1); while(((high - low) > 1)){ long mid = ((low + high) / 2); if ( !ok(n,m,mid)) {low = mid; } else {high = mid; }} long pow = powmod(2,high,mod);  long score = (m - (high * k)); score = ((score + (((pow - 1) * 2) * k)) % mod); io.out.println(score); } static long powmod( long n, long r, int m){ long res = 1; for ( ;(r != 0);r >>>= 1,n = ((n * n) % m)) {if ( ((r & 1) == 1)) {res = (res * n); if ( (res >= m)) {res %= m; } } }return res;} void main()throws IOException { try{run(); }catch (EndOfFileRuntimeException e){ } io.out.flush(); } public static void main( String[] args)throws IOException { new A().main(); } static class EndOfFileRuntimeException extends RuntimeException{ static private final long serialVersionUID = -8565341110209207657L; } public static class IOFast{ private BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); private PrintWriter out = new PrintWriter(System.out); static private int pos ,readLen ; static private final char[] buffer = new char[(1024 * 8)]; static private final char[] str = new char[((500000 * 8) * 2)]; static private boolean[] isDigit = new boolean[256]; static private boolean[] isSpace = new boolean[256]; static private boolean[] isLineSep = new boolean[256]; {for ( int i = 0;(i < 10);i++) {isDigit[('0' + i)] = true; }isDigit['-'] = true; isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true; isLineSep['\r'] = isLineSep['\n'] = true; }public int read()throws IOException { if ( (pos >= readLen)) {pos = 0; readLen = in.read(buffer); if ( (readLen <= 0)) {throw (new EndOfFileRuntimeException());} } return buffer[pos++];} public long nextLong()throws IOException { return Long.parseLong(nextString());} public char nextChar()throws IOException { while(true){final int c = read(); if ( !isSpace[c]) {return (char)c;} }} int reads( char[] cs, int len, boolean[] accept)throws IOException { try{while(true){final int c = read(); if ( accept[c]) {break;} str[len++] = (char)c; } }catch (EndOfFileRuntimeException e){ ;} return len;} public String nextString()throws IOException { return new String(next());} public char[] next()throws IOException { int len = 0; str[len++] = nextChar(); len = reads(str,len,isSpace); return Arrays.copyOf(str,len);} } }
1	public class b{ public static void main( String[] args){ FS in = new FS(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt();  Integer[] arr = new Integer[n];  int numZ = 0; for ( int i = 0;(i < n);i++) {arr[i] = in.nextInt(); if ( (arr[i] == 0)) numZ++; }Arrays.sort(arr); if ( (numZ > 1)) {System.out.println("cslnb"); return ;} int numDup = 0;  int[] arr2 = new int[n]; for ( int i = 0;(i < n);i++) {arr2[i] = arr[i]; if ( (i != 0)) {if ( (arr2[i] == arr2[(i - 1)])) {arr2[(i - 1)]--; numDup++; } } }if ( (numDup > 1)) {System.out.println("cslnb"); return ;} for ( int i = 0;(i < n);i++) {if ( (i != 0)) {if ( (arr2[i] == arr2[(i - 1)])) {System.out.println("cslnb"); return ;} } } long num = 0; if ( (numDup == 1)) num++; for ( int i = 0;(i < n);i++) {num += (arr2[i] - i); }if ( ((num % 2) == 0)) {System.out.println("cslnb"); } else {System.out.println("sjfnb"); }out.close(); } static class FS{ BufferedReader in ; StringTokenizer token ; public FS( InputStream str){ in = new BufferedReader(new InputStreamReader(str)); } public String next(){ if ( ((token == null) || !token.hasMoreElements())) {try{token = new StringTokenizer(in.readLine()); }catch (IOException ex){ } return next();} return token.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
6	public class Main{ static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static long mod = ((long)1e9 + 7); static long mod1 = 998244353; static boolean sieve[] ; static ArrayList<Integer> primes ; static long factorial[] ,invFactorial[] ; static ArrayList<Pair> graph[] ; static boolean oj = (System.getProperty("ONLINE_JUDGE") != null); static int n ,m ; static long cost[][] ,dp[] ; public static void main( String[] args)throws Exception { String st[] = nl(); n = pi(st[0]); m = pi(st[1]); st = nl(); String str = st[0];  int mn = 10000; for ( int i = 0;(i < n);i++) {mn = Math.min(mn,str.charAt(i)); }cost = new long[m][m]; for ( int i = 1;(i < n);i++) { int a1 = (str.charAt((i - 1)) - mn);  int a2 = (str.charAt(i) - mn); if ( (a1 == a2)) continue; cost[a1][a2]++; cost[a2][a1]++; } int mm = (1 << m); dp = new long[mm]; Arrays.fill(dp,(Long.MAX_VALUE / 2)); dp[0] = 0; long cntbit[] = new long[mm];  int minbit[] = new int[mm]; for ( int mask = 1;(mask < mm);mask++) {cntbit[mask] = (1 + cntbit[(mask & (mask - 1))]); for ( int i = 0;(i < m);i++) {if ( (((mask >> i) & 1) != 0)) {minbit[mask] = i; break;} }} long cntcost[][] = new long[mm][m]; for ( int mask = 0;(mask < mm);mask++) {for ( int i = 0;(i < m);i++) { int b = minbit[mask]; cntcost[mask][i] = (cntcost[(mask ^ (1 << b))][i] + cost[i][b]); }} int yy = (mm - 1); for ( int mask = 0;(mask < mm);mask++) { long cnt = cntbit[mask]; for ( int i = 0;(i < m);i++) {if ( (((mask >> i) & 1) != 0)) { long ans = (cnt * (cntcost[mask][i] - cntcost[(yy ^ mask)][i])); dp[mask] = Math.min(dp[mask],(dp[(mask ^ (1 << i))] + ans)); } }}out.println(dp[(mm - 1)]); out.flush(); out.close(); } static String[] nl()throws Exception { return br.readLine().split(" ");} static int pi( String str){ return Integer.parseInt(str);} static class Pair implements Comparable<Pair>{ int u ; int v ; int index = -1; public Pair( int u, int v){ this.u = u; this.v = v; } } }
2	public class E implements Runnable{ public static void main( String[] args){ new Thread(null,new E(),"_cf",(1 << 28)).start(); } long oo = (long)2e18; long getVal( int n){ if ( (n > 31)) return oo; long last = 0,cur = 0; for ( int i = 1;(i <= n);i++) {cur = (1 + (4 * last)); last = cur; }return cur;} class FastScanner{ public int BS = (1 << 16); public char NC = (char)0; byte[] buf = new byte[BS]; int bId = 0,size = 0; char c = NC; double num = 1; BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s)throws FileNotFoundException{ in = new BufferedInputStream(new FileInputStream(new File(s)),BS); } public char nextChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ num = 1; boolean neg = false; if ( (c == NC)) c = nextChar(); for ( ;((c < '0') || (c > '9'));c = nextChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = nextChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); num *= 10; }return (neg?-res:res);} } }
2	public class A{ static private Scanner in ; final int M = 1000000009; public void run(){ int n = in.nextInt();  int m = in.nextInt();  int k = in.nextInt();  int z = (n - m); if ( (z >= (n / k))) {System.out.println(m); return ;} int f = (n - (k * z));  int ans = BigInteger.ONE.shiftLeft(((f / k) + 1)).remainder(BigInteger.valueOf(M)).intValue(); System.out.println((((((ans + M) - 2L) * k) + ((f % k) + ((k - 1) * z))) % M)); } public static void main( String[] args){ Locale.setDefault(Locale.US); in = new Scanner(System.in); new A().run(); in.close(); } }
2	public class Main{ public static void main( String[] args){ FastReader input = new FastReader();  PrintWriter out = new PrintWriter(System.out);  int T = 1; while((T-- > 0)){ long k = input.nextLong();  long v = 9;  long s = 0;  int x = 1; while(true){if ( ((s + (v * x)) > k)) {break;} s += (v * x); v *= 10; x++; }if ( (s == k)) {out.println(9); } else { long d = (k - s);  long u = (d / x);  long rem = (d % x);  long nu = (long)Math.pow(10,(x - 1)); nu += u; if ( (rem == 0)) {nu--; out.println((nu % 10)); } else { String str = String.valueOf(nu); out.println(str.charAt((int)(rem - 1))); }}}out.close(); } static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} long nextLong(){ return Long.parseLong(next());} } }
0	public class LCMChallenge{ public static void main( String[] args){ Scanner cin = new Scanner(System.in);  int n = cin.nextInt(); if ( (n < 3)) {System.out.println(n); } else if ( ((n % 2) == 1)) {System.out.println((((long)n * (n - 1)) * (n - 2))); } else {if ( ((n % 3) != 0)) {System.out.println((((long)n * (n - 1)) * (n - 3))); } else {System.out.println((((long)(n - 1) * (n - 2)) * (n - 3))); }}} }
0	public class A{ private void processInput()throws IOException { Scanner in = new Scanner(System.in);  int n = in.nextInt();  long res = go(n); System.out.printf(Locale.ENGLISH,"%d\n",res); in.close(); } private long go( long n){ long res = ((3 * n) / 2); return res;} public static void main( String[] args)throws Exception { A a = new A(); a.processInput(); } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public static long MOD = 1000000009L; public long pow( long n, long p){ if ( (p == 0)) return 1L; if ( (p == 1)) return n; long ret = 1L; if ( ((p % 2L) != 0)) ret = n;  long tmp = pow(n,(p / 2L)); ret = ((ret * tmp) % MOD); ret = ((ret * tmp) % MOD); return ret;} public long func( long n, long k){ long times = (n / k);  long ret = (n - (times * k)); ret += (((((pow(2L,(times + 1L)) + MOD) - 2L) % MOD) * k) % MOD); return ret;} public void solve( int testNumber, InputReader in, OutputWriter out){ long n = in.readLong();  long m = in.readLong();  long k = in.readLong();  long wrong = (n - m);  long wow = (n / k);  long ans ; if ( (wrong >= wow)) ans = m; else ans = ((func((n - (wrong * k)),k) + (((k - 1L) * wrong) % MOD)) % MOD); out.printLine(ans); } } class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } public int read(){ if ( (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 long readLong(){ int c = read(); while(isSpaceChar(c))c = read(); int sgn = 1; if ( (c == '-')) {sgn = -1; c = read(); } long res = 0L; do {if ( ((c < '0') || (c > '9'))) throw (new InputMismatchException()); res *= 10; res += (c - '0'); c = read(); }while(!isSpaceChar(c));return (res * sgn);} public static boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void close(){ writer.close(); } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  Reader in = new Reader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  BDigitsSequenceHardEdition solver = new BDigitsSequenceHardEdition(); solver.solve(1,in,out); out.close(); } static class BDigitsSequenceHardEdition{ public void solve( int testNumber, Reader in, PrintWriter out){ long k = in.nextLong();  long start = 1;  long nDigit = 1; while(true){ long curr = ((start * 9) * nDigit); if ( (curr >= k)) break; start *= 10; nDigit += 1; k -= curr; }if ( ((k % nDigit) == 0)) {start += ((k / nDigit) - 1); out.println((start % 10)); } else { long n = (start + (k / nDigit));  int off = (int)(k % nDigit); out.println(Long.toString(n).charAt((off - 1))); }} } static class Reader{ private final int BUFFER_SIZE = (1 << 16); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ; private int bytesRead ; public Reader( InputStream in){ din = new DataInputStream(in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public Reader( String file_name){ try{din = new DataInputStream(new FileInputStream(file_name)); }catch (IOException e){ throw (new RuntimeException(e));} buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public long nextLong(){ 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;} private void fillBuffer(){ try{bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) {buffer[0] = -1; } }catch (IOException e){ throw (new RuntimeException(e));} } private byte read(){ if ( (bufferPointer == bytesRead)) {fillBuffer(); } return buffer[bufferPointer++];} } }
5	public class Main{ Scanner in ; static PrintWriter out ; static class Scanner{ StreamTokenizer in ; Scanner( InputStream is){ in = new StreamTokenizer(new BufferedReader(new InputStreamReader(is))); in.resetSyntax(); in.whitespaceChars(0,32); in.wordChars(33,255); } String readLine(){ try{in.nextToken(); asserT((in.ttype == StreamTokenizer.TT_WORD)); return in.sval; }catch (IOException e){ throw (new Error());} } int nextInt(){ return Integer.parseInt(readLine());} } void solve(){ int n = in.nextInt();  long k = in.nextInt();  int ar[] = new int[n];  TreeMap<Integer,Integer> nums = new TreeMap<Integer,Integer>(); for ( int i = 0;(i < n);i++) {ar[i] = in.nextInt(); nums.put(ar[i],i); }if ( (k == 1)) {out.println(n); return ;} int next[] = new int[n]; Arrays.fill(next,-1); int count = 0; for ( int i = 0;(i < n);i++) { long val = (ar[i] * k);  int intVal = (int)val; if ( (intVal == val)) {if ( nums.containsKey(intVal)) { int idx = nums.get(intVal); next[i] = idx; continue;} } if ( ((ar[i] % k) == 0)) {intVal = (ar[i] / (int)k); if ( nums.containsKey(intVal)) {continue;} } count++; }for ( int i = 0;(i < n);i++) { int curr = nums.pollFirstEntry().getValue();  boolean odd = false; while((next[curr] != -1)){if ( !odd) {count++; } int to = next[curr]; next[curr] = -1; curr = to; odd = !odd; if ( (next[curr] == -1)) {if ( !odd) {count++; } } }}out.println(count); } static void asserT( boolean e){ if ( !e) {throw (new Error());} } public void run(){ in = new Scanner(System.in); out = new PrintWriter(System.out); try{solve(); }finally{out.close(); }} public static void main( String[] args){ new Main().run(); } }
6	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ int BAD = 11111; int rows ; int cols ; HashMap<IntIntPair,Integer>[] mem ; boolean contains( int mem, int index){ if ( (index < 0)) return false; return (((mem >> index) & 1) == 1);} int add( int mem, int index){ if ( (((mem >> index) & 1) == 0)) {mem += (1 << index); } return mem;} int size( int mem){ int res = 0; while((mem > 0)){if ( ((mem % 2) == 1)) res++; mem /= 2; }return res;} void test(){ if ( (contains(5,0) == false)) throw (new RuntimeException()); if ( (contains(5,1) == true)) throw (new RuntimeException()); if ( (contains(5,-1) == true)) throw (new RuntimeException()); if ( (contains(5,2) == false)) throw (new RuntimeException()); if ( (contains(5,3) == true)) throw (new RuntimeException()); if ( (add(0,2) != 4)) throw (new RuntimeException()); if ( (add(4,0) != 5)) throw (new RuntimeException()); if ( (add(5,0) != 5)) throw (new RuntimeException()); if ( (size(5) != 2)) throw (new RuntimeException()); } int dp( int row, int remabove, int squareabove){ if ( (row == rows)) {if ( (remabove == 0)) return 0; return BAD;} if ( mem[row].containsKey(new IntIntPair(remabove,squareabove))) return mem[row].get(new IntIntPair(remabove,squareabove)); int res = BAD;  int possibilities = (1 << cols); for ( int poss = 0;(poss < possibilities);poss++) { int have = 0; for ( int j = 0;(j < cols);j++) if ( (((poss >> j) & 1) == 1)) {have += (1 << j); } boolean works = true; for ( int above = 0;(above < cols);above++) if ( (((remabove >> above) & 1) == 1)) {if ( (((have >> above) & 1) == 0)) {works = false; break;} } if ( works) { int remhere = 0; for ( int j = 0;(j < cols);j++) {if ( (((!contains(have,(j - 1)) && !contains(have,j)) && !contains(have,(j + 1))) && !contains(squareabove,j))) {remhere = add(remhere,j); } }res = Math.min(res,(size(have) + dp((row + 1),remhere,have))); } }mem[row].put(new IntIntPair(remabove,squareabove),res); return res;} public void solve( int testNumber, InputReader in, OutputWriter out){ test(); int n = in.readInt(),m = in.readInt(); cols = Math.min(n,m); rows = Math.max(n,m); mem = new HashMap[rows]; for ( int i = 0;(i < mem.length);i++) mem[i] = new HashMap<>(); int res = dp(0,0,0); out.printLine(((cols * rows) - res)); } } static class IntIntPair implements Comparable<IntIntPair>{ public final int first ; public final int second ; public IntIntPair( int first, int second){ this.first = first; this.second = second; } public int hashCode(){ int result = Integer.hashCode(first); result = ((31 * result) + Integer.hashCode(second)); return result;} } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private SpaceCharFilter filter ; 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 boolean isSpaceChar( int c){ if ( (filter != null)) return filter.isSpaceChar(c); return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void close(){ writer.close(); } public void printLine( int i){ writer.println(i); } } }
3	public class mainD{ public static PrintWriter out = new PrintWriter(System.out); public static FastScanner enter = new FastScanner(System.in); public static long[] arr ; public static void main( String[] args)throws IOException { int n = enter.nextInt();  int m = enter.nextInt();  long k = enter.nextLong(); arr = new long[(n + 1)]; for ( int i = 1;(i < (n + 1));i++) {arr[i] = enter.nextLong(); } long[] summ = new long[(n + 1)]; for ( int i = 1;(i < (n + 1));i++) {summ[i] += (arr[i] + summ[(i - 1)]); } long[] best = new long[(n + 1)]; for ( int i = 1;(i < (n + 1));i++) {best[i] = Math.max(0,(((i - m) >= 0)?(((best[(i - m)] + summ[i]) - summ[(i - m)]) - k):0)); } long ans = best[1]; for ( int i = 1;(i < (n + 1));i++) {ans = Math.max(ans,best[i]); for ( int j = 1;(j < m);j++) {ans = Math.max(ans,(((i - j) >= 0)?(((best[(i - j)] - k) + summ[i]) - summ[(i - j)]):0)); }}System.out.println(ans); } static class FastScanner{ BufferedReader br ; StringTokenizer stok ; FastScanner( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); } String next()throws IOException { while(((stok == null) || !stok.hasMoreTokens())){ String s = br.readLine(); if ( (s == null)) {return null;} stok = new StringTokenizer(s); }return stok.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} long nextLong()throws IOException { return Long.parseLong(next());} } }
4	public class Main{ static BufferedReader reader ; static StringTokenizer st ; static private void setReader(){ reader = new BufferedReader(new InputStreamReader(System.in)); } static private void updateST()throws IOException { if ( ((st == null) || !st.hasMoreElements())) st = new StringTokenizer(reader.readLine()); } static private int nextInt()throws IOException { updateST(); return Integer.parseInt(st.nextToken());} public static void main( String[] args)throws IOException { setReader(); int n = nextInt(),MOD = nextInt();  long[] pow = new long[(n + 2)]; pow[0] = 1; for ( int i = 1;(i <= (n + 1));i++) pow[i] = ((pow[(i - 1)] * 2) % MOD); long[][] C = new long[(n + 2)][(n + 2)]; for ( int i = 0;(i <= (n + 1));i++) {C[i][0] = 1; for ( int j = 1;(j <= i);j++) {C[i][j] = ((C[(i - 1)][(j - 1)] + C[(i - 1)][j]) % MOD); }} long[][] dp = new long[(n + 2)][(n + 1)]; dp[0][0] = 1; for ( int i = 0;(i <= n);i++) {for ( int j = 0;(j <= i);j++) {for ( int k = 1;(((i + k) + 1) <= (n + 1));k++) {dp[((i + k) + 1)][(j + k)] += ((((dp[i][j] * C[(j + k)][k]) % MOD) * pow[(k - 1)]) % MOD); dp[((i + k) + 1)][(j + k)] %= MOD; }}} long res = 0; for ( int i = 0;(i <= n);i++) res = ((res + dp[(n + 1)][i]) % MOD); System.out.println(res); } }
2	public class Solution{ static FastScanner fs = new FastScanner(); static PrintWriter out = new PrintWriter(System.out); static int n ,d ; public static void main( String[] args)throws IOException { int tt = 1; while((tt-- > 0)){n = fs.nextInt(); int l = 1,r = (1 + (n / 2)); d = getB(l); if ( ((d % 2) != 0)) {out.println("! -1"); out.flush(); return ;} if ( (d == 0)) {out.println("! 1"); out.flush(); return ;} while((l < r)){ int mid = ((l + r) / 2); if ( check(mid)) {l = (mid + 1); } else {r = mid; } int f = 1; }out.println(("! " + l)); }out.close(); } static boolean check( int i){ int k = getB(i); if ( (sig(d) == sig(k))) {return true;} return false;} static int getB( int i){ out.println(("? " + i)); out.flush(); int x1 = fs.nextInt();  int j = (i + (n / 2)); if ( (j > n)) j -= n; out.println(("? " + j)); out.flush(); int x2 = fs.nextInt(); return (x1 - x2);} static int sig( int x){ if ( (x > 0)) return 1; else if ( (x < 0)) return -1; return 0;} static final Random random = new Random(); static class FastScanner{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public String next(){ while(!st.hasMoreElements()){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} public int nextInt(){ return Integer.parseInt(next());} } }
4	public final class on_the_bench{ static BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); static FastScanner sc = new FastScanner(br); static PrintWriter out = new PrintWriter(System.out); static Random rnd = new Random(); static int[] parent ,size ; static int maxn = (int)500; static long mod = (long)(1e9 + 7); static int[] fact ,inv_fact ; static int getParent( int u){ if ( (u == parent[u])) {return u;} else { int val = getParent(parent[u]); parent[u] = val; return val;}} static void merge( int u, int v){ int x = getParent(u),y = getParent(v); if ( (x != y)) {parent[y] = x; size[x] += size[y]; size[y] = 0; } } static int add( long a, long b){ long ret = (a + b); if ( (ret >= mod)) {ret %= mod; } return (int)ret;} static int mul( long a, long b){ long ret = (a * b); if ( (ret >= mod)) {ret %= mod; } return (int)ret;} static int pow( long a, long b){ long x = 1,y = a; while((b > 0)){if ( ((b % 2) == 1)) {x = mul(x,y); } y = mul(y,y); b = (b / 2); }return (int)(x % mod);} static void build(){ fact = new int[maxn]; inv_fact = new int[maxn]; fact[0] = 1; for ( int i = 1;(i < maxn);i++) {fact[i] = mul(fact[(i - 1)],i); }inv_fact[(maxn - 1)] = pow(fact[(maxn - 1)],(mod - 2)); for ( int i = (maxn - 2);(i >= 0);i--) {inv_fact[i] = mul(inv_fact[(i + 1)],(i + 1)); }} static int[] mul_poly( int[] a, int[] b, int deg1, int deg2){ int[] ret = new int[((deg1 + deg2) + 1)]; for ( int i = 0;(i <= deg1);i++) {for ( int j = 0;(j <= deg2);j++) { int curr = mul(a[i],b[j]); ret[(i + j)] = add(ret[(i + j)],curr); }}return ret;} static int C( int n, int r){ if ( (((n - r) < 0) || (Math.min(n,r) < 0))) {return 0;} int val1 = fact[n],val2 = inv_fact[r],val3 = inv_fact[(n - r)];  int mul = mul(val2,val3); return mul(val1,mul);} public static void main( String[] args)throws Exception { int n = sc.nextInt(); build(); int[] a = new int[n]; parent = new int[n]; size = new int[n]; for ( int i = 0;(i < n);i++) {a[i] = sc.nextInt(); parent[i] = i; size[i] = 1; }for ( int i = 0;(i < n);i++) {for ( int j = (i + 1);(j < n);j++) { long curr = ((a[i] * 1L) * a[j]),now = (long)Math.sqrt(curr); if ( ((now * now) == curr)) {merge(i,j); } }} List<Integer> list = new ArrayList<>(); for ( int i = 0;(i < n);i++) {if ( (getParent(i) == i)) {list.add(size[i]); } } int res = 0;  int[] poly = new int[1]; poly[0] = 1; for ( int i = 0;(i < list.size());i++) { int size = list.get(i);  int[] arr = new int[size]; arr[0] = 1; for ( int j = 1;(j < size);j++) { int now1 = C(size,j),now2 = mul(fact[(size - 1)],inv_fact[((size - 1) - j)]);  int qq = mul(now1,now2); arr[j] = qq; }poly = mul_poly(poly,arr,(poly.length - 1),(size - 1)); }for ( int i = 1,x = 1;(i < poly.length);i++,x *= -1) { int now = add(x,mod);  int curr = mul(fact[(n - i)],poly[i]); curr = mul(curr,now); res = add(res,curr); } int zz = mul(res,(mod - 1)); res = add(fact[n],zz); out.println(res); out.close(); } } class FastScanner{ BufferedReader in ; StringTokenizer st ; public FastScanner( BufferedReader in){ this.in = in; } public String nextToken()throws Exception { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(in.readLine()); }return st.nextToken();} public int nextInt()throws Exception { return Integer.parseInt(nextToken());} }
5	public class Main{ public static void main( String[] args)throws NumberFormatException,IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine()," ");  int num = Integer.parseInt(st.nextToken());  int k = Integer.parseInt(st.nextToken()); st = new StringTokenizer(br.readLine()," "); if ( (k == 1)) System.out.println(num); else { Set<Integer> set = new TreeSet<Integer>();  Set<Integer> bad = new TreeSet<Integer>();  int sel ;  int[] arr = new int[num]; for ( int i = 0;(i < num);i++) {arr[i] = Integer.parseInt(st.nextToken()); }shuffle(arr); Arrays.sort(arr); for ( int i = 0;(i < num);i++) {sel = arr[i]; if ( ((sel % k) != 0)) {set.add(sel); bad.add((sel * k)); } if ( (!bad.contains(sel) && !set.contains((sel / k)))) {bad.add((sel * k)); set.add(sel); } }System.out.println(set.size()); }} public static void shuffle( int[] arr){ Random rand = new Random(); for ( int i = (arr.length - 1);(i >= 0);--i) { int pos = rand.nextInt((i + 1));  int aux = arr[i]; arr[i] = arr[pos]; arr[pos] = aux; }} }
2	public class BDigitSequence{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  long k = scan.nextLong();  long digits = 1;  long counter = 9L; while((k > (counter * digits))){k -= (counter * digits); counter *= 10; digits++; } long num = (long)Math.ceil(((double)k / digits));  String s = String.valueOf((((long)Math.pow(10,(digits - 1)) - 1) + num)); System.out.println(s.charAt((int)(((k + digits) - 1) % digits))); } }
2	public class Template implements Runnable{ BufferedReader in ; PrintWriter out ; StringTokenizer tok = new StringTokenizer(""); void init()throws FileNotFoundException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); } String readString()throws IOException { while(!tok.hasMoreTokens()){try{tok = new StringTokenizer(in.readLine()," :"); }catch (Exception e){ return null;} }return tok.nextToken();} int readInt()throws IOException { return Integer.parseInt(readString());} public static void main( String[] args){ new Thread(null,new Template(),"",(((1l * 200) * 1024) * 1024)).start(); } long timeBegin ,timeEnd ; void time(){ timeEnd = System.currentTimeMillis(); System.err.println(("Time = " + (timeEnd - timeBegin))); } long memoryTotal ,memoryFree ; void memory(){ memoryFree = Runtime.getRuntime().freeMemory(); System.err.println((("Memory = " + ((memoryTotal - memoryFree) >> 10)) + " KB")); } int fx = -1; int sx = -1; int fy = -1; int sy = -1; int query( int x1, int y1, int x2, int y2)throws IOException { out.println(((((((("? " + x1) + " ") + y1) + " ") + x2) + " ") + y2)); out.flush(); int res = readInt(); if ( ((((fx >= x1) && (sx <= x2)) && (fy >= y1)) && (sy <= y2))) res--; return res;} int[] bs( int n)throws IOException { int l = 1;  int r = n;  int lx = 0,rx = 0,ly = 0,ry = 0; while((l <= r)){ int mid = ((l + r) >> 1); if ( (query(1,1,mid,n) > 0)) {rx = mid; r = (mid - 1); } else {l = (mid + 1); }}l = 1; r = rx; while((l <= r)){ int mid = ((l + r) >> 1); if ( (query(mid,1,rx,n) > 0)) {lx = mid; l = (mid + 1); } else {r = (mid - 1); }}l = 1; r = n; while((l <= r)){ int mid = ((l + r) >> 1); if ( (query(lx,mid,rx,n) > 0)) {ly = mid; l = (mid + 1); } else {r = (mid - 1); }}l = ly; r = n; while((l <= r)){ int mid = ((l + r) >> 1); if ( (query(lx,ly,rx,mid) > 0)) {ry = mid; r = (mid - 1); } else {l = (mid + 1); }}fx = lx; sx = rx; fy = ly; sy = ry; return new int[]{lx,ly,rx,ry};} void solve()throws IOException { int n = readInt();  int[] a = bs(n);  int[] b = bs(n); out.print("! "); for ( int i :a) out.print((i + " ")); for ( int i :b) out.print((i + " ")); } }
4	public class Main{ static private final String NO = "NO"; static private final String YES = "YES"; InputStream is ; PrintWriter out ; String INPUT = ""; static private long MOD = 1000000007; static private final int MAXN = 100000; void solve(){ int T = 1; for ( int i = 0;(i < T);i++) {solve(i); }} static final int N = 405; static long[][] dp = new long[N][N]; static long[] p2 = new long[N]; static long[] fac = new long[N]; static long[] ifac = new long[N]; public static long bino( int n, int k){ return ((((fac[n] * ifac[(n - k)]) % MOD) * ifac[k]) % MOD);} void solve( int T){ int n = ni(); MOD = nl(); fac[0] = 1; ifac[0] = 1; p2[0] = 1; for ( int i = 1;(i <= n);++i) {fac[i] = ((fac[(i - 1)] * i) % MOD); p2[i] = ((p2[(i - 1)] * 2) % MOD); }ifac[n] = power(fac[n],(MOD - 2)); for ( int i = (n - 1);(i > 0);--i) {ifac[i] = ((ifac[(i + 1)] * (i + 1)) % MOD); }dp[0][0] = 1; for ( int i = 0;(i <= n);++i) {for ( int j = 0;(j <= i);++j) {for ( int k = 1;((i + k) <= n);++k) {dp[((i + k) + 1)][(j + k)] = ((dp[((i + k) + 1)][(j + k)] + ((((dp[i][j] * p2[(k - 1)]) % MOD) * bino((k + j),k)) % MOD)) % MOD); }}} long ans = 0; for ( int i = 0;(i <= n);++i) {ans = ((ans + dp[(n + 1)][i]) % MOD); }out.println(ans); } long power( long a, long b){ long x = 1,y = a; while((b > 0)){if ( ((b % 2) != 0)) {x = ((x * y) % MOD); } y = ((y * y) % MOD); b /= 2; }return (x % MOD);} void run()throws Exception { is = (INPUT.isEmpty()?System.in:new ByteArrayInputStream(INPUT.getBytes())); out = new PrintWriter(System.out); long s = System.currentTimeMillis(); solve(); out.flush(); if ( !INPUT.isEmpty()) tr(((System.currentTimeMillis() - s) + "ms")); } public static void main( String[] args)throws Exception { new Main().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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)){if ( !isSpaceChar(b)) buf[p++] = (char)b; b = readByte(); }return ((n == p)?buf:Arrays.copyOf(buf,p));} private int[] na( int n){ int[] a = new int[n]; for ( int i = 0;(i < n);i++) a[i] = ni(); return a;} private int[][] na( int n, int m){ int[][] a = new int[n][]; for ( int i = 0;(i < n);i++) a[i] = na(m); 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( int n){ long[] a = new long[n]; for ( int i = 0;(i < n);i++) a[i] = nl(); return a;} private long[][] nl( int n, int m){ long[][] a = new long[n][]; for ( int i = 0;(i < n);i++) a[i] = nl(m); return a;} 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(); }} static private void tr( Object... o){ System.out.println(Arrays.deepToString(o)); } }
0	public class Task235A{ public static void main( String... args)throws NumberFormatException,IOException { Solution.main(System.in,System.out); } static class Scanner{ private final BufferedReader br ; private String[] cache ; private int cacheIndex ; Scanner( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); cache = new String[0]; cacheIndex = 0; } int nextInt()throws IOException { if ( (cacheIndex >= cache.length)) {cache = br.readLine().split(" "); cacheIndex = 0; } return Integer.parseInt(cache[cacheIndex++]);} void close()throws IOException { br.close(); } } static class Solution{ public static void main( InputStream is, OutputStream os)throws NumberFormatException,IOException { PrintWriter pw = new PrintWriter(os);  Scanner sc = new Scanner(is);  long n = sc.nextInt(); if ( (n < 3)) {pw.println(n); } else {if ( ((n % 2) != 0)) {pw.println(((n * (n - 1)) * (n - 2))); } else {if ( ((n % 3) != 0)) {pw.println(((n * (n - 1)) * (n - 3))); } else { long cand1 = (((n * (n - 1)) * (n - 2)) / 2);  long cand2 = (((n - 1) * (n - 2)) * (n - 3)); pw.println(Math.max(cand1,cand2)); }}}pw.flush(); sc.close(); } } }
2	public class Main3{ public static void main( String[] args){ Scanner s = new Scanner(System.in);  long l = s.nextLong();  long r = s.nextLong();  String a = Long.toBinaryString(l);  String b = Long.toBinaryString(r); while((a.length() < b.length()))a = ("0" + a); while((b.length() < a.length()))b = ("0" + b); String ans = "";  int ix = -1; for ( int i = 0;(i < a.length());i++) {if ( (a.charAt(i) != b.charAt(i))) {break;} ans += a.charAt(i); ix++; }for ( int i = (ix + 1);(i < a.length());i++) { int c1 = (a.charAt(i) - '0');  int c2 = (b.charAt(i) - '0'); if ( ((c1 == 0) && (c2 == 0))) ans += "1"; else if ( ((c1 == 1) && (c2 == 1))) ans += "0"; else ans += (char)(c1 + '0'); } long a1 = Long.parseLong(ans,2);  long a2 = Long.parseLong(b,2);  long xor = (a1 ^ a2); System.out.println(xor); } }
6	public class E{ public static void main( String[] args){ FastScanner scanner = new FastScanner();  PrintWriter out = new PrintWriter(System.out,false);  int t = scanner.nextInt(); while((t-- > 0)){ int n = scanner.nextInt();  int m = scanner.nextInt();  Col[] cols = new Col[m];  int[][] mat = new int[m][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < m);j++) {mat[j][i] = scanner.nextInt(); }}for ( int i = 0;(i < m);i++) {cols[i] = new Col(mat[i]); }Arrays.sort(cols); int maxMask = (1 << n);  int[] dp = new int[maxMask]; Arrays.fill(dp,-1); dp[0] = 0; int sz = Math.min(n,m);  int[][] ss = new int[sz][maxMask]; for ( int i = 0;(i < sz);i++) { int[] curArr = cols[i].arr.clone(); for ( int j = 0;(j < n);j++) {for ( int mask = 0;(mask < maxMask);mask++) { int cur = 0; for ( int k = 0;(k < n);k++) if ( (((1 << k) & mask) > 0)) cur += curArr[k]; ss[i][mask] = Math.max(ss[i][mask],cur); }curArr = shift(curArr); }}for ( int i = 0;(i < Math.min(n,m));i++) {for ( int mask = (maxMask - 1);(mask >= 0);mask--) {for ( int smask = mask;(smask >= 0);smask = ((smask - 1) & mask)) {if ( (dp[smask] == -1)) continue; dp[mask] = Math.max(dp[mask],(dp[smask] + ss[i][(mask ^ smask)])); if ( (smask == 0)) break; }}}out.println(dp[(maxMask - 1)]); }out.flush(); } static int[] shift( int[] a){ int[] b = new int[a.length]; b[0] = a[(a.length - 1)]; for ( int i = 0;(i < (a.length - 1));i++) {b[(i + 1)] = a[i]; }return b;} static class Col implements Comparable<Col>{ int[] arr ; int[] sorted ; public Col( int[] a){ arr = a; sorted = arr.clone(); Arrays.sort(sorted); } } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( Reader in){ br = new BufferedReader(in); } public FastScanner(){ this(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
0	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  ABirthday solver = new ABirthday(); solver.solve(1,in,out); out.close(); } static class ABirthday{ public void solve( int testNumber, InputReader in, OutputWriter out){ long N = in.readLong(),M = in.readLong(),K = in.readLong(),L = in.readLong();  long ans = ((((L + K) - 1) / M) + 1); if ( (((ans * M) > N) || (((ans * M) - K) < L))) out.printLine(-1); else out.printLine(ans); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void close(){ writer.close(); } public void printLine( long i){ writer.println(i); } public void printLine( int i){ writer.println(i); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputReader.SpaceCharFilter filter ; 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 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 boolean isSpaceChar( int c){ if ( (filter != null)) {return filter.isSpaceChar(c);} return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } }
6	public class Task16e{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  double[][] prob = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {prob[i][j] = sc.nextDouble(); }} double[] var = new double[(1 << n)];  boolean[] was = new boolean[(1 << n)]; Arrays.fill(var,0.0); Arrays.fill(was,false); was[0] = true; var[((1 << n) - 1)] = 1.0; Set<Integer> cr = new HashSet<Integer>();  Set<Integer> nx = new HashSet<Integer>(); nx.add(((1 << n) - 1)); boolean[] fish = new boolean[n]; for ( int cnt = 0;(cnt < (n - 1));cnt++) {cr.clear(); cr.addAll(nx); nx.clear(); for ( Iterator<Integer> iterator = cr.iterator();iterator.hasNext();) { int curr = iterator.next(); for ( int i = 0;(i < n);i++) {fish[i] = (((1 << i) & curr) != 0); } int fishn = 0; for ( int i = 0;(i < n);i++) {if ( fish[i]) fishn++; }if ( (fishn == 1)) continue; for ( int i = 0;(i < n);i++) {if ( !fish[i]) continue; for ( int j = (i + 1);(j < n);j++) {if ( !fish[j]) continue; int woi = (curr & (1 << i));  int woj = (curr & (1 << j)); var[woi] += (var[curr] * prob[j][i]); var[woj] += (var[curr] * prob[i][j]); nx.add(woi); nx.add(woj); }}}} double sum = 0.0; for ( int i = 0;(i < n);i++) {sum += var[(1 << i)]; }for ( int i = 0;(i < n);i++) {System.out.printf("%.6f ",(var[(1 << i)] / sum)); }} }
0	public class test{ public static void main( String[] args){ Scanner input = new Scanner(System.in);  String num = input.nextLine(); System.out.println("25"); } }
0	public class solution{ static long gcd( long a, long b){ if ( (b == 0)) return a; else return gcd(b,(a % b));} public static void main( String[] args){ Scanner in = new Scanner(System.in);  long n = in.nextLong();  long m1 = 0,m2 = 0; if ( (n < 3)) m1 = n; else {if ( ((n & 1) == 1)) { long lcm = ((n * (n - 1)) / gcd(n,(n - 1))); m1 = ((lcm * (n - 2)) / gcd(lcm,(n - 2))); } else { long lcm = (((n - 1) * (n - 2)) / gcd((n - 1),(n - 2))); m1 = ((lcm * (n - 3)) / gcd(lcm,(n - 3))); lcm = ((n * (n - 1)) / gcd(n,(n - 1))); m2 = ((lcm * (n - 3)) / gcd(lcm,(n - 3))); m1 = Math.max(m1,m2); }}System.out.println(m1); } }
3	public class Main{ private FastScanner in ; private PrintWriter out ; private void solve()throws IOException { solveC(); } int n ,m ,cl ; char a[][] ; int[] b ; int fromi ,fromj ,toi ,toj ; private boolean bfs( long[] str){ int[][] steps = {{(((int)str[0] / 10) - 1),(((int)str[0] % 10) - 1)},{(((int)str[1] / 10) - 1),(((int)str[1] % 10) - 1)},{(((int)str[2] / 10) - 1),(((int)str[2] % 10) - 1)},{(((int)str[3] / 10) - 1),(((int)str[3] % 10) - 1)}}; for ( int i = 0,ci = fromi,cj = fromj;(i < cl);i++) {ci += steps[b[i]][0]; cj += steps[b[i]][1]; if ( (((((ci >= n) || (ci < 0)) || (cj >= m)) || (cj < 0)) || (a[ci][cj] == '#'))) return false; if ( (a[ci][cj] == 'E')) return true; }return false;} private void solveC()throws IOException { int n = in.nextInt();  int r = in.nextInt();  int[] x = new int[n]; for ( int i = 0;(i < n);i++) {x[i] = in.nextInt(); } double[] y = new double[n]; for ( int i = 0;(i < n);i++) {y[i] = r; for ( int j = 0;(j < i);j++) {if ( (abs((x[i] - x[j])) <= (2 * r))) {y[i] = max(y[i],(y[j] + sqrt((((4.0 * r) * r) - ((x[i] - x[j]) * (x[i] - x[j])))))); } }}for ( double ty :y) out.print((ty + " ")); out.println(); } class FastScanner{ StringTokenizer st ; BufferedReader br ; FastScanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} String nextLine()throws IOException { return br.readLine();} } private void run()throws IOException { in = new FastScanner(System.in); out = new PrintWriter(System.out); solve(); out.flush(); out.close(); } public static void main( String[] args)throws IOException { new Main().run(); } }
4	public class Main{ public static class Task{ public class MinCostFlowBF{ List<Edge>[] graph ; class Edge{ int to ,f ,cap ,cost ,rev ; Edge( int v, int cap, int cost, int rev){ this.to = v; this.cap = cap; this.cost = cost; this.rev = rev; } } public MinCostFlowBF( int n){ graph = new List[n]; for ( int i = 0;(i < n);i++) graph[i] = new ArrayList<Edge>(); } public void addEdge( int s, int t, int cap, int cost){ graph[s].add(new Edge(t,cap,cost,graph[t].size())); graph[t].add(new Edge(s,0,-cost,(graph[s].size() - 1))); } void bellmanFord( int s, int[] dist, int[] prevnode, int[] prevedge, int[] curflow){ int n = graph.length; Arrays.fill(dist,0,n,Integer.MAX_VALUE); dist[s] = 0; curflow[s] = Integer.MAX_VALUE; boolean[] inqueue = new boolean[n];  int[] q = new int[n];  int qt = 0; q[qt++] = s; for ( int qh = 0;(((qh - qt) % n) != 0);qh++) { int u = q[(qh % n)]; inqueue[u] = false; for ( int i = 0;(i < graph[u].size());i++) { Edge e = graph[u].get(i); if ( (e.f >= e.cap)) continue; int v = e.to;  int ndist = (dist[u] + e.cost); if ( (dist[v] > ndist)) {dist[v] = ndist; prevnode[v] = u; prevedge[v] = i; curflow[v] = Math.min(curflow[u],(e.cap - e.f)); if ( !inqueue[v]) {inqueue[v] = true; q[(qt++ % n)] = v; } } }}} public int[] minCostFlow( int s, int t, int maxf){ int n = graph.length;  int[] dist = new int[n];  int[] curflow = new int[n];  int[] prevedge = new int[n];  int[] prevnode = new int[n];  int flow = 0;  int flowCost = 0; while((flow < maxf)){bellmanFord(s,dist,prevnode,prevedge,curflow); if ( (dist[t] == Integer.MAX_VALUE)) break; int df = Math.min(curflow[t],(maxf - flow)); flow += df; for ( int v = t;(v != s);v = prevnode[v]) { Edge e = graph[prevnode[v]].get(prevedge[v]); e.f += df; graph[v].get(e.rev).f -= df; flowCost += (df * e.cost); }}return new int[]{flow,flowCost};} } public void solve( Scanner sc, PrintWriter pw)throws IOException { int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] pos = new int[n]; for ( int i = 0;(i < k);i++) {pos[(sc.nextInt() - 1)]++; } int T = 100;  MinCostFlowBF mf = new MinCostFlowBF((((T + 1) * n) + 2)); for ( int i = 0;(i < n);i++) {if ( (pos[i] > 0)) mf.addEdge(0,(i + 1),pos[i],0); }for ( int i = 0;(i < T);i++) {for ( int j = 0;(j < n);j++) {mf.addEdge(((1 + (i * n)) + j),((1 + ((i + 1) * n)) + j),k,0); }}for ( int i = 0;(i <= T);i++) {for ( int j = 1;(j <= k);j++) {mf.addEdge((1 + (i * n)),(((T + 1) * n) + 1),1,(c * i)); }}for ( int i = 0;(i < m);i++) { int a = (sc.nextInt() - 1);  int b = (sc.nextInt() - 1); for ( int j = 0;(j < T);j++) { int cost = 0; for ( int l = 1;(l <= k);l++) {mf.addEdge(((1 + (j * n)) + a),((1 + ((j + 1) * n)) + b),1,(((l * l) * d) - cost)); mf.addEdge(((1 + (j * n)) + b),((1 + ((j + 1) * n)) + a),1,(((l * l) * d) - cost)); cost = ((l * l) * d); }}} int[] flowAndCost = mf.minCostFlow(0,(((T + 1) * n) + 1),k); System.err.println(flowAndCost[0]); pw.println(flowAndCost[1]); } } static long TIME_START ,TIME_END ; public static void main( String[] args)throws IOException { Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(new BufferedOutputStream(System.out));  Runtime runtime = Runtime.getRuntime();  long usedMemoryBefore = (runtime.totalMemory() - runtime.freeMemory()); TIME_START = System.currentTimeMillis(); Task t = new Task(); t.solve(sc,pw); TIME_END = System.currentTimeMillis(); long usedMemoryAfter = (runtime.totalMemory() - runtime.freeMemory()); pw.close(); System.err.println(("Memory increased: " + ((usedMemoryAfter - usedMemoryBefore) / 1000000))); System.err.println((("Time used: " + (TIME_END - TIME_START)) + ".")); } static class Scanner{ StringTokenizer st ; BufferedReader br ; public Scanner( InputStream s){ br = new BufferedReader(new InputStreamReader(s)); } public Scanner( FileReader s)throws FileNotFoundException{ br = new BufferedReader(s); } public String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} public int nextInt()throws IOException { return Integer.parseInt(next());} public boolean ready()throws IOException { return br.ready();} } }
0	public class Main{ static private void solve()throws IOException { long n = nextLong(); out.println(25); } public static void main( String[] args)throws Exception { File file = new File("System.in");  InputStream input = System.in;  PrintStream output = System.out; if ( (file.exists() && file.canRead())) {input = new FileInputStream(file); output = new PrintStream("System.out"); } br = new BufferedReader(new InputStreamReader(input)); out = new PrintWriter(output); solve(); out.close(); } static private BufferedReader br ; static private StringTokenizer st ; static private PrintWriter out ; static private boolean hasNextToken()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String line = br.readLine(); if ( (line == null)) {return false;} st = new StringTokenizer(line); }return true;} static private String nextToken()throws IOException { return (hasNextToken()?st.nextToken():null);} static private long nextLong()throws IOException { return Long.parseLong(nextToken());} }
6	public class cf112e{ static int n ,m ,s ; static int[][][] memo ; public static void main( String[] args){ Scanner in = new Scanner(System.in); n = in.nextInt(); m = in.nextInt(); if ( (n > m)) { int tmp = n; n = m; m = tmp; } s = (1 << n); memo = new int[s][s][m]; for ( int i = 0;(i < s);i++) for ( int j = 0;(j < s);j++) Arrays.fill(memo[i][j],-1); int ret = go(0,0,0); System.out.println(((n * m) - ret)); } static int go( int last, int trans, int r){ if ( (r == m)) {if ( (trans == 0)) return 0; return 100;} if ( (memo[last][trans][r] != -1)) return memo[last][trans][r]; int best = 100; for ( int crnt = 0;(crnt < s);crnt++) {if ( ((trans & ~crnt) != 0)) continue; for ( int pass = 0;(pass < s);pass++) { int tmp = (((1 << n) - 1) & ~last); if ( ((pass & ~tmp) != 0)) continue; tmp = (tmp & ~pass); boolean fail = false; for ( int k = 0;(k < n);k++) if ( (isSet(tmp,k) && ((isSet(crnt,(k - 1)) || isSet(crnt,k)) || isSet(crnt,(k + 1))))) fail = true; if ( fail) continue; best = Math.min(best,(Integer.bitCount(crnt) + go(crnt,pass,(r + 1)))); }}return memo[last][trans][r] = best;} static boolean isSet( int x, int p){ if ( ((p < 0) || (p >= n))) return false; return ((x & (1 << p)) != 0);} }
0	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);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt(); if ( ((n % 2) == 0)) {out.println(((4 + " ") + (n - 4))); } else {out.println(((9 + " ") + (n - 9))); }} } class InputReader{ private final BufferedReader reader ; private StringTokenizer tokenizer ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); tokenizer = null; } public String nextLine(){ try{return reader.readLine(); }catch (IOException e){ throw (new RuntimeException(e));} } public String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(nextLine()); }return tokenizer.nextToken();} public int nextInt(){ return Integer.parseInt(next());} }
6	public class SpidersSolver{ public static final boolean DEBUG = false; public static void main( String[] args){ if ( DEBUG) {try{System.setIn(new FileInputStream("input.txt")); }catch (IOException e){ } } Scanner sc = new Scanner(System.in);  int n = sc.nextInt(),m = sc.nextInt(); if ( (n < m)) { int tmp = n; n = m; m = tmp; } int pow = 1; for ( int i = 0;(i < m);i++) pow *= 2; int[] count = new int[pow]; for ( int cur = 0;(cur < pow);cur++) { int x = cur; while((x > 0)){count[cur] += (x % 2); x /= 2; }count[cur] = (m - count[cur]); } int[][] C = new int[pow][pow]; for ( int cur = 0;(cur < pow);cur++) {C[0][cur] = 0; for ( int last = 1;(last < pow);last++) C[last][cur] = Integer.MIN_VALUE; }for ( int i = 0;(i < n);i++) { int[][] newC = new int[pow][pow]; for ( int cur = 0;(cur < pow);cur++) for ( int next = 0;(next < pow);next++) { int mask = (((cur | (cur << 1)) | (cur >> 1)) | next); mask %= pow; int max = 0; for ( int last = 0;(last < pow);last++) if ( (((last | mask) == (pow - 1)) && (max < (count[cur] + C[last][cur])))) max = (count[cur] + C[last][cur]); newC[cur][next] = max; }C = newC; } int result = 0; for ( int cur = 0;(cur < pow);cur++) result = Math.max(result,C[cur][0]); System.out.println(result); } }
3	public class NewYearsCurling{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  PrintWriter pw = new PrintWriter(System.out);  StringTokenizer st = new StringTokenizer(sc.nextLine());  int n = Integer.parseInt(st.nextToken());  int r = Integer.parseInt(st.nextToken());  ArrayList<Integer> centers = new ArrayList<Integer>(); st = new StringTokenizer(sc.nextLine()); for ( int i = 0;(i < n);i++) {centers.add(Integer.parseInt(st.nextToken())); }sc.close(); ArrayList<Point> finalpoints = new ArrayList<Point>(); for ( int i = 0;(i < n);i++) { double maxy = r; for ( int j = 0;(j < finalpoints.size());j++) {if ( (((finalpoints.get(j).x - centers.get(i)) > (2 * r)) || ((centers.get(i) - finalpoints.get(j).x) > (2 * r)))) continue; double dist = (Math.sqrt((((4 * r) * r) - ((finalpoints.get(j).x - centers.get(i)) * (finalpoints.get(j).x - centers.get(i))))) + finalpoints.get(j).y); if ( (dist > maxy)) maxy = dist; }pw.print((maxy + " ")); finalpoints.add(new Point(centers.get(i),maxy)); }pw.close(); } public static class Point{ double x ; double y ; public Point( double x, double y){ this.x = x; this.y = y; } } }
4	public class GG{ public static void main( String[] args){ FastScanner scanner = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int N = scanner.nextInt();  int M = scanner.nextInt();  int K = scanner.nextInt();  int C = scanner.nextInt();  int D = scanner.nextInt();  MinCostMaxFlowSolver solver = new EdmondsKarp();  int[] people = new int[K]; for ( int i = 0;(i < K);i++) people[i] = (scanner.nextInt() - 1); Node src = solver.addNode();  Node snk = solver.addNode();  int amt = 350;  Node[][] timeNodes = new Node[N][amt]; for ( int i = 0;(i < N);i++) {for ( int j = 1;(j < amt);j++) {timeNodes[i][j] = solver.addNode(); if ( (j > 1)) solver.link(timeNodes[i][(j - 1)],timeNodes[i][j],Integer.MAX_VALUE,0); }}for ( int i = 0;(i < K);i++) {solver.link(src,timeNodes[people[i]][1],1,0); }for ( int i = 1;(i < amt);i++) {for ( int j = 0;(j < K);j++) {solver.link(timeNodes[0][i],snk,1,((C * i) - C)); }}for ( int i = 0;(i < M);i++) { int a = (scanner.nextInt() - 1);  int b = (scanner.nextInt() - 1); for ( int j = 1;(j < (amt - 1));j++) { int prev = 0; for ( int k = 1;(k <= K);k++) {solver.link(timeNodes[a][j],timeNodes[b][(j + 1)],1,(((D * k) * k) - prev)); solver.link(timeNodes[b][j],timeNodes[a][(j + 1)],1,(((D * k) * k) - prev)); prev = ((D * k) * k); }}} long[] ret = solver.getMinCostMaxFlow(src,snk); out.println(ret[1]); out.flush(); } public static class Node{ private Node(){ } List<Edge> edges = new ArrayList<Edge>(); int index ; } public static class Edge{ boolean forward ; Node from ,to ; long flow ; final long capacity ; Edge dual ; long cost ; protected Edge( Node s, Node d, long c, boolean f){ forward = f; from = s; to = d; capacity = c; } void addFlow( long amount){ flow += amount; dual.flow -= amount; } } static class EdmondsKarp extends MinCostMaxFlowSolver{ EdmondsKarp(){ this(0); } EdmondsKarp( int n){ super(n); } long minCost ; @Override public long[] getMinCostMaxFlow( Node src, Node snk){ long maxflow = getMaxFlow(src,snk); return new long[]{maxflow,minCost};} static final long INF = (Long.MAX_VALUE / 4); @Override public long getMaxFlow( Node src, Node snk){ final int n = nodes.size(); final int source = src.index; final int sink = snk.index;  long flow = 0;  long cost = 0;  long[] potential = new long[n]; while(true){ Edge[] parent = new Edge[n];  long[] dist = new long[n]; Arrays.fill(dist,INF); dist[source] = 0; PriorityQueue<Item> que = new PriorityQueue<Item>(); que.add(new Item(0,source)); while(!que.isEmpty()){ Item item = que.poll(); if ( (item.dist != dist[item.v])) continue; for ( Edge e :nodes.get(item.v).edges) { long temp = (((dist[item.v] + e.cost) + potential[item.v]) - potential[e.to.index]); if ( ((e.capacity > e.flow) && (dist[e.to.index] > temp))) {dist[e.to.index] = temp; parent[e.to.index] = e; que.add(new Item(temp,e.to.index)); } }}if ( (parent[sink] == null)) break; for ( int i = 0;(i < n);i++) if ( (parent[i] != null)) potential[i] += dist[i];  long augFlow = Long.MAX_VALUE; for ( int i = sink;(i != source);i = parent[i].from.index) augFlow = Math.min(augFlow,(parent[i].capacity - parent[i].flow)); for ( int i = sink;(i != source);i = parent[i].from.index) { Edge e = parent[i]; e.addFlow(augFlow); cost += (augFlow * e.cost); }flow += augFlow; }minCost = cost; return flow;} static class Item implements Comparable<Item>{ long dist ; int v ; public Item( long dist, int v){ this.dist = dist; this.v = v; } } } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( Reader in){ br = new BufferedReader(in); } public FastScanner(){ this(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,dd ,bb ; int[] uu ,vv ,uv ,cost ,cost_ ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; dd = new int[n_]; bb = new int[n_]; uu = new int[m_]; vv = new int[m_]; uv = new int[m_]; cost = new int[m_]; cost_ = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; uv[h] = (u ^ v); cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } boolean dijkstra( int s, int t){ Arrays.fill(pi,INF); pi[s] = 0; TreeSet<Integer> pq = new TreeSet<>((u,v)->((pi[u] != pi[v])?(pi[u] - pi[v]):((dd[u] != dd[v])?(dd[u] - dd[v]):(u - v)))); pq.add(s); Integer first ; while(((first = pq.pollFirst()) != null)){ int u = first;  int d = (dd[u] + 1);  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost_[h]:-cost_[h]));  int v = (u ^ uv[h]); if ( ((pi[v] > p) || ((pi[v] == p) && (dd[v] > d)))) {if ( (pi[v] != INF)) pq.remove(v); pi[v] = p; dd[v] = d; bb[v] = h_; pq.add(v); } } }return (pi[t] != INF);} void push1( int s, int t){ for ( int u = t,h_ ,h ;(u != s);u ^= uv[h]) {h = ((h_ = bb[u]) >> 1); cc[h_]--; cc[(h_ ^ 1)]++; }} int edmonds_karp( int s, int t){ cost_ = Arrays.copyOf(cost,m_); while(dijkstra(s,t)){push1(s,t); for ( int h = 0;(h < m_);h++) { int u = uu[h],v = vv[h]; if ( ((pi[u] != INF) && (pi[v] != INF))) cost_[h] += (pi[u] - pi[v]); }} int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
3	public class C{ public static void main( String[] args){ Scanner scan = new Scanner(System.in);  int n ,r ; n = scan.nextInt(); r = scan.nextInt(); int[] locs = new int[n]; for ( int i = 0;(i < n);i++) {locs[i] = scan.nextInt(); } double[] yPos = new double[n]; Arrays.fill(yPos,10e100); yPos[0] = r; for ( int i = 1;(i < n);i++) { double pos = r; for ( int j = 0;(j < i);j++) { int xDist = Math.abs((locs[i] - locs[j])); if ( (xDist <= (2 * r))) { double y = (((2.0 * r) * (2.0 * r)) - (xDist * xDist)); if ( (Math.abs((y - 0.0)) < 0.0000000001)) {y = 0; } else {y = Math.sqrt(y); }y += yPos[j]; pos = Math.max(pos,y); } else {continue;}}yPos[i] = pos; } String[] ans = new String[n]; for ( int i = 0;(i < n);i++) {ans[i] = ("" + yPos[i]); }System.out.println(String.join(" ",ans)); } }
2	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  MyInput in = new MyInput(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } static class TaskB{ int n ; MyInput in ; PrintWriter out ; public void solve( int testNumber, MyInput in, PrintWriter out){ this.in = in; this.out = out; n = in.nextInt(); if ( (((n / 2) % 2) == 1)) {answer(-1); return ;} int low = 0,high = (n / 2);  int diff = (query((low + (n / 2))) - query(low)); while((diff != 0)){ int mid = ((low + high) / 2);  int d = (query((mid + (n / 2))) - query(mid)); if ( ((d == 0) || ((diff > 0) == (d > 0)))) {diff = d; low = mid; } else {high = mid; }}answer(low); } int query( int i){ out.println(("? " + ((i % n) + 1))); out.flush(); return in.nextInt();} void answer( int i){ out.println(("! " + ((i < 0)?i:((i % n) + 1)))); } } static class MyInput{ private final BufferedReader in ; static private int pos ; static private int readLen ; static private final char[] buffer = new char[(1024 * 8)]; static private char[] str = new char[((500 * 8) * 2)]; static private boolean[] isDigit = new boolean[256]; static private boolean[] isSpace = new boolean[256]; static private boolean[] isLineSep = new boolean[256]; {for ( int i = 0;(i < 10);i++) {isDigit[('0' + i)] = true; }isDigit['-'] = true; isSpace[' '] = isSpace['\r'] = isSpace['\n'] = isSpace['\t'] = true; isLineSep['\r'] = isLineSep['\n'] = true; }public MyInput( InputStream is){ in = new BufferedReader(new InputStreamReader(is)); } public int read(){ if ( (pos >= readLen)) {pos = 0; try{readLen = in.read(buffer); }catch (IOException e){ throw (new RuntimeException());} if ( (readLen <= 0)) {throw (new MyInput.EndOfFileRuntimeException());} } return buffer[pos++];} public int nextInt(){ int len = 0; str[len++] = nextChar(); len = reads(len,isSpace); int i = 0;  int ret = 0; if ( (str[0] == '-')) {i = 1; } for ( ;(i < len);i++) ret = (((ret * 10) + str[i]) - '0'); if ( (str[0] == '-')) {ret = -ret; } return ret;} public char nextChar(){ while(true){final int c = read(); if ( !isSpace[c]) {return (char)c;} }} int reads( int len, boolean[] accept){ try{while(true){final int c = read(); if ( accept[c]) {break;} if ( (str.length == len)) { char[] rep = new char[((str.length * 3) / 2)]; System.arraycopy(str,0,rep,0,str.length); str = rep; } str[len++] = (char)c; } }catch (MyInput.EndOfFileRuntimeException e){ } return len;} } }
1	public class Main{ public static void main( String[] args){ Scanner s = new Scanner(System.in);  int n = s.nextInt();  StringBuilder sb = new StringBuilder();  long[] a = new long[(n / 2)]; for ( int i = 0;(i < (n / 2));i++) {a[i] = s.nextLong(); } int j = 0;  long[] a2 = new long[(n / 2)];  long[] a1 = new long[(n / 2)]; a1[j] = (a[(a.length - 1)] / 2); a2[j] = (a[(a.length - 1)] - (a[(a.length - 1)] / 2)); for ( int i = (((n - 1) / 2) - 1);(i >= 0);i--) { long n1 = a1[j]; if ( ((a[i] - n1) < a2[j])) {a2[(j + 1)] = a2[j++]; a1[j] = (a[i] - a2[j]); } else {a1[++j] = n1; a2[j] = (a[i] - n1); }} int k = 0; for ( int i = ((n - 1) / 2);(i >= 0);i--) sb.append((a1[i] + " ")); for ( int i = 0;(i < (n / 2));i++) sb.append((a2[i] + " ")); System.out.println(sb.toString()); } }
1	public class Practice{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); sc.nextLine(); String s = sc.nextLine();  char c[] = s.toCharArray();  ArrayList a = new ArrayList(); for ( int i = 0;(i < c.length);i++) {a.add(c[i]); } int x = Collections.frequency(a,'0');  int y = Collections.frequency(a,'1'); if ( ((y == 0) || (y == 1))) {System.out.println(s); } else {if ( (y >= 2)) { String s1 = "1"; for ( int i = 0;(i < x);i++) {s1 = (s1 + "0"); }System.out.println(s1); } }} }
3	public class New_Year_and_Curling{ static final double E = 0.00001; public static void main( String[] args){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt();  int r = sc.nextInt();  double[] y = new double[n];  int arr[] = new int[n]; for ( int i = 0;(i < n);i++) {arr[i] = sc.nextInt(); double top = r;  int x = arr[i]; for ( int j = 0;(j < i);j++) {if ( (Math.abs((arr[j] - x)) <= (2 * r))) {top = Math.max(top,(y[j] + Math.sqrt((((4 * r) * r) - ((arr[j] - x) * (arr[j] - x)))))); } }y[i] = top; double res = y[i]; System.out.print((res + " ")); }} }
4	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  TaskG2 solver = new TaskG2(); solver.solve(1,in,out); out.close(); } static class TaskG2{ static final int MOD = (1000000000 + 7); static final int MAXN = 51; int getWays( int i, int j, int k, int l, int[][][][] ways, boolean[][][][] cached){ if ( (((i + j) + k) == 0)) return ((l == -1)?1:0); if ( (l < 0)) return 0; if ( cached[i][j][k][l]) return ways[i][j][k][l]; int s = ((i + j) + k);  long value = 0; if ( ((l == 0) && (i != 0))) {for ( int x = -1;(x < 3);x++) if ( (x != l)) {value += getWays((i - 1),j,k,x,ways,cached); } } if ( ((l == 1) && (j != 0))) {for ( int x = -1;(x < 3);x++) if ( (x != l)) {value += getWays(i,(j - 1),k,x,ways,cached); } } if ( ((l == 2) && (k != 0))) {for ( int x = -1;(x < 3);x++) if ( (x != l)) {value += getWays(i,j,(k - 1),x,ways,cached); } } ways[i][j][k][l] = (int)(value % MOD); cached[i][j][k][l] = true; return ways[i][j][k][l];} int totalWays( int i, int j, int k, int[][][][] ways, boolean[][][][] cached, int[] factorial){ long ret = 0; for ( int l = 0;(l < 3);l++) ret += getWays(i,j,k,l,ways,cached); ret *= factorial[i]; ret %= MOD; ret *= factorial[j]; ret %= MOD; ret *= factorial[k]; ret %= MOD; return (int)ret;} int add( int type, int value, int[] sizes, int sum, int[][][][] dp){ sizes[type]++; if ( (type == 0)) {for ( int s = (sum + value);(s >= value);s--) {for ( int i = 1;(i <= sizes[0]);i++) for ( int j = 0;(j <= sizes[1]);j++) for ( int k = 0;(k <= sizes[2]);k++) {dp[i][j][k][s] += dp[(i - 1)][j][k][(s - value)]; if ( (dp[i][j][k][s] >= MOD)) dp[i][j][k][s] -= MOD; }}} if ( (type == 1)) {for ( int s = (sum + value);(s >= value);s--) {for ( int i = 0;(i <= sizes[0]);i++) for ( int j = 1;(j <= sizes[1]);j++) for ( int k = 0;(k <= sizes[2]);k++) {dp[i][j][k][s] += dp[i][(j - 1)][k][(s - value)]; if ( (dp[i][j][k][s] >= MOD)) dp[i][j][k][s] -= MOD; }}} if ( (type == 2)) {for ( int s = (sum + value);(s >= value);s--) {for ( int i = 0;(i <= sizes[0]);i++) for ( int j = 0;(j <= sizes[1]);j++) for ( int k = 1;(k <= sizes[2]);k++) {dp[i][j][k][s] += dp[i][j][(k - 1)][(s - value)]; if ( (dp[i][j][k][s] >= MOD)) dp[i][j][k][s] -= MOD; }}} return (sum + value);} public void solve( int testNumber, InputReader in, OutputWriter out){ int[][][][] ways = new int[MAXN][MAXN][MAXN][3];  boolean[][][][] cached = new boolean[MAXN][MAXN][MAXN][3];  int n = in.nextInt(),T = in.nextInt();  ArrayList<Integer>[] ar = new ArrayList[3]; for ( int i = 0;(i < 3);i++) ar[i] = new ArrayList<Integer>(); int total_sum = 0; for ( int i = 0;(i < n);i++) { int t = in.nextInt(),g = in.nextInt(); ar[(g - 1)].add(t); total_sum += t; }if ( (T > total_sum)) {out.println(0); return ;} int min_index = 0,mn = 100000000; for ( int i = 0;(i < 3);i++) {if ( (ar[i].size() < mn)) {mn = ar[i].size(); min_index = i; } } int[][][][] dp = new int[(ar[((1 + min_index) % 3)].size() + 1)][(ar[((2 + min_index) % 3)].size() + 1)][(mn + 1)][(total_sum + 1)]; dp[0][0][0][0] = 1; int[] sizes = {0,0,0};  int sum = 0;  int[] order = {((min_index + 1) % 3),((min_index + 2) % 3),min_index};  int type = 0; for ( int i :order) {for ( int v :ar[i]) sum = add(type,v,sizes,sum,dp); type++; } int[] factorial = new int[MAXN]; factorial[0] = 1; for ( int i = 1;(i < MAXN);i++) factorial[i] = (int)(((factorial[(i - 1)] * 1L) * i) % MOD); long answer = 0; for ( int i = 0;(i < dp.length);i++) for ( int j = 0;(j < dp[0].length);j++) for ( int k = 0;(k < dp[0][0].length);k++) {answer += ((dp[i][j][k][T] * 1L) * totalWays(i,j,k,ways,cached,factorial)); answer %= MOD; }out.println(answer); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputReader.SpaceCharFilter filter ; 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 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 boolean isSpaceChar( int c){ if ( (filter != null)) {return filter.isSpaceChar(c);} return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void println( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }writer.print('\n'); } public void close(){ writer.close(); } } }
4	public class CF1497E2 extends PrintWriter{ CF1497E2(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; byte[] bb = new byte[(1 << 15)]; int i ,n ; byte getc(){ if ( (i == n)) {i = n = 0; try{n = in.read(bb); }catch (IOException e){ } } return ((i < n)?bb[i++]:0);} int nextInt(){ byte c = 0; while((c <= ' '))c = getc(); int a = 0; while((c > ' ')){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1497E2 o = new CF1497E2(); o.main(); o.flush(); } static final int A = 10000000,K = 20; int[] cc = new int[(A + 1)]; { boolean[] composite = new boolean[(A + 1)]; for ( int a = 1;(a <= A);a++) cc[a] = a; for ( int a = 2;(a <= A);a++) {if ( composite[a]) continue; for ( int b = (a + a);(b <= A);b += a) composite[b] = true; if ( (a <= (A / a))) { int a2 = (a * a); for ( int b = a2;(b <= A);b += a2) { int c = cc[b]; while(((c % a2) == 0))c /= a2; cc[b] = c; }} }} void main(){ int[] pp = new int[(A + 1)]; Arrays.fill(pp,-1); int t = sc.nextInt(); while((t-- > 0)){ int n = sc.nextInt();  int k = sc.nextInt();  int[] aa = new int[n]; for ( int i = 0;(i < n);i++) aa[i] = cc[sc.nextInt()]; int[] mp = new int[(k + 1)];  int[] ip = new int[(k + 1)]; for ( int i = 0;(i < n);i++) { int a = aa[i]; for ( int h = k;(h >= 0);h--) {if ( (pp[a] >= ip[h])) {mp[h]++; ip[h] = i; } if ( ((h > 0) && ((mp[(h - 1)] < mp[h]) || ((mp[(h - 1)] == mp[h]) && (ip[(h - 1)] > ip[h]))))) {mp[h] = mp[(h - 1)]; ip[h] = ip[(h - 1)]; } }pp[a] = i; }println((mp[k] + 1)); for ( int i = 0;(i < n);i++) { int a = aa[i]; pp[a] = -1; }}} }
6	public class Fish extends Thread{ public Fish(){ this.input = new BufferedReader(new InputStreamReader(System.in)); this.output = new PrintWriter(System.out); this.setPriority(Thread.MAX_PRIORITY); } private void solve()throws Throwable { int n = nextInt();  double[][] a = new double[n][n];  double[] dp = new double[(1 << n)]; for ( int i = 0;(i < n);++i) {for ( int j = 0;(j < n);++j) {a[i][j] = nextDouble(); }} int limit = ((1 << n) - 1); dp[limit] = 1.0; for ( int mask = limit;(mask > 0);--mask) { int cardinality = Integer.bitCount(mask);  int probability = ((cardinality * (cardinality - 1)) / 2); for ( int first = 0;(first < n);++first) {if ( ((mask & powers[first]) != 0)) {for ( int second = (first + 1);(second < n);++second) {if ( ((mask & powers[second]) != 0)) {dp[(mask - powers[first])] += ((dp[mask] * a[second][first]) / probability); dp[(mask - powers[second])] += ((dp[mask] * a[first][second]) / probability); } }} }}for ( int i = 0;(i < n);++i) {output.printf("%.10f ",dp[powers[i]]); }} public static void main( String[] args){ new Fish().start(); } private String nextToken()throws IOException { while(((tokens == null) || !tokens.hasMoreTokens())){tokens = new StringTokenizer(input.readLine()); }return tokens.nextToken();} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} private double nextDouble()throws IOException { return Double.parseDouble(nextToken());} static int powers[] = {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,131072,262144}; private BufferedReader input ; private PrintWriter output ; private StringTokenizer tokens = null; }
6	public class P111C{ Scanner sc = new Scanner(System.in); int INF = (1 << 28); double EPS = 1e-9; int h ,w ; void run(){ h = sc.nextInt(); w = sc.nextInt(); solve(); } void solve(){ n = (w * h); g = new long[n]; int[] dx = {0,0,-1,1};  int[] dy = {-1,1,0,0}; for ( int y = 0;(y < h);y++) {for ( int x = 0;(x < w);x++) {for ( int k = 0;(k < 4);k++) { int x2 = (x + dx[k]);  int y2 = (y + dy[k]); if ( ((((x2 >= 0) && (x2 < w)) && (y2 >= 0)) && (y2 < h))) {g[((y * w) + x)] |= (1L << ((y2 * w) + x2)); } }}}candidate = new int[n]; mds = ((1L << n) - 1); mds(0,0,0); println(((n - Long.bitCount(mds)) + "")); } int n ; long[] g ; long mds ; int[] candidate ; void mds( long choosed, long removed, long covered){ if ( (Long.bitCount(choosed) >= Long.bitCount(mds))) return ; if ( (covered == ((1L << n) - 1))) {if ( (Long.bitCount(choosed) < Long.bitCount(mds))) mds = choosed; return ;} long s = covered; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); s |= ((1L << i) | g[i]); }if ( (s != ((1L << n) - 1))) return ; int k = -1; for ( long remained = (~removed & ((1L << n) - 1));(remained != 0);remained &= (remained - 1)) { int i = Long.numberOfTrailingZeros(remained); if ( (((covered >>> i) & 1) == 1)) {if ( (Long.bitCount((g[i] & ~covered)) == 0)) {mds(choosed,(removed | (1L << i)),covered); return ;} else if ( ((Long.bitCount((g[i] & ~covered)) == 1) && (((g[i] & ~covered) & ~removed) != 0))) {mds(choosed,(removed | (1L << i)),covered); return ;} } else {if ( (Long.bitCount((g[i] & ~removed)) == 0)) {mds((choosed | (1L << i)),(removed | (1L << i)),((covered | (1L << i)) | g[i])); return ;} else if ( ((Long.bitCount((g[i] & ~removed)) == 1) && (((g[i] & ~removed) | (g[i] & ~covered)) == (g[i] & ~removed)))) { int j = Long.numberOfTrailingZeros((g[i] & ~removed)); mds((choosed | (1L << j)),((removed | (1L << i)) | (1L << j)),((covered | (1L << j)) | g[j])); return ;} }if ( ((k == -1) || (Long.bitCount((g[i] & ~covered)) > Long.bitCount((g[k] & ~covered))))) k = i; }if ( (k == -1)) return ; mds((choosed | (1L << k)),(removed | (1L << k)),((covered | (1L << k)) | g[k])); mds(choosed,(removed | (1L << k)),covered); } void println( String s){ System.out.println(s); } void print( String s){ System.out.print(s); } public static void main( String[] args){ Locale.setDefault(Locale.US); new P111C().run(); } }
3	public class Main{ static int dx[] = {-1,1,0,0}; static int dy[] = {0,0,1,-1}; static long MOD = 1000000007; static int INF = (Integer.MAX_VALUE / 10); static PrintWriter pw ; static InputReader scan ; static int ni()throws IOException { return scan.nextInt();} static double nd()throws IOException { return scan.nextDouble();} static void pl()throws IOException { pw.println(); } static void pl( Object o)throws IOException { pw.println(o); } static void p( Object o)throws IOException { pw.print((o + " ")); } public static void main( String[] args){ new Thread(null,null,"BaZ",99999999){}.start(); } static void solve()throws IOException { Calendar CAL1 = Calendar.getInstance(); CAL1.setTime(new Date()); scan = new InputReader(System.in); pw = new PrintWriter(System.out,true); StringBuilder sb = new StringBuilder();  int n = ni();  double r = ni();  double x[] = new double[n]; for ( int i = 0;(i < n);++i) x[i] = nd(); double y[] = new double[n]; y[0] = r; for ( int i = 1;(i < n);++i) { double max = -1; for ( int j = 0;(j < i);++j) { double xx = (((4 * r) * r) - ((x[i] - x[j]) * (x[i] - x[j]))); if ( (xx >= 0)) max = max(max,(sqrt(xx) + y[j])); }if ( (max == -1)) max = r; y[i] = max; }for ( int i = 0;(i < n);++i) p(y[i]); pl(); Calendar CAL2 = Calendar.getInstance(); CAL2.setTime(new Date()); double Execution_Time = ((double)(CAL2.getTimeInMillis() - CAL1.getTimeInMillis()) / 1000.000); pw.flush(); pw.close(); } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private SpaceCharFilter filter ; 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(){ BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  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); } } }
1	public class TreasureHunt{ public static String Solve(){ Scanner sc = new Scanner(System.in);  int n = sc.nextInt(); sc.nextLine(); String kuro = sc.nextLine(),shiro = sc.nextLine(),katie = sc.nextLine(); sc.close(); String[] output = {"Kuro","Shiro","Katie","Draw"}; if ( (n >= kuro.length())) return output[3]; int[] maxArr = new int[3];  int[][] freq = new int[3][58]; for ( int i = 0;(i < kuro.length());i++) {maxArr[0] = ((++freq[0][(kuro.charAt(i) - 65)] > maxArr[0])?freq[0][(kuro.charAt(i) - 65)]:maxArr[0]); maxArr[1] = ((++freq[1][(shiro.charAt(i) - 65)] > maxArr[1])?freq[1][(shiro.charAt(i) - 65)]:maxArr[1]); maxArr[2] = ((++freq[2][(katie.charAt(i) - 65)] > maxArr[2])?freq[2][(katie.charAt(i) - 65)]:maxArr[2]); } int winner = 0,max = 0; for ( int i = 0;(i < 3);i++) {if ( ((kuro.length() - maxArr[i]) >= n)) maxArr[i] += n; else maxArr[i] = ((n == 1)?(kuro.length() - 1):kuro.length()); if ( (max < maxArr[i])) {winner = i; max = maxArr[i]; } else if ( (max == maxArr[i])) winner = 3; }return output[winner];} public static void main( String[] args){ System.out.println(Solve()); } }
4	public class mC{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  StringBuilder st = new StringBuilder();  int t = 1; for ( int test = 0;(test < t);test++) { int n = sc.nextInt();  int MOD = sc.nextInt();  long[] factorial = new long[1000];  long[] powerOfTwo = new long[1000]; factorial[0] = 1; powerOfTwo[0] = 1; for ( int i = 1;(i < 1000);i++) {factorial[i] = (i * factorial[(i - 1)]); factorial[i] %= MOD; powerOfTwo[i] = (2 * powerOfTwo[(i - 1)]); if ( (powerOfTwo[i] >= MOD)) {powerOfTwo[i] -= MOD; } } long[] oneOverFactorial = new long[500]; oneOverFactorial[0] = 1; oneOverFactorial[1] = 1; for ( int i = 2;(i < 450);i++) {oneOverFactorial[i] = fastPow(factorial[i],(MOD - 2),MOD); } long dp[][] = new long[(n + 3)][(n + 3)]; dp[1][1] = 1; for ( int i = 2;(i <= n);i++) {dp[i][i] = powerOfTwo[(i - 1)]; for ( int j = 1;(j < (i - 1));j++) {for ( int k = 1;(k <= j);k++) { long add = (dp[j][k] * factorial[(k + ((i - j) - 1))]); add %= MOD; add *= oneOverFactorial[k]; add %= MOD; add *= oneOverFactorial[((i - j) - 1)]; add %= MOD; add *= powerOfTwo[((i - j) - 2)]; add %= MOD; dp[i][(k + ((i - j) - 1))] += add; dp[i][(k + ((i - j) - 1))] %= MOD; }}} long ans = 0; for ( int i = 1;(i <= n);i++) {ans += dp[n][i]; }ans %= MOD; System.out.println(ans); }} public static int findNthInArray( int[] arr, int val, int start, int o){ if ( (o == 0)) {return (start - 1);} else if ( (arr[start] == val)) {return findNthInArray(arr,val,(start + 1),(o - 1));} else {return findNthInArray(arr,val,(start + 1),o);}} public static ArrayList<Integer> dfs( int at, ArrayList<Integer> went, ArrayList<ArrayList<Integer>> connect){ for ( int i = 0;(i < connect.get(at).size());i++) {if ( !went.contains(connect.get(at).get(i))) {went.add(connect.get(at).get(i)); went = dfs(connect.get(at).get(i),went,connect); } }return went;} public static int[] bfs( int at, int[] went, ArrayList<ArrayList<Integer>> queue, int numNodes, ArrayList<ArrayList<Integer>> connect){ if ( (went[at] == 0)) {went[at] = queue.get(numNodes).get(1); for ( int i = 0;(i < connect.get(at).size());i++) {if ( (went[connect.get(at).get(i)] == 0)) { ArrayList<Integer> temp = new ArrayList<>(); temp.add(connect.get(at).get(i)); temp.add((queue.get(numNodes).get(1) + 1)); queue.add(temp); } }} if ( (queue.size() == (numNodes + 1))) {return went;} else {return bfs(queue.get((numNodes + 1)).get(0),went,queue,(numNodes + 1),connect);}} public static long fastPow( long base, long exp, long mod){ if ( (exp == 0)) {return 1;} else {if ( ((exp % 2) == 1)) { long z = fastPow(base,((exp - 1) / 2),mod); return ((((z * base) % mod) * z) % mod);} else { long z = fastPow(base,(exp / 2),mod); return ((z * z) % mod);}}} public static int fastPow( int base, long exp){ if ( (exp == 0)) {return 1;} else {if ( ((exp % 2) == 1)) { int z = fastPow(base,((exp - 1) / 2)); return ((z * base) * z);} else { int z = fastPow(base,(exp / 2)); return (z * z);}}} public static int firstLarger( long val, ArrayList<Long> ok, int left, int right){ if ( (ok.get(right) <= val)) {return -1;} if ( (left == right)) {return left;} else if ( ((left + 1) == right)) {if ( (val < ok.get(left))) {return left;} else {return right;}} else { int mid = ((left + right) / 2); if ( (ok.get(mid) > val)) {return firstLarger(val,ok,left,mid);} else {return firstLarger(val,ok,(mid + 1),right);}}} public static int binSearchArr( long val, ArrayList<Integer> ok, long[] arr, int left, int right){ if ( (arr[ok.get(right)] <= val)) {return -1;} if ( (left == right)) {return left;} else if ( ((left + 1) == right)) {if ( (val < arr[ok.get(left)])) {return left;} else {return right;}} else { int mid = ((left + right) / 2); if ( (arr[ok.get(mid)] > val)) {return binSearchArr(val,ok,arr,left,mid);} else {return binSearchArr(val,ok,arr,(mid + 1),right);}}} public static long gcd( long a, long b){ if ( (b > a)) {return gcd(b,a);} if ( (b == 0)) {return a;} if ( ((a % b) == 0)) {return b;} else {return gcd(b,(a % b));}} }
4	public class EG14{ public static long MOD ; public static int MAX = 405; public static long[] fac ; public static long[] ifac ; public static void main( String[] args)throws IOException { BufferedReader f = new BufferedReader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(System.out);  StringTokenizer st = new StringTokenizer(f.readLine());  int n = Integer.parseInt(st.nextToken()); MOD = Long.parseLong(st.nextToken()); long[] pow2 = new long[MAX]; pow2[0] = 1L; for ( int k = 1;(k < MAX);k++) {pow2[k] = (((2L * pow2[(k - 1)]) + MOD) % MOD); }fac = new long[MAX]; ifac = new long[MAX]; fac[0] = 1L; ifac[0] = 1L; for ( int k = 1;(k < MAX);k++) {fac[k] = ((((long)k * fac[(k - 1)]) + MOD) % MOD); ifac[k] = modInverse(fac[k],MOD); } long[][] dp = new long[n][(n + 1)]; for ( int k = 0;(k < n);k++) {dp[k][(k + 1)] = pow2[k]; }for ( int k = 2;(k < n);k++) {for ( int j = 1;(j <= n);j++) {if ( (dp[(k - 2)][(j - 1)] == 0)) continue; long start = dp[(k - 2)][(j - 1)]; for ( int add = 1;;add++) {if ( ((((k + add) - 1) >= n) || (((j + add) - 1) > n))) break; long adder = (((start * pow2[(add - 1)]) + MOD) % MOD); adder = (((adder * choose(((j + add) - 1),(j - 1))) + MOD) % MOD); dp[((k + add) - 1)][((j + add) - 1)] = (((dp[((k + add) - 1)][((j + add) - 1)] + adder) + MOD) % MOD); }}} long answer = 0L; for ( int k = 1;(k <= n);k++) {answer = (((answer + dp[(n - 1)][k]) + MOD) % MOD); }out.println(answer); out.close(); } public static long choose( int a, int b){ long prod = (((fac[a] * ifac[b]) + MOD) % MOD); return (((prod * ifac[(a - b)]) + MOD) % MOD);} public static long modInverse( long a, long m){ long m0 = m;  long y = 0L;  long x = 1L; if ( (m == 1L)) return 0L; while((a > 1L)){ long q = (a / m);  long t = m; m = (a % m); a = t; t = y; y = (x - (q * y)); x = t; }if ( (x < 0L)) x += m0; return x;} }
0	public class Soldiers{ public static void main( String[] args)throws IOException { new Soldiers().run(); } void run()throws IOException { br = new BufferedReader(new InputStreamReader(System.in)); pw = new PrintWriter(System.out); int n = nextInt(); pw.println((3 * (n / 2))); pw.close(); } BufferedReader br ; StringTokenizer st ; PrintWriter pw ; String next()throws IOException { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(br.readLine()); }return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} }
3	public class Main{ static private void solve(){ int n = ni();  double r = ni();  double[][] p = new double[n][2];  double EPS = 0.0000000000001; for ( int i = 0;(i < n);i++) { double x = ni();  double y = r; for ( int j = 0;(j < i);j++) { double dx = Math.abs((p[j][0] - x)); if ( (dx <= ((r * 2) + EPS))) { double dy = Math.sqrt((((4.0 * r) * r) - (dx * dx))); y = Math.max(y,(p[j][1] + dy)); } }out.printf("%.12f ",y); p[i][0] = x; p[i][1] = y; }out.println(); } public static void main( String[] args){ new Thread(null,new Runnable(){},"",64000000).start(); } static private java.io.InputStream is = System.in; static private java.io.PrintWriter out = new java.io.PrintWriter(System.out); static private java.util.StringTokenizer tokenizer = null; static private java.io.BufferedReader reader ; public static String next(){ while(((tokenizer == null) || !tokenizer.hasMoreTokens())){try{tokenizer = new java.util.StringTokenizer(reader.readLine()); }catch (Exception e){ throw (new RuntimeException(e));} }return tokenizer.nextToken();} static private long nl(){ return Long.parseLong(next());} static private int ni(){ return Integer.parseInt(next());} static private void tr( Object... o){ if ( (is != System.in)) System.out.println(java.util.Arrays.deepToString(o)); } }
0	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);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } static class TaskA{ public void solve( int testNumber, InputReader in, PrintWriter out){ int N = in.nextInt(); if ( (N == 1)) {out.println(1); } else if ( (N == 2)) {out.println(2); } else if ( (N == 3)) {out.println(6); } else { long best = Long.MIN_VALUE; best = Math.max(best,lcm(N,lcm((N - 1),(N - 2)))); best = Math.max(best,lcm(N,lcm((N - 2),(N - 3)))); best = Math.max(best,lcm(N,lcm((N - 1),(N - 3)))); best = Math.max(best,lcm((N - 1),lcm((N - 2),(N - 3)))); out.println(best); }} private long lcm( long a, long b){ return (a * (b / gcd(a,b)));} private long gcd( long a, long b){ return ((b == 0)?a:gcd(b,(a % b)));} } 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());} } }
4	public class Main{ public static void main( String[] args)throws Exception { Thread thread = new Thread(null,new TaskAdapter(),"",(1 << 29)); thread.start(); thread.join(); } static class TaskAdapter implements Runnable{ } static class EPhoenixAndComputers{ public void solve( int testNumber, FastInput in, FastOutput out){ int n = in.ri();  int mod = in.ri();  CachedPow2 cp = new CachedPow2(2,mod,(n + 1),(mod - 1));  Combination comb = new Combination((n + 1),mod);  long[][][] dp = new long[(n + 1)][(n + 1)][2]; dp[0][0][0] = 1; for ( int i = 1;(i <= n);i++) {for ( int j = 0;(j <= n);j++) {dp[i][j][0] = dp[(i - 1)][j][1]; for ( int k = 0;(k < i);k++) { int len = (i - k);  int last = (j - len); if ( (last >= 0)) {dp[i][j][1] += ((((dp[k][last][0] * cp.pow((len - 1))) % mod) * comb.combination(j,len)) % mod); } }dp[i][j][1] %= mod; }} long ans = 0; for ( int i = 0;(i <= n);i++) {ans += dp[n][i][1]; }ans %= mod; out.println(ans); } } static class FastOutput implements AutoCloseable,Closeable,Appendable{ static private final int THRESHOLD = (32 << 10); private final Writer os ; private StringBuilder cache = new StringBuilder((THRESHOLD * 2)); public FastOutput append( CharSequence csq){ cache.append(csq); return this;} public FastOutput append( CharSequence csq, int start, int end){ cache.append(csq,start,end); return this;} private void afterWrite(){ if ( (cache.length() < THRESHOLD)) {return ;} flush(); } public FastOutput( Writer os){ this.os = os; } public FastOutput( OutputStream os){ this(new OutputStreamWriter(os)); } public FastOutput append( char c){ cache.append(c); afterWrite(); return this;} public FastOutput append( long c){ cache.append(c); afterWrite(); return this;} public FastOutput println( long c){ return append(c).println();} public FastOutput println(){ return append('\n');} public FastOutput flush(){ try{os.append(cache); os.flush(); cache.setLength(0); }catch (IOException e){ throw (new UncheckedIOException(e));} return this;} public void close(){ flush(); try{os.close(); }catch (IOException e){ throw (new UncheckedIOException(e));} } public String toString(){ return cache.toString();} } static interface IntegerEntryIterator{ boolean hasNext(); void next(); int getEntryKey(); int getEntryValue(); } static class FastInput{ private final InputStream is ; private byte[] buf = new byte[(1 << 13)]; private int bufLen ; private int bufOffset ; private int next ; public FastInput( InputStream is){ this.is = is; } private int read(){ while((bufLen == bufOffset)){bufOffset = 0; try{bufLen = is.read(buf); }catch (IOException e){ bufLen = -1; } if ( (bufLen == -1)) {return -1;} }return buf[bufOffset++];} public void skipBlank(){ while(((next >= 0) && (next <= 32))){next = read(); }} public int ri(){ return readInt();} public int readInt(){ boolean rev = false; skipBlank(); if ( ((next == '+') || (next == '-'))) {rev = (next == '-'); next = read(); } int val = 0; while(((next >= '0') && (next <= '9'))){val = (((val * 10) - next) + '0'); next = read(); }return (rev?val:-val);} } static class Hasher{ private long time = (System.nanoTime() + (System.currentTimeMillis() * 31L)); public int shuffle( long z){ z += time; z = ((z ^ (z >>> 33)) * 0x62a9d9ed799705f5L); return (int)(((z ^ (z >>> 28)) * 0xcb24d0a5c88c35b3L) >>> 32);} public int hash( int x){ return shuffle(x);} } static interface IntCombination{ } static class MultiplicativeFunctionSieve{ static MultiplicativeFunctionSieve instance = new MultiplicativeFunctionSieve((1 << 16)); public int[] primes ; public boolean[] isComp ; public int primeLength ; public int[] smallestPrimeFactor ; public int[] expOfSmallestPrimeFactor ; int limit ; public static MultiplicativeFunctionSieve getInstance( int n){ if ( (n <= (1 << 16))) {return instance;} return new MultiplicativeFunctionSieve(n);} public int[] getEuler(){ int[] euler = new int[(limit + 1)]; euler[1] = 1; for ( int i = 2;(i <= limit);i++) {if ( !isComp[i]) {euler[i] = (i - 1); } else {if ( (expOfSmallestPrimeFactor[i] == i)) {euler[i] = (i - (i / smallestPrimeFactor[i])); } else {euler[i] = (euler[expOfSmallestPrimeFactor[i]] * euler[(i / expOfSmallestPrimeFactor[i])]); }}}return euler;} public MultiplicativeFunctionSieve( int limit){ this.limit = limit; isComp = new boolean[(limit + 1)]; primes = new int[(limit + 1)]; expOfSmallestPrimeFactor = new int[(limit + 1)]; smallestPrimeFactor = new int[(limit + 1)]; primeLength = 0; for ( int i = 2;(i <= limit);i++) {if ( !isComp[i]) {primes[primeLength++] = i; expOfSmallestPrimeFactor[i] = smallestPrimeFactor[i] = i; } for ( int j = 0,until = (limit / i);((j < primeLength) && (primes[j] <= until));j++) { int pi = (primes[j] * i); smallestPrimeFactor[pi] = primes[j]; expOfSmallestPrimeFactor[pi] = ((smallestPrimeFactor[i] == primes[j])?(expOfSmallestPrimeFactor[i] * expOfSmallestPrimeFactor[primes[j]]):expOfSmallestPrimeFactor[primes[j]]); isComp[pi] = true; if ( ((i % primes[j]) == 0)) {break;} }}} } static class Factorial{ int[] fact ; int[] inv ; int mod ; public int getMod(){ return mod;} public Factorial( int[] fact, int[] inv, int mod){ this.mod = mod; this.fact = fact; this.inv = inv; fact[0] = inv[0] = 1; int n = Math.min(fact.length,mod); for ( int i = 1;(i < n);i++) {fact[i] = i; fact[i] = (int)(((long)fact[i] * fact[(i - 1)]) % mod); }if ( ((n - 1) >= 0)) {inv[(n - 1)] = BigInteger.valueOf(fact[(n - 1)]).modInverse(BigInteger.valueOf(mod)).intValue(); } for ( int i = (n - 2);(i >= 1);i--) {inv[i] = (int)(((long)inv[(i + 1)] * (i + 1)) % mod); }} public Factorial( int limit, int mod){ this(new int[Math.min((limit + 1),mod)],new int[Math.min((limit + 1),mod)],mod); } public int fact( int n){ if ( (n >= mod)) {return 0;} return fact[n];} public int invFact( int n){ if ( (n >= mod)) {throw (new IllegalArgumentException());} return inv[n];} } static class CachedPow2{ private int[] first ; private int[] second ; private int mod ; private int low ; private int mask ; private int phi ; private int xphi ; public CachedPow2( int x, int mod){ this(x,mod,CachedEulerFunction.get(mod)); } public CachedPow2( int x, int mod, int phi){ this(x,mod,mod,phi); } public CachedPow2( int x, int mod, int limit, int phi){ this.phi = phi; limit = Math.min(limit,mod); this.mod = mod; int log = Log2.ceilLog((limit + 1)); low = ((log + 1) / 2); mask = ((1 << low) - 1); first = new int[(1 << low)]; second = new int[(1 << (log - low))]; first[0] = 1; for ( int i = 1;(i < first.length);i++) {first[i] = (int)(((long)x * first[(i - 1)]) % mod); }second[0] = 1; long step = (((long)x * first[(first.length - 1)]) % mod); for ( int i = 1;(i < second.length);i++) {second[i] = (int)((second[(i - 1)] * step) % mod); }xphi = DigitUtils.modPow(x,phi,mod); } public int pow( int exp){ return (int)(((long)first[(exp & mask)] * second[(exp >> low)]) % mod);} } static class Combination implements IntCombination{ final Factorial factorial ; int modVal ; public Combination( Factorial factorial){ this.factorial = factorial; this.modVal = factorial.getMod(); } public Combination( int limit, int mod){ this(new Factorial(limit,mod)); } public int combination( int m, int n){ if ( ((n > m) || (n < 0))) {return 0;} return (int)(((((long)factorial.fact(m) * factorial.invFact(n)) % modVal) * factorial.invFact((m - n))) % modVal);} } static class IntegerHashMap{ private int now ; private int[] slot ; private int[] version ; private int[] next ; private int[] keys ; private int[] values ; private int alloc ; private boolean[] removed ; private int mask ; private int size ; private boolean rehash ; private Hasher hasher = new Hasher(); public IntegerHashMap( int cap, boolean rehash){ now = 1; this.mask = ((1 << (32 - Integer.numberOfLeadingZeros((cap - 1)))) - 1); slot = new int[(mask + 1)]; version = new int[slot.length]; next = new int[(cap + 1)]; keys = new int[(cap + 1)]; values = new int[(cap + 1)]; removed = new boolean[(cap + 1)]; this.rehash = rehash; } private void doubleCapacity(){ int newSize = Math.max((next.length + 10),(next.length * 2)); next = Arrays.copyOf(next,newSize); keys = Arrays.copyOf(keys,newSize); values = Arrays.copyOf(values,newSize); removed = Arrays.copyOf(removed,newSize); } public void alloc(){ alloc++; if ( (alloc >= next.length)) {doubleCapacity(); } next[alloc] = 0; removed[alloc] = false; size++; } private void rehash(){ int[] newSlots = new int[Math.max(16,(slot.length * 2))];  int[] newVersions = new int[newSlots.length];  int newMask = (newSlots.length - 1); for ( int i = 0;(i < slot.length);i++) {access(i); if ( (slot[i] == 0)) {continue;} int head = slot[i]; while((head != 0)){ int n = next[head];  int s = (hash(keys[head]) & newMask); next[head] = newSlots[s]; newSlots[s] = head; head = n; }}this.slot = newSlots; this.version = newVersions; now = 0; this.mask = newMask; } private int hash( int x){ return hasher.hash(x);} public void put( int x, int y){ put(x,y,true); } public void put( int x, int y, boolean cover){ int h = hash(x);  int s = (h & mask); access(s); if ( (slot[s] == 0)) {alloc(); slot[s] = alloc; keys[alloc] = x; values[alloc] = y; } else { int index = findIndexOrLastEntry(s,x); if ( (keys[index] != x)) {alloc(); next[index] = alloc; keys[alloc] = x; values[alloc] = y; } else if ( cover) {values[index] = y; } }if ( (rehash && (size >= slot.length))) {rehash(); } } public int getOrDefault( int x, int def){ int h = hash(x);  int s = (h & mask); access(s); if ( (slot[s] == 0)) {return def;} int index = findIndexOrLastEntry(s,x); return ((keys[index] == x)?values[index]:def);} private int findIndexOrLastEntry( int s, int x){ int iter = slot[s]; while((keys[iter] != x)){if ( (next[iter] != 0)) {iter = next[iter]; } else {return iter;}}return iter;} private void access( int i){ if ( (version[i] != now)) {version[i] = now; slot[i] = 0; } } public IntegerEntryIterator iterator(){ return new IntegerEntryIterator(){ int index = 1; int readIndex = -1; public boolean hasNext(){ while(((index <= alloc) && removed[index])){index++; }return (index <= alloc);} public int getEntryKey(){ return keys[readIndex];} public int getEntryValue(){ return values[readIndex];} public void next(){ if ( !hasNext()) {throw (new IllegalStateException());} readIndex = index; index++; } };} public String toString(){ IntegerEntryIterator iterator = iterator();  StringBuilder builder = new StringBuilder("{"); while(iterator.hasNext()){iterator.next(); builder.append(iterator.getEntryKey()).append("->").append(iterator.getEntryValue()).append(','); }if ( (builder.charAt((builder.length() - 1)) == ',')) {builder.setLength((builder.length() - 1)); } builder.append('}'); return builder.toString();} } }
4	public class B{ static int n ,t[] ,g[] ,MOD = ((int)1e9 + 7); static int[][][] memo1 ,memo2[] ,memo3[] ; static int dp1( int idx, int remCnt, int remSum){ if ( (idx == n)) return (((remSum == 0) && (remCnt == 0))?1:0); if ( ((remCnt < 0) || (remSum < 0))) return 0; if ( (memo1[idx][remCnt][remSum] != -1)) return memo1[idx][remCnt][remSum]; int ans = dp1((idx + 1),remCnt,remSum); if ( (g[idx] == 0)) {ans += dp1((idx + 1),(remCnt - 1),(remSum - t[idx])); if ( (ans >= MOD)) ans -= MOD; } return memo1[idx][remCnt][remSum] = ans;} static int dp2( int idx, int remCnt1, int remCnt2, int remSum){ if ( (idx == n)) return ((((remSum == 0) && (remCnt1 == 0)) && (remCnt2 == 0))?1:0); if ( (((remSum < 0) || (remCnt1 < 0)) || (remCnt2 < 0))) return 0; if ( (memo2[idx][remCnt1][remCnt2][remSum] != -1)) return memo2[idx][remCnt1][remCnt2][remSum]; int ans = dp2((idx + 1),remCnt1,remCnt2,remSum); if ( (g[idx] == 1)) ans += dp2((idx + 1),(remCnt1 - 1),remCnt2,(remSum - t[idx])); else if ( (g[idx] == 2)) ans += dp2((idx + 1),remCnt1,(remCnt2 - 1),(remSum - t[idx])); if ( (ans >= MOD)) ans -= MOD; return memo2[idx][remCnt1][remCnt2][remSum] = ans;} static private int dp3( int cnt0, int cnt1, int cnt2, int last){ if ( (((cnt0 + cnt1) + cnt2) == 0)) return 1; if ( (memo3[last][cnt0][cnt1][cnt2] != -1)) return memo3[last][cnt0][cnt1][cnt2]; long ans = 0; if ( ((cnt0 > 0) && (last != 0))) ans += dp3((cnt0 - 1),cnt1,cnt2,0); if ( ((cnt1 > 0) && (last != 1))) ans += dp3(cnt0,(cnt1 - 1),cnt2,1); if ( ((cnt2 > 0) && (last != 2))) ans += dp3(cnt0,cnt1,(cnt2 - 1),2); return memo3[last][cnt0][cnt1][cnt2] = (int)(ans % MOD);} public static void main( String[] args)throws IOException { Scanner sc = new Scanner();  PrintWriter out = new PrintWriter(System.out); n = sc.nextInt(); int[] fac = new int[(n + 1)]; t = new int[n]; g = new int[n]; int[] cnt = new int[3]; fac[0] = 1; for ( int i = 1;(i <= n);i++) fac[i] = (int)(((i * 1L) * fac[(i - 1)]) % MOD); int T = sc.nextInt(); for ( int i = 0;(i < n);i++) {t[i] = sc.nextInt(); g[i] = (sc.nextInt() - 1); cnt[g[i]]++; }memo1 = new int[n][(cnt[0] + 1)][(T + 1)]; memo2 = new int[n][(cnt[1] + 1)][(cnt[2] + 1)][(T + 1)]; memo3 = new int[4][(cnt[0] + 1)][(cnt[1] + 1)][(cnt[2] + 1)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= cnt[0]);j++) Arrays.fill(memo1[i][j],-1); for ( int j = 0;(j <= cnt[1]);j++) for ( int k = 0;(k <= cnt[2]);k++) Arrays.fill(memo2[i][j][k],-1); }for ( int i = 0;(i < 4);i++) for ( int j = 0;(j <= cnt[0]);j++) for ( int k = 0;(k <= cnt[1]);k++) Arrays.fill(memo3[i][j][k],-1); int ans = 0; for ( int cnt0 = 0;(cnt0 <= cnt[0]);cnt0++) for ( int sum0 = 0;(sum0 <= T);sum0++) for ( int cnt1 = 0;(cnt1 <= cnt[1]);cnt1++) for ( int cnt2 = 0;(cnt2 <= cnt[2]);cnt2++) { long ways = (((dp1(0,cnt0,sum0) * 1L) * dp2(0,cnt1,cnt2,(T - sum0))) % MOD); ways = ((ways * dp3(cnt0,cnt1,cnt2,3)) % MOD); ways *= fac[cnt0]; ways %= MOD; ways *= fac[cnt1]; ways %= MOD; ways *= fac[cnt2]; ways %= MOD; ans += ways; if ( (ans >= MOD)) ans -= MOD; }out.println(ans); out.close(); } static class Scanner{ BufferedReader br ; StringTokenizer st ; Scanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } Scanner( String fileName)throws FileNotFoundException{ br = new BufferedReader(new FileReader(fileName)); } String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(br.readLine()); return st.nextToken();} int nextInt()throws IOException { return Integer.parseInt(next());} boolean ready()throws IOException { return br.ready();} } }
4	public class GG{ public static void main( String[] args){ FastScanner scanner = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int N = scanner.nextInt();  int M = scanner.nextInt();  int K = scanner.nextInt();  int C = scanner.nextInt();  int D = scanner.nextInt();  MinCostMaxFlowSolver solver = new EdmondsKarp();  int[] people = new int[K]; for ( int i = 0;(i < K);i++) people[i] = (scanner.nextInt() - 1); Node src = solver.addNode();  Node snk = solver.addNode();  int amt = 150;  Node[][] timeNodes = new Node[N][amt]; for ( int i = 0;(i < N);i++) {for ( int j = 1;(j < amt);j++) {timeNodes[i][j] = solver.addNode(); if ( (j > 1)) solver.link(timeNodes[i][(j - 1)],timeNodes[i][j],Integer.MAX_VALUE,0); }}for ( int i = 0;(i < K);i++) {solver.link(src,timeNodes[people[i]][1],1,0); }for ( int i = 1;(i < amt);i++) {for ( int j = 0;(j < K);j++) {solver.link(timeNodes[0][i],snk,1,((C * i) - C)); }}for ( int i = 0;(i < M);i++) { int a = (scanner.nextInt() - 1);  int b = (scanner.nextInt() - 1); for ( int j = 1;(j < (amt - 1));j++) { int prev = 0; for ( int k = 1;(k <= K);k++) {solver.link(timeNodes[a][j],timeNodes[b][(j + 1)],1,(((D * k) * k) - prev)); solver.link(timeNodes[b][j],timeNodes[a][(j + 1)],1,(((D * k) * k) - prev)); prev = ((D * k) * k); }}} long[] ret = solver.getMinCostMaxFlow(src,snk); out.println(ret[1]); out.flush(); } public static class Node{ private Node(){ } List<Edge> edges = new ArrayList<Edge>(); int index ; } public static class Edge{ boolean forward ; Node from ,to ; long flow ; final long capacity ; Edge dual ; long cost ; protected Edge( Node s, Node d, long c, boolean f){ forward = f; from = s; to = d; capacity = c; } void addFlow( long amount){ flow += amount; dual.flow -= amount; } } static class EdmondsKarp extends MinCostMaxFlowSolver{ EdmondsKarp(){ this(0); } EdmondsKarp( int n){ super(n); } long minCost ; @Override public long[] getMinCostMaxFlow( Node src, Node snk){ long maxflow = getMaxFlow(src,snk); return new long[]{maxflow,minCost};} static final long INF = (Long.MAX_VALUE / 4); @Override public long getMaxFlow( Node src, Node snk){ final int n = nodes.size(); final int source = src.index; final int sink = snk.index;  long flow = 0;  long cost = 0;  long[] potential = new long[n]; while(true){ Edge[] parent = new Edge[n];  long[] dist = new long[n]; Arrays.fill(dist,INF); dist[source] = 0; PriorityQueue<Item> que = new PriorityQueue<Item>(); que.add(new Item(0,source)); while(!que.isEmpty()){ Item item = que.poll(); if ( (item.dist != dist[item.v])) continue; for ( Edge e :nodes.get(item.v).edges) { long temp = (((dist[item.v] + e.cost) + potential[item.v]) - potential[e.to.index]); if ( ((e.capacity > e.flow) && (dist[e.to.index] > temp))) {dist[e.to.index] = temp; parent[e.to.index] = e; que.add(new Item(temp,e.to.index)); } }}if ( (parent[sink] == null)) break; for ( int i = 0;(i < n);i++) if ( (parent[i] != null)) potential[i] += dist[i];  long augFlow = Long.MAX_VALUE; for ( int i = sink;(i != source);i = parent[i].from.index) augFlow = Math.min(augFlow,(parent[i].capacity - parent[i].flow)); for ( int i = sink;(i != source);i = parent[i].from.index) { Edge e = parent[i]; e.addFlow(augFlow); cost += (augFlow * e.cost); }flow += augFlow; }minCost = cost; return flow;} static class Item implements Comparable<Item>{ long dist ; int v ; public Item( long dist, int v){ this.dist = dist; this.v = v; } } } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( Reader in){ br = new BufferedReader(in); } public FastScanner(){ this(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
6	public class DarkAssembly extends Thread{ public DarkAssembly(){ this.input = new BufferedReader(new InputStreamReader(System.in)); this.output = new PrintWriter(System.out); this.setPriority(Thread.MAX_PRIORITY); } class Senator{ int loyalty ; int level ; public Senator( int level, int loyalty){ this.level = level; this.loyalty = loyalty; } } static private double doIt( Senator[] senators, int A){ double probability = .0; for ( int mask = 0;(mask < (1 << senators.length));++mask) { int sum = A;  double current = 1.0; for ( int i = 0;(i < senators.length);++i) {if ( ((mask & (1 << i)) != 0)) {current *= (.01 * senators[i].loyalty); } else {current *= (.01 * (100 - senators[i].loyalty)); sum += senators[i].level; }}if ( (getOnes(mask) > (senators.length / 2))) {probability += current; } else {probability += ((current * (double)A) / sum); }}return probability;} static private double go( Senator[] senators, int candies, int A, int current){ if ( (current == senators.length)) {return doIt(senators,A);} else { double result = go(senators,candies,A,(current + 1)); if ( ((candies > 0) && (senators[current].loyalty < 100))) {senators[current].loyalty += 10; result = Math.max(result,go(senators,(candies - 1),A,current)); senators[current].loyalty -= 10; } return result;}} static int getOnes( int mask){ int result = 0; while((mask != 0)){mask &= (mask - 1); ++result; }return result;} public static void main( String[] args){ new DarkAssembly().start(); } private String nextToken()throws IOException { while(((tokens == null) || !tokens.hasMoreTokens())){tokens = new StringTokenizer(input.readLine()); }return tokens.nextToken();} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} private BufferedReader input ; private PrintWriter output ; private StringTokenizer tokens = null; }
4	public class OnTheBenchAlt{ public static void main( String[] args){ setupCombo(301); FastScanner sc = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int N = sc.nextInt();  long[] a = new long[N];  HashMap<Long,Integer> clusters = new HashMap<>(); for ( int i = 0;(i < N);i++) {a[i] = removeSquares(sc.nextLong()); clusters.merge(a[i],1,Integer::sum); } int G = clusters.size();  int[] groups = new int[(G + 1)];  int ptr = 1; for ( int amt :clusters.values()) {groups[ptr++] = amt; } long[][] dp = new long[(G + 1)][(N + 1)]; dp[0][0] = 1; int total = 0; for ( int prefix = 1;(prefix <= G);prefix++) { int amt = groups[prefix]; for ( int prevBad = 0;(prevBad <= max(0,(total - 1)));prevBad++) {for ( int fixed = 0;(fixed <= min(prevBad,amt));fixed++) {for ( int slots = max(1,fixed);(slots <= min(amt,(total + 1)));slots++) { int introduced = (amt - slots);  long ways = mult(choose[prevBad][fixed],choose[((total + 1) - prevBad)][(slots - fixed)],choose[(amt - 1)][(slots - 1)],fact[amt],dp[(prefix - 1)][prevBad]);  int currBad = ((prevBad + introduced) - fixed); dp[prefix][currBad] = ((dp[prefix][currBad] + ways) % mod); }}}total += amt; }out.println(dp[G][0]); out.close(); } static long mod = ((long)1e9 + 7); static long[][] choose ; static long[] fact ; static long removeSquares( long x){ long curr = x; for ( long v = 2;(((v * v) <= x) && (curr > 1));v++) { int cnt = 0; while(((curr % v) == 0)){curr /= v; cnt ^= 1; }if ( (cnt == 1)) curr *= v; }return curr;} static long mult( long... multiplicands){ long ans = 1; for ( long v :multiplicands) {ans = ((ans * v) % mod); }return ans;} static void setupCombo( int MAX){ choose = new long[(MAX + 1)][(MAX + 1)]; fact = new long[(MAX + 1)]; choose[0][0] = 1; fact[0] = 1; for ( int i = 1;(i <= MAX);i++) {fact[i] = (((long)i * fact[(i - 1)]) % mod); choose[i][0] = 1; for ( int j = 1;(j < i);j++) {choose[i][j] = ((choose[(i - 1)][(j - 1)] + choose[(i - 1)][j]) % mod); }choose[i][i] = 1; }} static class FastScanner{ private int BS = (1 << 16); private char NC = (char)0; private byte[] buf = new byte[BS]; private int bId = 0,size = 0; private char c = NC; private double cnt = 1; private BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } private char getChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ cnt = 1; boolean neg = false; if ( (c == NC)) c = getChar(); for ( ;((c < '0') || (c > '9'));c = getChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = getChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); cnt *= 10; }return (neg?-res:res);} public double nextDouble(){ double cur = nextLong(); return ((c != '.')?cur:(cur + (nextLong() / cnt)));} } }
6	public class Main{ static int t ,m ,mod = 998244353,maxn = 1000000,q ,n ,k ; static int INF = (int)1e8; void solve( PrintWriter out, Reader in)throws IOException { n = in.nextInt(); m = in.nextInt(); String str = in.next();  int[][] pre = new int[(1 << m)][m];  int child = 0,head ,child2 = 0; for ( int i = 0;(i < n);i++) {if ( (i != 0)) child = (1 << (str.charAt((i - 1)) - 'a')); if ( (i != (n - 1))) child2 = (1 << (str.charAt((i + 1)) - 'a')); head = (str.charAt(i) - 'a'); if ( (i != 0)) pre[child][head]++; if ( (i != (n - 1))) pre[child2][head]++; } int rmv = 0; for ( int i = 0;(i < m);i++) {head = i; for ( int j = 1;(j < (1 << m));j++) {if ( (pre[j][i] != 0)) continue; rmv = (j - (j & -j)); pre[j][head] = (pre[rmv][head] + pre[(j ^ rmv)][head]); }} int[] dp = new int[(1 << m)]; for ( int i = 1;(i < (1 << m));i++) dp[i] = INF; int bit = 0,full = ((1 << m) - 1),cnt = 0; for ( int j = 1;(j < (1 << m));j++) {for ( int i = 0;(i < m);i++) {if ( (((1 << i) & j) != 0)) {bit = (1 << i); cnt = cnt(j); dp[j] = Math.min(dp[j],((dp[(j ^ bit)] + (pre[(j ^ bit)][i] * cnt)) - (pre[(j ^ full)][i] * cnt))); } }}out.println(dp[full]); } static int cnt( int x){ int res = 0; while((x > 0)){res += (x & 1); x >>= 1; }return res;} static class Reader{ private InputStream mIs ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; public Reader(){ this(System.in); } public Reader( InputStream is){ mIs = is; } public int read(){ if ( (numChars == -1)) {throw (new InputMismatchException());} if ( (curChar >= numChars)) {curChar = 0; try{numChars = mIs.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) {return -1;} } return buf[curChar++];} 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 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 boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public boolean isEndOfLine( int c){ return (((c == '\n') || (c == '\r')) || (c == -1));} } public static void main( String[] args)throws IOException { PrintWriter out = new PrintWriter(System.out);  Reader in = new Reader();  Main solver = new Main(); solver.solve(out,in); out.flush(); out.close(); } }
0	public class Main{ public static void main( String[] args)throws FileNotFoundException { Scanner in = new Scanner(System.in);  PrintWriter out = new PrintWriter(System.out);  int n = in.nextInt(); if ( ((n % 2) == 0)) {System.out.println(((4 + " ") + (n - 4))); } else {System.out.println(((9 + " ") + (n - 9))); }in.close(); out.close(); } }
3	public class C{ static double ycoord( double xi, double yi, double xj, double r){ if ( (Math.abs((xi - xj)) > (2 * r))) return r; double dist = Math.sqrt((((4 * r) * r) - ((xi - xj) * (xi - xj)))); return Math.max((yi + dist),r);} public static void main( String[] args)throws Exception { FastScanner sc = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int n = sc.nextInt();  double r = sc.nextInt();  double[] xcoords = new double[n];  double[] ycoords = new double[n]; Arrays.fill(ycoords,Integer.MIN_VALUE); ycoords[0] = r; for ( int i = 0;(i < n);i++) {xcoords[i] = sc.nextDouble(); }System.out.print((r + " ")); for ( int i = 1;(i < n);++i) {for ( int j = 0;(j < i);j++) {ycoords[i] = Math.max(ycoord(xcoords[j],ycoords[j],xcoords[i],r),ycoords[i]); }System.out.print((ycoords[i] + " ")); }out.flush(); } static class FastScanner{ public BufferedReader reader ; public StringTokenizer tokenizer ; public FastScanner(){ reader = new BufferedReader(new InputStreamReader(System.in),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());} public double nextDouble(){ return Double.parseDouble(next());} } }
4	public class G{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni(),m = ni(),K = ni(),C = ni(),D = ni();  int[] a = na(K);  int[] from = new int[m];  int[] to = new int[m]; for ( int i = 0;(i < m);i++) {from[i] = (ni() - 1); to[i] = (ni() - 1); } int[][] g = packU(n,from,to);  List<Edge> es = new ArrayList<>();  int time = 100; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < (time - 1));j++) {es.add(new Edge(((i * time) + j),(((i * time) + j) + 1),99,C)); }}for ( int i = 0;(i < n);i++) {for ( int e :g[i]) {for ( int j = 0;(j < (time - 1));j++) {for ( int k = 0;(k < n);k++) {es.add(new Edge(((i * time) + j),(((e * time) + j) + 1),1,(C + (D * ((2 * k) + 1))))); }}}} int src = (time * n),sink = (src + 1); for ( int i = 0;(i < K);i++) {es.add(new Edge(src,(((a[i] - 1) * time) + 0),1,0)); }for ( int i = 0;(i < time);i++) {es.add(new Edge(((0 * time) + i),sink,99,0)); }out.println(solveMinCostFlowWithSPFA(compileWD((sink + 1),es),src,sink,99)); } public static class Edge{ public int from ,to ; public int capacity ; public int cost ; public int flow ; public Edge complement ; public Edge( int from, int to, int capacity, int cost){ this.from = from; this.to = to; this.capacity = capacity; this.cost = cost; } } public static Edge[][] compileWD( int n, List<Edge> edges){ Edge[][] g = new Edge[n][]; for ( int i = (edges.size() - 1);(i >= 0);i--) { Edge origin = edges.get(i);  Edge clone = new Edge(origin.to,origin.from,origin.capacity,-origin.cost); clone.flow = origin.capacity; clone.complement = origin; origin.complement = clone; edges.add(clone); } int[] p = new int[n]; for ( Edge e :edges) p[e.from]++; for ( int i = 0;(i < n);i++) g[i] = new Edge[p[i]]; for ( Edge e :edges) g[e.from][--p[e.from]] = e; return g;} public static class DQ{ public int[] q ; public int n ; protected int pt ,ph ; public DQ( int n){ this.n = (Integer.highestOneBit(n) << 1); q = new int[this.n]; pt = ph = 0; } public void addLast( int x){ q[ph] = x; ph = ((ph + 1) & (n - 1)); } public int pollFirst(){ int ret = q[pt]; pt = ((pt + 1) & (n - 1)); return ret;} public int size(){ return (((ph - pt) + n) & (n - 1));} public boolean isEmpty(){ return (ph == pt);} } public static long solveMinCostFlowWithSPFA( Edge[][] g, int source, int sink, long all){ int n = g.length;  long mincost = 0; final int[] d = new int[n];  DQ q = new DQ(n);  boolean[] inq = new boolean[n]; while((all > 0)){ Edge[] inedge = new Edge[n]; Arrays.fill(d,(Integer.MAX_VALUE / 2)); d[source] = 0; q.addLast(source); while(!q.isEmpty()){ int cur = q.pollFirst(); inq[cur] = false; for ( Edge ne :g[cur]) {if ( ((ne.capacity - ne.flow) > 0)) { int nd = (d[cur] + ne.cost); if ( (d[ne.to] > nd)) {inedge[ne.to] = ne; d[ne.to] = nd; if ( !inq[ne.to]) {q.addLast(ne.to); inq[ne.to] = true; } } } }}if ( (inedge[sink] == null)) break; long minflow = all;  long sumcost = 0; for ( Edge e = inedge[sink];(e != null);e = inedge[e.from]) {if ( ((e.capacity - e.flow) < minflow)) minflow = (e.capacity - e.flow); sumcost += e.cost; }mincost += (minflow * sumcost); for ( Edge e = inedge[sink];(e != null);e = inedge[e.from]) {e.flow += minflow; e.complement.flow -= minflow; }all -= minflow; }return mincost;} static int[][] packU( int n, int[] from, int[] to){ int[][] g = new int[n][];  int[] p = new int[n]; for ( int f :from) p[f]++; for ( int t :to) p[t]++; for ( int i = 0;(i < n);i++) g[i] = new int[p[i]]; for ( int i = 0;(i < from.length);i++) {g[from[i]][--p[from[i]]] = to[i]; g[to[i]][--p[to[i]]] = from[i]; }return g;} 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 G().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
6	public class E implements Runnable{ public static void main( String[] args){ new Thread(null,new E(),"_cf",(1 << 28)).start(); } int n ,m ; char[] str ; int[][] occs ,cost ; int[] dp ; int oo = (int)1e9; int min( int a, int b){ if ( (a < b)) return a; return b;} class FastScanner{ public int BS = (1 << 16); public char NC = (char)0; byte[] buf = new byte[BS]; int bId = 0,size = 0; char c = NC; double num = 1; BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } public char nextChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long nextLong(){ num = 1; boolean neg = false; if ( (c == NC)) c = nextChar(); for ( ;((c < '0') || (c > '9'));c = nextChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = nextChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); num *= 10; }return (neg?-res:res);} public String next(){ StringBuilder res = new StringBuilder(); while((c <= 32))c = nextChar(); while((c > 32)){res.append(c); c = nextChar(); }return res.toString();} } }
4	public class Main{ static final int primeCount = 452; static final int[] prime = new int[primeCount]; static void build_prime(){ boolean[] notPrime = new boolean[3200]; for ( int i = 2;(i < 3200);i++) {if ( notPrime[i]) continue; for ( int j = (i * i);(j < 3200);j += i) {notPrime[j] = true; }} int count = 0; for ( int i = 2;(i < 3200);i++) {if ( notPrime[i]) continue; prime[count++] = i; }} static private void run( Reader in, PrintWriter out)throws IOException { int n = in.nextInt();  int m = in.nextInt();  int[] a = new int[n]; for ( int i = 0;(i < n);i++) {a[i] = getReal(in.nextInt()); } int[] pre = new int[n]; for ( int i = 0;(i < n);i++) pre[i] = -1; TreeMap<Integer,Integer> exist = new TreeMap<>(); for ( int i = 0;(i < n);i++) { Integer result = exist.get(a[i]); if ( (result != null)) {pre[i] = result; } exist.put(a[i],i); } int[][] left = new int[(m + 1)][n]; for ( int i = 0;(i <= m);i++) { int start = 0;  PriorityQueue<Integer> inSame = new PriorityQueue<>(); for ( int j = 0;(j < n);j++) {if ( (pre[j] >= start)) {inSame.add(pre[j]); if ( (inSame.size() > i)) {start = (inSame.poll() + 1); } } left[i][j] = start; }} int[][] dp = new int[n][(m + 1)]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= m);j++) {if ( (j == 0)) dp[i][0] = Integer.MAX_VALUE; else dp[i][j] = dp[i][(j - 1)]; for ( int k = 0;(k <= j);k++) {if ( (left[k][i] == 0)) {dp[i][j] = 1; } else {dp[i][j] = Math.min(dp[i][j],(dp[(left[k][i] - 1)][(j - k)] + 1)); }}}}out.println(dp[(n - 1)][m]); } static int getReal( int x){ int result = 1; for ( int i = 0;(i < primeCount);i++) {if ( ((x % prime[i]) == 0)) { int count = 0; while(((x % prime[i]) == 0)){count++; x /= prime[i]; }if ( ((count % 2) == 1)) {result *= prime[i]; } } }result *= x; return result;} public static void main( String[] args)throws IOException { Reader in = new Reader(new InputStreamReader(System.in));  PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out)); build_prime(); int t = in.nextInt(); for ( int i = 0;(i < t);i++) {run(in,out); }out.flush(); in.close(); out.close(); } static class Reader{ BufferedReader reader ; StringTokenizer st ; Reader( InputStreamReader stream){ reader = new BufferedReader(stream,32768); st = null; } void close()throws IOException { reader.close(); } String next(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(reader.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} } }
6	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);  TaskB solver = new TaskB(); solver.solve(1,in,out); out.close(); } } class TaskB{ private double[][][] dp ; private int n ; private int k ; private int[] loyalty ; private int[] level ; double[] P ; private int a ; public void solve( int testNumber, InputReader in, PrintWriter out){ n = in.nextInt(); k = in.nextInt(); a = in.nextInt(); level = new int[n]; loyalty = new int[n]; for ( int i = 0;(i < n);++i) {level[i] = in.nextInt(); loyalty[i] = in.nextInt(); }P = new double[(1 << n)]; for ( int mask = 0;(mask < (1 << n));++mask) {if ( ((Integer.bitCount(mask) * 2) > n)) {P[mask] = 1.; } else { double sumB = 0; for ( int i = 0;(i < n);++i) {if ( !BitUtils.checkBit(mask,i)) {sumB += level[i]; } }P[mask] = ((double)a / (sumB + a)); }}dp = new double[(1 << n)][(n + 1)][(k + 1)]; ArrayUtils.fill(dp,-1); newLoyalty = new int[n]; brute(0,k); out.println(best); } int[] newLoyalty ; double best = 0; void brute( int id, int leftCandies){ if ( (id == n)) { double cur = calcCur(); if ( (best < cur)) {best = cur; } return ;} for ( int candies = 0;(candies <= leftCandies);++candies) {newLoyalty[id] = (loyalty[id] + (candies * 10)); if ( (newLoyalty[id] > 100)) {break;} brute((id + 1),(leftCandies - candies)); }} private double calcCur(){ double sum = 0; for ( int mask = 0;(mask < (1 << n));++mask) { double p = (getP(mask) * P[mask]); sum += p; }return sum;} private double getP( int mask){ double p = 1; for ( int i = 0;(i < n);++i) {if ( BitUtils.checkBit(mask,i)) {p *= ((newLoyalty[i] * 1.) / 100.); } else {p *= ((100. - newLoyalty[i]) / 100.); }}return p;} } class InputReader{ private BufferedReader reader ; private StringTokenizer stt ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); } public String nextLine(){ try{return reader.readLine().trim(); }catch (IOException e){ return null;} } public String nextString(){ while(((stt == null) || !stt.hasMoreTokens())){stt = new StringTokenizer(nextLine()); }return stt.nextToken();} public int nextInt(){ return Integer.parseInt(nextString());} }
2	public class Template{ public static void main( String[] args)throws IOException { st = new StringTokenizer(rd.readLine()); n = Long.parseLong(st.nextToken()); m = Long.parseLong(st.nextToken()); k = Long.parseLong(st.nextToken()); long s = (n - m); s = Math.min(s,(m / (k - 1))); s = Math.min(s,(n / k)); long score = 0; score = ((s * (k - 1)) % P); long n1 = (n - (k * s)),m1 = (m - ((k - 1) * s)); sc = 0; if ( (m1 == n1)) {score = ((score + full(m1)) % P); System.out.println(score); return ;} score = ((score + m1) % P); System.out.println(score); } static long full( long N){ long x = (N / k),r = (N - (x * k));  long powTwo = ((powMod(2,(x + 1)) - 2) + (2 * P)); powTwo %= P; powTwo = ((powTwo * k) % P); powTwo = ((powTwo + r) % P); return powTwo;} static long sc = 0; static void rec( long N, long M){ if ( (N == M)) {sc = ((sc + full(N)) % P); return ;} if ( ((N >= k) && (M >= (k - 1)))) {sc = ((sc + (k - 1)) % P); rec((N - k),(M - (k - 1))); return ;} sc = ((sc + M) % P); } static long powMod( long a, long p){ if ( (p == 0)) return 1L; long h = powMod(a,(p >> 1)); h = ((h * h) % P); return (((p % 2) == 0)?h:((a * h) % P));} static long n ,m ,k ; static long P = 1000000009; static StringTokenizer st ; static BufferedReader rd = new BufferedReader(new InputStreamReader(System.in)); static PrintWriter pw = new PrintWriter(System.out); }
0	public class A{ public static void main( String[] args){ FastScanner scn = new FastScanner();  int n = scn.nextInt();  int s = scn.nextInt(); if ( (s <= n)) {System.out.println(1); } else if ( (s > n)) {if ( ((s % n) == 0)) {System.out.println((s / n)); } else {System.out.println(((s / n) + 1)); }} } public static class FastScanner{ BufferedReader br ; StringTokenizer st ; public FastScanner( String s){ try{br = new BufferedReader(new FileReader(s)); }catch (FileNotFoundException e){ 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){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(nextToken());} } }
2	public class B{ static PrintWriter out = new PrintWriter(System.out); static FS in ; static int N ; static final boolean debug = false; static int inp[] = new int[]{1,2,3,2,1,0}; public static void main( String[] args){ in = new FS(); if ( !debug) N = in.nextInt(); else N = inp.length; int x = solve(0,((N / 2) - 1),(N / 2),(N - 1)); out.println(("! " + (x + 1))); out.flush(); out.close(); } static int solve( int l1, int r1, int l2, int r2){ int sz = ((r1 - l1) + 1); if ( (sz <= 0)) return -2; int a1 = query(l1);  int a2 = query(l2); if ( (a1 == a2)) return l1; if ( (sz == 1)) return -2; int b1 = query((l1 + (sz / 2)));  int b2 = query((l2 + (sz / 2))); if ( (b1 == b2)) return (l1 + (sz / 2)); if ( (sz == 2)) return -2; int d1 = (a2 - a1);  int d2 = (b2 - b1); if ( (((d1 < 0) && (d2 > 0)) || ((d1 > 0) && (d2 < 0)))) {return solve((l1 + 1),((l1 + (sz / 2)) - 1),(l2 + 1),((l2 + (sz / 2)) - 1));} else {return solve(((l1 + (sz / 2)) + 1),r1,((l2 + (sz / 2)) + 1),r2);}} static int query( int a){ out.println(("? " + (a + 1))); out.flush(); if ( debug) return inp[a]; else return in.nextInt();} static class FS{ BufferedReader br ; StringTokenizer st ; public FS(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (Exception e){ throw (null);} }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  TaskC solver = new TaskC(); solver.solve(1,in,out); out.close(); } static class TaskC{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.readInt();  int r = in.readInt();  int[] x = in.readIntArray(n);  double[] y = new double[n]; y[0] = r; for ( int i = 1;(i < n);i++) { double max = r; for ( int j = 0;(j < i);j++) { double pow = Math.pow((x[i] - x[j]),2); if ( (pow <= ((4 * r) * r))) { double ty = (y[j] + Math.sqrt((((4 * r) * r) - pow))); max = Math.max(max,ty); } }y[i] = max; }for ( double i :y) out.print((i + " ")); } } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputReader.SpaceCharFilter filter ; 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 boolean isSpaceChar( int c){ if ( (filter != null)) return filter.isSpaceChar(c); return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public int[] readIntArray( int size){ int[] ans = new int[size]; for ( int i = 0;(i < size);i++) ans[i] = readInt(); return ans;} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } }
2	public class code{ public static void main( String[] args)throws Exception { Scanner sc = new Scanner(System.in);  int q = sc.nextInt();  long[] d = new long[30]; d[0] = 1; for ( int i = 1;(i < 30);i++) d[i] = (d[(i - 1)] * 4); for ( int z = 0;(z < q);z++) { long r = 0;  long n = sc.nextLong();  long k = sc.nextLong();  long c = 1; while(((k > 0) && (n >= 1))){if ( (k <= r)) {k = 0; break;} n--; k -= c; if ( (k <= 0)) break; if ( (n > 30)) {k = 0; break;} for ( int i = 0;(i < (int)n);i++) {r += (d[i] * ((c * 2) - 1)); if ( (k <= r)) {k = 0; break;} }if ( (k <= r)) {k = 0; break;} c *= 2; c++; }if ( (k == 0)) System.out.println(("YES " + n)); else System.out.println("NO"); }} }
3	public class c{ public static void main( String[] args)throws Exception { new c(new Reader()); } public c( Reader rr)throws IOException{ int n = rr.ni();  double r = rr.nd();  HashMap<Integer,Double> disk = new HashMap<Integer,Double>(); for ( int i = 0;(i < n);i++) { int next = rr.ni(); if ( disk.isEmpty()) {disk.put(next,r); System.out.print((r + " ")); } else { double high = r; for ( Map.Entry<Integer,Double> it :disk.entrySet()) {if ( ((2 * r) < (next - it.getKey()))) continue; double tempHigh = (pyth(Math.abs((next - it.getKey())),(r * 2)) + it.getValue()); if ( (tempHigh > high)) {high = tempHigh; } }disk.put(next,high); System.out.print((high + " ")); }}} public double pyth( double a, double c){ return Math.sqrt((Math.pow(c,2) - Math.pow(a,2)));} static class Reader{ private DataInputStream din ; private byte[] buffer = new byte[1024]; private int bufP ,bytR ; public Reader()throws IOException{ din = new DataInputStream(System.in); bufP = bytR = 0; } public Reader( String file)throws IOException{ din = new DataInputStream(new FileInputStream(file)); bufP = bytR = 0; } private int ni()throws IOException { int num = 0;  byte c = read(); while((c <= ' '))c = read(); boolean neg = (c == '-'); if ( neg) c = read(); do {num = (((num * 10) + c) - '0'); }while((((c = read()) >= '0') && (c <= '9')));if ( neg) return -num; return num;} private double nd()throws IOException { return Double.parseDouble(ns());} private String ns()throws IOException { int c = next();  StringBuilder sb = new StringBuilder(); while(!isChar(c)){sb.appendCodePoint(c); c = read(); }return sb.toString();} private char[] ns( int n)throws IOException { char[] buf = new char[n];  int c = next(),r = 0; while(((r < n) && !isChar(c))){buf[r++] = (char)c; c = next(); }return ((n == r)?buf:Arrays.copyOf(buf,r));} private boolean isChar( int c)throws IOException { return ((c >= 33) && (c <= 126));} private int next()throws IOException { int c ; while((((c = read()) != -1) && isChar(c)));return c;} private byte read()throws IOException { if ( (bufP == bytR)) {bytR = din.read(buffer,bufP = 0,1024); if ( (bytR == -1)) buffer[0] = -1; } return buffer[bufP++];} public void close()throws IOException { if ( (din == null)) return ; din.close(); } } }
0	public class A{ BufferedReader in ; StringTokenizer st ; PrintWriter out ; String next()throws IOException { while(((st == null) || !st.hasMoreTokens()))st = new StringTokenizer(in.readLine()); return st.nextToken();} int nextInt()throws Exception { return Integer.parseInt(next());} void solve()throws Exception { int n = nextInt(); if ( ((n % 2) == 0)) out.println(("4 " + (n - 4))); else out.println(("9 " + (n - 9))); } void run(){ try{Locale.setDefault(Locale.US); in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(new OutputStreamWriter(System.out)); solve(); out.close(); }catch (Exception e){ e.printStackTrace(); System.exit(1); } } public static void main( String[] args){ new A().run(); } }
4	public class CF1187G extends PrintWriter{ CF1187G(){ super(System.out); } static class Scanner{ Scanner( InputStream in){ this.in = in; } InputStream in ; int k ,l ; byte[] bb = new byte[(1 << 15)]; byte getc(){ if ( (k >= l)) {k = 0; try{l = in.read(bb); }catch (IOException e){ l = 0; } if ( (l <= 0)) return -1; } return bb[k++];} int nextInt(){ byte c = 0; while((c <= 32))c = getc(); int a = 0; while((c > 32)){a = (((a * 10) + c) - '0'); c = getc(); }return a;} } Scanner sc = new Scanner(System.in); public static void main( String[] $){ CF1187G o = new CF1187G(); o.main(); o.flush(); } static final int INF = 0x3f3f3f3f; ArrayList[] aa_ ; int n_ ,m_ ; int[] pi ,bb ; int[] uu ,vv ,uv ,cost ; int[] cc ; void init(){ aa_ = new ArrayList[n_]; for ( int u = 0;(u < n_);u++) aa_[u] = new ArrayList<Integer>(); pi = new int[n_]; bb = new int[n_]; qq = new int[nq]; iq = new boolean[n_]; uu = new int[m_]; vv = new int[m_]; uv = new int[m_]; cost = new int[m_]; cc = new int[(m_ * 2)]; m_ = 0; } void link( int u, int v, int cap, int cos){ int h = m_++; uu[h] = u; vv[h] = v; uv[h] = (u ^ v); cost[h] = cos; cc[((h << 1) ^ 0)] = cap; aa_[u].add(((h << 1) ^ 0)); aa_[v].add(((h << 1) ^ 1)); } int[] qq ; int nq = (1 << 20),head ,cnt ; boolean[] iq ; void enqueue( int v){ if ( iq[v]) return ; if ( ((head + cnt) == nq)) {if ( ((cnt * 2) <= nq)) System.arraycopy(qq,head,qq,0,cnt); else { int[] qq_ = new int[nq *= 2]; System.arraycopy(qq,head,qq_,0,cnt); qq = qq_; }head = 0; } qq[(head + cnt++)] = v; iq[v] = true; } int dequeue(){ int u = qq[head++]; cnt--; iq[u] = false; return u;} boolean spfa( int s, int t){ Arrays.fill(pi,INF); pi[s] = 0; head = cnt = 0; enqueue(s); while((cnt > 0)){ int u = dequeue();  ArrayList<Integer> adj = aa_[u]; for ( int h_ :adj) if ( (cc[h_] > 0)) { int h = (h_ >> 1);  int p = (pi[u] + (((h_ & 1) == 0)?cost[h]:-cost[h]));  int v = (u ^ uv[h]); if ( (pi[v] > p)) {pi[v] = p; bb[v] = h_; enqueue(v); } } }return (pi[t] != INF);} void push1( int s, int t){ for ( int u = t,h_ ,h ;(u != s);u ^= uv[h]) {h = ((h_ = bb[u]) >> 1); cc[h_]--; cc[(h_ ^ 1)]++; }} int edmonds_karp( int s, int t){ while(spfa(s,t))push1(s,t); int c = 0; for ( int h = 0;(h < m_);h++) c += (cost[h] * cc[((h << 1) ^ 1)]); return c;} void main(){ int n = sc.nextInt();  int m = sc.nextInt();  int k = sc.nextInt();  int c = sc.nextInt();  int d = sc.nextInt();  int[] ii = new int[k]; for ( int h = 0;(h < k);h++) ii[h] = (sc.nextInt() - 1); ArrayList[] aa = new ArrayList[n]; for ( int i = 0;(i < n);i++) aa[i] = new ArrayList<Integer>(); for ( int h = 0;(h < m);h++) { int i = (sc.nextInt() - 1);  int j = (sc.nextInt() - 1); aa[i].add(j); aa[j].add(i); } int t = ((n + k) + 1); n_ = ((n * t) + 1); m_ = (k + ((((m * 2) * k) + n) * (t - 1))); init(); for ( int i = 0;(i < n);i++) { ArrayList<Integer> adj = aa[i]; for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s); for ( int j :adj) { int v = (((j * t) + s) + 1); for ( int x = 1;(x <= k);x++) link(u,v,1,(c + (((x * 2) - 1) * d))); }}}for ( int i = 0;(i < n);i++) for ( int s = 0;(s < (t - 1));s++) { int u = ((i * t) + s),v = (u + 1); link(u,v,k,((i == 0)?0:c)); }for ( int h = 0;(h < k);h++) link((n_ - 1),((ii[h] * t) + 0),1,0); println(edmonds_karp((n_ - 1),(((0 * t) + t) - 1))); } }
0	public class A{ public static void main( String[] args)throws Exception { BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));  String l[] = bf.readLine().split(" "); System.out.println(25); } }
6	public class Main{ public static void main( String[] args)throws Exception { StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));  PrintWriter pw = new PrintWriter(System.out); in.nextToken(); int n = (int)in.nval;  double[][] a = new double[n][n]; for ( int i = 0;(i < n);i++) {for ( int j = 0;(j < n);j++) {in.nextToken(); a[i][j] = in.nval; }} double[] dp = new double[(1 << n)]; dp[((1 << n) - 1)] = 1.0; for ( int mask = ((1 << n) - 2);(mask > 0);mask--) { int count = Integer.bitCount(mask);  double pPair = (2.0 / ((double)count * (count + 1)));  double ans = 0.0; for ( int j = 0;(j < n);j++) { int jj = (1 << j); if ( ((jj & mask) != 0)) continue; double p = dp[(mask | jj)];  double s = 0; for ( int k = 0;(k < n);k++) { int kk = (1 << k); if ( ((kk & mask) == 0)) continue; s += a[k][j]; }ans += ((s * pPair) * p); }dp[mask] = ans; }for ( int i = 0;(i < n);i++) {pw.print(dp[(1 << i)]); pw.print(' '); }pw.close(); } }
4	public class D{ BufferedReader reader ; StringTokenizer tokenizer ; PrintWriter out ; public void solve()throws IOException { int N = nextInt();  int M = nextInt();  boolean[][] graph = new boolean[N][N]; for ( int i = 0;(i < M);i++) {graph[(nextInt() - 1)][(nextInt() - 1)] = true; } int best = Integer.MAX_VALUE; for ( int c = 0;(c < N);c++) { int withC = 0; for ( int i = 0;(i < N);i++) {if ( (i == c)) {if ( graph[c][i]) withC++; } else {if ( graph[c][i]) withC++; if ( graph[i][c]) withC++; }} int notC = (M - withC);  List<Integer>[] g = new List[N]; for ( int i = 0;(i < N);i++) {g[i] = new ArrayList<Integer>(); }for ( int i = 0;(i < N);i++) {if ( (i == c)) continue; for ( int j = 0;(j < N);j++) {if ( (j == c)) continue; if ( !graph[i][j]) continue; g[i].add(j); }} int glen = maxMatching(g,N);  int need = (((((2 * N) - 1) - withC) + (notC - glen)) + ((N - 1) - glen)); best = Math.min(best,need); }out.println(best); } static boolean findPath( List<Integer>[] g, int u1, int[] matching, boolean[] vis){ vis[u1] = true; for ( int v :g[u1]) { int u2 = matching[v]; if ( ((u2 == -1) || (!vis[u2] && findPath(g,u2,matching,vis)))) {matching[v] = u1; return true;} }return false;} public static int maxMatching( List<Integer>[] g, int n2){ int n1 = g.length;  int[] matching = new int[n2]; Arrays.fill(matching,-1); int matches = 0; for ( int u = 0;(u < n1);u++) {if ( findPath(g,u,matching,new boolean[n1])) ++matches; }return matches;} public static void main( String[] args){ new D().run(); } public void run(){ try{reader = new BufferedReader(new InputStreamReader(System.in)); tokenizer = null; out = new PrintWriter(System.out); solve(); reader.close(); out.close(); }catch (Exception e){ e.printStackTrace(); System.exit(1); } } int nextInt()throws IOException { return Integer.parseInt(nextToken());} String nextToken()throws IOException { while(((tokenizer == null) || !tokenizer.hasMoreTokens())){tokenizer = new StringTokenizer(reader.readLine()); }return tokenizer.nextToken();} }
4	public class C{ InputStream is ; PrintWriter out ; String INPUT = ""; void solve(){ int n = ni();  int[] a = na(n); for ( int i = 0;(i < n);i++) { int v = a[i]; for ( int j = 2;((j * j) <= v);j++) {while(((v % (j * j)) == 0)){v /= (j * j); }}a[i] = v; }Arrays.sort(a); int[] f = new int[n];  int p = 0; for ( int i = 0;(i < n);i++) {if ( ((i > 0) && (a[i] != a[(i - 1)]))) {p++; } f[p]++; }f = Arrays.copyOf(f,(p + 1)); int mod = 1000000007;  int[][] fif = enumFIF(1000,mod);  long[] res = countSameNeighborsSequence(f,fif,mod);  long ans = res[0]; for ( int v :f) {ans = ((ans * fif[0][v]) % mod); }out.println(ans); } public static int[][] enumFIF( int n, int mod){ int[] f = new int[(n + 1)];  int[] invf = new int[(n + 1)]; f[0] = 1; for ( int i = 1;(i <= n);i++) {f[i] = (int)(((long)f[(i - 1)] * i) % mod); } long a = f[n];  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)); }invf[n] = (int)((p < 0)?(p + mod):p); for ( int i = (n - 1);(i >= 0);i--) {invf[i] = (int)(((long)invf[(i + 1)] * (i + 1)) % mod); }return new int[][]{f,invf};} public static long[] countSameNeighborsSequence( int[] a, int[][] fif, int mod){ int all = 0; for ( int v :a) all += v; int len = 0;  long[] dp = new long[(all + 1)]; dp[0] = 1; for ( int v :a) { long[][] pre = new long[(all + 1)][(v + 1)]; for ( int j = 0;(j <= all);j++) pre[j][0] = dp[j]; for ( int j = 0;(j < v);j++) {for ( int k = 0;(k <= all);k++) {for ( int L = j;(L >= 0);L--) {if ( (pre[k][L] == 0)) continue; int ca = (2 * (j - L));  int ab = (((((len + j) + 1) - k) - ca) - L); if ( (ab < 0)) continue; if ( ((k - 1) >= 0)) {pre[(k - 1)][L] += (pre[k][L] * k); pre[(k - 1)][L] %= mod; } if ( ((L + 1) <= v)) {pre[k][(L + 1)] += (pre[k][L] * (ca + L)); pre[k][(L + 1)] %= mod; } pre[k][L] = ((pre[k][L] * ab) % mod); }}}Arrays.fill(dp,0); for ( int k = 0;(k <= all);k++) {for ( int L = 0;((L <= v) && ((k + L) <= all));L++) {dp[(k + L)] += pre[k][L]; }}for ( int k = 0;(k <= all);k++) {dp[k] %= mod; }len += v; } long fifs = 1; for ( int v :a) fifs = ((fifs * fif[1][v]) % mod); for ( int k = 0;(k <= all);k++) dp[k] = ((dp[k] * fifs) % mod); return dp;} 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 C().run(); } private byte[] inbuf = new byte[1024]; public 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 String ns(){ int b = skip();  StringBuilder sb = new StringBuilder(); while(!isSpaceChar(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 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 boolean oj = (System.getProperty("ONLINE_JUDGE") != null); private void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
4	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  OutputWriter out = new OutputWriter(outputStream);  SquareFreeDivisionHardVersion solver = new SquareFreeDivisionHardVersion(); solver.solve(1,in,out); out.close(); } static class SquareFreeDivisionHardVersion{ static final int MAX = 10000001; public void solve( int testNumber, InputReader in, OutputWriter out){ int t = in.nextInt();  int[] d = PrimesAndDivisors.generateDivisors(MAX);  int[] reduced = new int[MAX]; for ( int i = 1;(i < MAX);i++) { int val = i; reduced[i] = 1; while((val != 1)){ int prime = d[val],exponent = 0; while(((val % prime) == 0)){val /= prime; exponent ^= 1; }if ( (exponent > 0)) reduced[i] *= prime; }} int counter = 0;  int[] seen = new int[MAX]; for ( int jjjj = 0;(jjjj < t);jjjj++) { int n = in.nextInt(),k = in.nextInt();  int[] a = in.readIntArray(n); for ( int x :a) seen[reduced[x]] = -1; int[][] dp = new int[(n + 1)][(k + 1)];  TreeSet<Integer> ts = new TreeSet<>();  int num = 0; for ( int i = 0;(i < n);i++) { int R = reduced[a[i]]; if ( (seen[R] != -1)) {ts.add(-seen[R]); if ( (ts.size() > (k + 1))) ts.remove(ts.last()); num++; } Arrays.fill(dp[i],(n + 1)); for ( int j = num;(j <= k);j++) dp[i][j] = 1; seen[R] = i; int u = 0; for ( int r :ts) {for ( int j = u;(j <= k);j++) dp[i][j] = Integer.min(dp[i][j],(dp[-r][(j - u)] + 1)); u++; }}out.println(dp[(n - 1)][k]); }} } static class InputReader{ private InputStream stream ; private byte[] buf = new byte[1024]; private int curChar ; private int numChars ; private InputReader.SpaceCharFilter filter ; public InputReader( InputStream stream){ this.stream = stream; } public int[] readIntArray( int size){ int[] array = new int[size]; for ( int i = 0;(i < size);i++) {array[i] = readInt(); }return array;} 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 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 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 boolean isSpaceChar( int c){ if ( (filter != null)) {return filter.isSpaceChar(c);} return isWhitespace(c);} public static boolean isWhitespace( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} public interface SpaceCharFilter{ public boolean isSpaceChar( int ch); } } static class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void println( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) {writer.print(' '); } writer.print(objects[i]); }writer.print('\n'); } public void close(){ writer.close(); } } }
6	public class Main{ public static void main( String[] args)throws Exception { new Main().doWork(); } void doWork()throws Exception { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));  BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));  int ncase = Integer.valueOf(reader.readLine());  double[][] p = new double[ncase][]; for ( int icase = 0;(icase < ncase);icase++) {p[icase] = toDoubleArray(reader.readLine()); } double[] prob = new double[(1 << ncase)]; prob[0] = 1; for ( int x = 0;(x < (1 << ncase));x++) { double cp = prob[x];  int count = 0; for ( int i = 0;(i < ncase);i++) {if ( ((x & (1 << i)) != 0)) continue; count++; }if ( (count == 1)) continue; double np = (((cp * 2.0) / count) / (count - 1)); for ( int i = 0;(i < ncase);i++) {if ( ((x & (1 << i)) != 0)) continue; for ( int j = (i + 1);(j < ncase);j++) {if ( ((x & (1 << j)) != 0)) continue; prob[(x ^ (1 << j))] += (np * p[i][j]); prob[(x ^ (1 << i))] += (np * p[j][i]); }}} String out = ""; for ( int i = 0;(i < ncase);i++) {if ( (i > 0)) out += " ";  int index = (((1 << ncase) - 1) ^ (1 << i)); out += String.format("%.6f",prob[index]); }out += "\r\n"; writer.write(out,0,out.length()); writer.flush(); writer.close(); reader.close(); } double[] toDoubleArray( String line){ String[] p = line.split("[ ]+");  double[] out = new double[p.length]; for ( int i = 0;(i < p.length);i++) out[i] = Double.valueOf(p[i]); return out;} }
6	public class e{ int n ; double f[] ; double a[][] ; public void run(){ Locale.setDefault(Locale.US); Scanner in = new Scanner(System.in); n = in.nextInt(); a = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) a[i][j] = in.nextDouble(); f = new double[(1 << n)]; for ( int i = 0;(i < (1 << n));i++) f[i] = -1; f[((1 << n) - 1)] = 1.0; for ( int i = 0;(i < n);i++) System.out.print((doIt((1 << i)) + " ")); } private double doIt( int mask){ if ( (f[mask] >= 0)) return f[mask]; f[mask] = 0; double k = getBits(mask); k *= ((k - 1) / 2.0); for ( int i = 0;(i < n);i++) if ( ((mask & (1 << i)) > 0)) for ( int j = 0;(j < n);j++) if ( ((mask & (1 << j)) == 0)) f[mask] += ((doIt((mask | (1 << j))) * a[i][j]) / k);  return f[mask];} private int getBits( int x){ int cnt = 0; while((x > 0)){x &= (x - 1); cnt++; }return (cnt + 1);} public static void main( String[] args){ new e().run(); } }
2	public class Training{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  long index = in.nextLong(); if ( (index < 10)) {System.out.println(index); } else if ( (index < 190)) {solve(2,index,10,10); } else if ( (index < 2890)) {solve(3,index,190,100); } else if ( (index < 38890)) {solve(4,index,2890,1000); } else if ( (index < 488890)) {solve(5,index,38890,10000); } else if ( (index < 5888890)) {solve(6,index,488890,100000); } else if ( (index < 68888890)) {solve(7,index,5888890,1000000); } else if ( (index < 788888890)) {solve(8,index,68888890,10000000); } else if ( (index < 8888888890l)) {solve(9,index,788888890,100000000); } else if ( (index < 98888888890l)) {solve(10,index,8888888890l,1000000000); } else {solve(11,index,98888888890l,10000000000l); }} static void solve( int length, long index, long lastPoint, long num){ String s = ""; num += ((index - lastPoint) / length); s += num; int mod = (int)((index - lastPoint) % length); System.out.println(s.charAt(mod)); } }
4	public class _G14{ public static void main( String[] args){ MyScanner sc = new MyScanner();  PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));  int t = 1; while((t-- > 0)){ int n = sc.nextInt(); mod = sc.nextLong(); long res = 0; initFac((n + 7)); long[] tpow = new long[(n + 7)];  long[][] combo = new long[(n + 6)][(n + 6)]; for ( int i = 0;(i <= n);i++) {for ( int j = 0;(j <= i);j++) {if ( ((j == 0) || (j == i))) combo[i][j] = 1; else combo[i][j] = ((combo[(i - 1)][(j - 1)] + combo[(i - 1)][j]) % mod); }}tpow[0] = 1; for ( int i = 1;(i <= (n + 6));i++) tpow[i] = ((tpow[(i - 1)] * 2) % mod); long[][] dp = new long[(n + 1)][(n + 1)]; for ( int i = 1;(i <= n);i++) dp[i][0] = tpow[(i - 1)]; for ( int i = 3;(i <= n);i++) {for ( int auto = 1;(auto <= (n / 2));auto++) {if ( !check(i,auto)) continue; long total = 0; for ( int j = (i - 2);(j >= 1);j--) {if ( !check(j,(auto - 1))) break; int len = ((i - j) - 1);  long ways = tpow[(len - 1)];  int picked = (j - (auto - 1));  long interleave = combo[(len + picked)][picked]; ways = ((ways * interleave) % mod); ways = ((ways * dp[j][(auto - 1)]) % mod); total = ((total + ways) % mod); }dp[i][auto] = total; if ( (i == n)) res = ((res + dp[i][auto]) % mod); }}res = ((res + dp[n][0]) % mod); out.println(res); }out.close(); } static boolean check( int n, int auto){ int rem = (n - auto);  int seg = (auto + 1); return (rem >= seg);} static long[] fac ; static long mod ; static void initFac( long n){ fac = new long[((int)n + 1)]; fac[0] = 1; for ( int i = 1;(i <= n);i++) {fac[i] = ((fac[(i - 1)] * i) % mod); }} static long pow( long b, long e){ long ans = 1; while((e > 0)){if ( ((e % 2) == 1)) ans = ((ans * b) % mod); e >>= 1; b = ((b * b) % mod); }return ans;} static long inv( long x){ return pow(x,(mod - 2));} static void sort( int[] a){ ArrayList<Integer> q = new ArrayList<>(); for ( int i :a) q.add(i); Collections.sort(q); for ( int i = 0;(i < a.length);i++) a[i] = q.get(i); } static void sort( long[] a){ ArrayList<Long> q = new ArrayList<>(); for ( long i :a) q.add(i); Collections.sort(q); for ( int i = 0;(i < a.length);i++) a[i] = q.get(i); } public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } }
2	public class Test{ public static int digit( long number){ int i = 1;  long exp = 1; while((number > ((i * 9) * exp))){number -= ((i * 9) * exp); i++; exp *= 10; }return i;} public static int result( long number){ int digit = digit(number);  long exp = 1; for ( int i = 0;(i < (digit - 1));i++) {number -= (((i + 1) * 9) * exp); exp *= 10; } long b = (number / digit);  int c = (int)(number % digit); if ( (c > 0)) { String d = Long.toString((exp + b)); return (d.charAt((c - 1)) - '0');} else { String d = Long.toString(((exp + b) - 1)); return (d.charAt((d.length() - 1)) - '0');}} public static void main( String[] args){ Scanner input = new Scanner(System.in);  long k = input.nextLong(); System.out.println(result(k)); } }
2	public class B2{ Scanner in ; PrintWriter out ; String INPUT = ""; int qc = 0; int n ; int[] table ; int val( int x){ if ( (table[x] != Integer.MIN_VALUE)) return table[x]; if ( (qc > 60)) throw (new RuntimeException()); out.println(("? " + (x + 1))); out.flush(); table[x] = ni(); if ( (table[x] == table[((x + (table.length / 2)) % table.length)])) {if ( (x >= (n / 2))) x -= (n / 2); out.println(("! " + (x + 1))); out.flush(); throw (new IllegalStateException());} return table[x];} void solve(){ n = ni(); if ( ((n % 4) != 0)) {out.println("! -1"); out.flush(); return ;} table = new int[n]; Arrays.fill(table,Integer.MIN_VALUE); Random gen = new Random(1); try{outer:while(true){ int pu = gen.nextInt(n);  int pd = ((pu + (n / 2)) % n);  int pl = (((pu + gen.nextInt(((n / 2) - 1))) + 1) % n);  int pr = ((pl + (n / 2)) % n);  int vu = val(pu),vd = val(pd);  int vl = val(pl),vr = val(pr); if ( cross(vu,vl,vd,vr)) {} else if ( cross(vu,vr,vd,vl)) { int npu = pr,npl = pu;  int npd = pl,npr = pd; pu = npu; pl = npl; pd = npd; pr = npr; vu = val(pu); vl = val(pl); vd = val(pd); vr = val(pr); } else {continue outer;}while(true){ int pul = h(pu,pl,n);  int vul = val(pul);  int pdr = h(pd,pr,n);  int vdr = val(pdr); if ( cross(vul,vu,vdr,vd)) {pl = pul; vl = vul; pr = pdr; vr = vdr; } else {pu = pul; vu = vul; pd = pdr; vd = vdr; }}} }catch (IllegalStateException e){ } } int h( int a, int b, int n){ if ( (a > b)) {b += n; } int u = ((a + b) / 2); if ( (u >= n)) u -= n; return u;} boolean cross( int a, int b, int c, int d){ return (Integer.signum((c - a)) != Integer.signum((d - b)));} void run()throws Exception { in = (oj?new Scanner(System.in):new Scanner(INPUT)); 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 B2().run(); } int ni(){ return Integer.parseInt(in.next());} boolean oj = (System.getProperty("ONLINE_JUDGE") != null); void tr( Object... o){ if ( !oj) System.out.println(Arrays.deepToString(o)); } }
2	public class SolutionD{ BufferedReader in ; StringTokenizer str ; PrintWriter out ; String SK ; String next()throws IOException { while(((str == null) || str.hasMoreTokens())){SK = in.readLine(); if ( (SK == null)) return null; str = new StringTokenizer(SK); }return str.nextToken();} void run()throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); solve(); out.close(); } public static void main( String[] args)throws IOException { new SolutionD().run(); } void solve()throws IOException { long l = Long.parseLong(next());  long r = Long.parseLong(next());  String low = Long.toBinaryString(l);  String up = Long.toBinaryString(r);  int n = low.length();  int m = up.length(); for ( int i = 0;(i < (m - n));i++) {low = ("0" + low); } String ret = "";  boolean fu = false;  boolean fd = false;  boolean su = false;  boolean sd = false; if ( (m > n)) {su = true; fd = true; } for ( int i = 0;(i < m);i++) {if ( (low.charAt(i) == up.charAt(i))) {if ( (low.charAt(i) == '1')) {if ( fd) {ret += "1"; fu = true; } else if ( sd) {ret += "1"; su = true; } else ret += "0"; } else {if ( fu) {ret += "1"; fd = true; } else if ( su) {ret += "1"; sd = true; } else ret += "0"; }} else {if ( (up.charAt(i) == '1')) {su = true; fd = true; } ret += "1"; }}out.println(Long.parseLong(ret,2)); } }
4	public class EdE{ static long[] mods = {1000000007,998244353,1000000009}; static long mod = mods[0]; public static MyScanner sc ; public static PrintWriter out ; static ArrayList<Integer> primes ; public static void main( String[] omkar)throws Exception { sc = new MyScanner(); out = new PrintWriter(System.out); int t = sc.nextInt(); primes = new ArrayList<>(); prime(3165); int[] freq = new int[10000001]; while((t-- > 0)){ int n = sc.nextInt();  int k = sc.nextInt();  int[] arr = readArrayInt(n); for ( int j = 0;(j < n);j++) {arr[j] = factorize(arr[j]); } int[][] left = new int[n][(k + 1)]; for ( int m = 0;(m <= k);m++) { int l = 0;  int count = 0; for ( int i = 0;(i < n);i++) {if ( (freq[arr[i]] > 0)) {count++; } freq[arr[i]]++; while((count > m)){freq[arr[l]]--; if ( (freq[arr[l]] > 0)) {count--; } l++; }left[i][m] = l; }while((l < n)){freq[arr[l]]--; l++; }} long[][] dp = new long[n][(k + 1)]; for ( int i = 0;(i < n);i++) {Arrays.fill(dp[i],Integer.MAX_VALUE); }for ( int i = 0;(i < n);i++) {for ( int j = 0;(j <= k);j++) {for ( int s = 0;(s <= j);s++) {if ( (left[i][s] == 0)) {dp[i][j] = 1; continue;} dp[i][j] = Math.min(dp[i][j],(dp[(left[i][s] - 1)][(j - s)] + 1)); }}}out.println(dp[(n - 1)][k]); }out.close(); } public static void prime( int n){ int[] isPrime = new int[(n + 1)]; Arrays.fill(isPrime,1); for ( long i = 2;(i <= n);i++) {if ( (isPrime[(int)i] == 1)) {for ( long j = (i * i);(j <= n);j += i) {isPrime[(int)j] = 0; }} }for ( int j = 3;(j <= n);j++) {if ( (isPrime[j] == 1)) {primes.add(j); } }} public static int factorize( long n){ long prod = 1;  int count = 0; while(((n % 2) == 0)){n >>= 1; count++; }if ( ((count > 0) && ((count % 2) == 1))) prod *= 2L; for ( long i :primes) {if ( ((i * i) > n)) break; count = 0; while(((n % i) == 0)){count++; n = (n / i); }if ( ((count > 0) && ((count % 2) == 1))) prod *= i; }if ( (n > 2)) prod *= n; return (int)prod;} public static void sort( int[] array){ ArrayList<Integer> copy = new ArrayList<>(); for ( int i :array) copy.add(i); Collections.sort(copy); for ( int i = 0;(i < array.length);i++) array[i] = copy.get(i); } static int[] readArrayInt( int n){ int[] array = new int[n]; for ( int j = 0;(j < n);j++) array[j] = sc.nextInt(); return array;} static long power( long x, long y){ if ( (y == 0)) return 1; if ( ((y % 2) == 1)) return ((x * power(x,(y - 1))) % mod); return (power(((x * x) % mod),(y / 2)) % mod);} public static class MyScanner{ BufferedReader br ; StringTokenizer st ; public MyScanner(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} double nextDouble(){ return Double.parseDouble(next());} } }
6	public class Solution{ private BufferedReader in ; private PrintWriter out ; private StringTokenizer st ; private Random rnd ; int[] levels ; int[] loyal ; int n ,k ; double A ; int[] choices ; int[] new_loyal ; double[] koef ; double ans = 0.0; int total ; void rec( int step, int start){ if ( (step == k)) {for ( int i = 0;(i < n);i++) {new_loyal[i] = loyal[i]; }for ( int i = 0;(i < k);i++) {new_loyal[choices[i]] = Math.min(100,(new_loyal[choices[i]] + 10)); } int full = 0; for ( int i = 0;(i < n);i++) {if ( (new_loyal[i] == 100)) {++full; } }if ( (full > (n / 2))) {ans = 1.0; return ;} for ( int i = 0;(i < n);i++) {koef[i] = ((double)new_loyal[i] / 100.0); } int bits_needed = ((n / 2) + 1);  double total_win = 0.0;  double total_fights = 0.0; for ( int mask = 0;(mask < total);mask++) { int bits = 0;  double win = 1.0;  double loose = 1.0;  double b = 0.0; for ( int bit = 0;(bit < n);bit++) {if ( ((mask & (1 << bit)) != 0)) {++bits; win *= koef[bit]; } else {loose *= (1.0 - koef[bit]); b += levels[bit]; }} double prob = (win * loose); if ( (bits >= bits_needed)) {total_win += prob; } else {total_fights += (prob * (A / (A + b))); }}ans = Math.max(ans,(total_win + total_fights)); } else {for ( int i = start;(i < n);i++) {choices[step] = i; rec((step + 1),i); }}} public void solve()throws IOException { n = nextInt(); k = nextInt(); A = nextInt(); levels = new int[n]; loyal = new int[n]; new_loyal = new int[n]; choices = new int[k]; koef = new double[n]; for ( int i = 0;(i < n);i++) {levels[i] = nextInt(); loyal[i] = nextInt(); }total = (1 << n); rec(0,0); out.println(ans); } public static void main( String[] args){ new Solution().run(); } public void run(){ try{in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); st = null; rnd = new Random(); solve(); out.close(); }catch (IOException e){ e.printStackTrace(); } } private String nextToken()throws IOException,NullPointerException { while(((st == null) || !st.hasMoreTokens())){st = new StringTokenizer(in.readLine()); }return st.nextToken();} private int nextInt()throws IOException { return Integer.parseInt(nextToken());} }
6	public class B{ int n ,k ,A ; int[] b ; int[] l ; double ans ; double cal(){ double total = 0; for ( int mask = 0;(mask < (1 << n));mask++) { int bit = Integer.bitCount(mask);  double p = 1; for ( int i = 0;(i < n);i++) {if ( ((mask & (1 << i)) != 0)) p *= (l[i] / 10.0); else p *= (1.0 - (l[i] / 10.0)); }if ( ((bit * 2) > n)) total += p; else { int B = 0; for ( int i = 0;(i < n);i++) {if ( ((mask & (1 << i)) == 0)) {B += b[i]; } }total += (p * (A / (double)(A + B))); }}return total;} void rec( int d, int remain){ ans = max(ans,cal()); if ( (remain == 0)) return ; for ( int i = d;(i < n);i++) {if ( (l[i] == 10)) continue; l[i]++; rec(i,(remain - 1)); l[i]--; }} public B()throws Exception{ n = in.nextInt(); k = in.nextInt(); A = in.nextInt(); b = new int[n]; l = new int[n]; for ( int i = 0;(i < n);i++) {b[i] = in.nextInt(); l[i] = (in.nextInt() / 10); }ans = 0; rec(0,k); System.out.print(ans); } Scanner in = new Scanner(System.in); StringBuilder buf = new StringBuilder(); public static void main( String[] args)throws Exception { new B(); } }
5	public class A{ final int MOD = ((int)1e9 + 7); final double eps = 1e-12; final int INF = (int)1e9; public A(){ int N = sc.nextInt();  int K = sc.nextInt();  Long[] A = sc.nextLongs(); sort(A); TreeSet<Long> S = new TreeSet<Long>(); for ( long a :A) {if ( (((a % K) == 0) && S.contains((a / K)))) continue; S.add(a); } int res = S.size(); exit(res); } static MyScanner sc = new MyScanner(); static class MyScanner{ public String next(){ newLine(); return line[index++];} public int nextInt(){ return Integer.parseInt(next());} public long nextLong(){ return Long.parseLong(next());} public double nextDouble(){ return Double.parseDouble(next());} public String[] nextStrings(){ line = null; return readLine().split(" ");} public Integer[] nextInts(){ String[] L = nextStrings();  Integer[] res = new Integer[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Integer.parseInt(L[i]); return res;} public Long[] nextLongs(){ String[] L = nextStrings();  Long[] res = new Long[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Long.parseLong(L[i]); return res;} public Double[] nextDoubles(){ String[] L = nextStrings();  Double[] res = new Double[L.length]; for ( int i = 0;(i < L.length);++i) res[i] = Double.parseDouble(L[i]); return res;} public String[] next( int N){ String[] res = new String[N]; for ( int i = 0;(i < N);++i) res[i] = sc.next(); return res;} public Integer[] nextInt( int N){ Integer[] res = new Integer[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInt(); return res;} public Long[] nextLong( int N){ Long[] res = new Long[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLong(); return res;} public Double[] nextDouble( int N){ Double[] res = new Double[N]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDouble(); return res;} public String[][] nextStrings( int N){ String[][] res = new String[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextStrings(); return res;} public Integer[][] nextInts( int N){ Integer[][] res = new Integer[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextInts(); return res;} public Long[][] nextLongs( int N){ Long[][] res = new Long[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextLongs(); return res;} public Double[][] nextDoubles( int N){ Double[][] res = new Double[N][]; for ( int i = 0;(i < N);++i) res[i] = sc.nextDoubles(); return res;} private boolean eol(){ return (index == line.length);} private String readLine(){ try{return r.readLine(); }catch (Exception e){ throw (new Error(e));} } private final BufferedReader r ; MyScanner(){ this(new BufferedReader(new InputStreamReader(System.in))); } MyScanner( BufferedReader r){ try{this.r = r; while(!r.ready())Thread.sleep(1); start(); }catch (Exception e){ throw (new Error(e));} } private String[] line ; private int index ; private void newLine(){ if ( ((line == null) || eol())) {line = readLine().split(" "); index = 0; } } } static void print( Object o, Object... a){ printDelim(" ",o,a); } static void printDelim( String delim, Object o, Object... a){ pw.println(build(delim,o,a)); } static void exit( Object o, Object... a){ print(o,a); exit(); } static void exit(){ pw.close(); System.out.flush(); System.err.println("------------------"); System.err.println(("Time: " + ((millis() - t) / 1000.0))); System.exit(0); } static String build( String delim, Object o, Object... a){ StringBuilder b = new StringBuilder(); append(b,o,delim); for ( Object p :a) append(b,p,delim); return b.toString().trim();} static void append( StringBuilder b, Object o, String delim){ if ( o.getClass().isArray()) { int L = Array.getLength(o); for ( int i = 0;(i < L);++i) append(b,Array.get(o,i),delim); } else if ( (o instanceof Iterable<?>)) {for ( Object p :(Iterable<?>)o) append(b,p,delim); } else b.append(delim).append(o); } public static void main( String[] args){ new A(); exit(); } static void start(){ t = millis(); } static PrintWriter pw = new PrintWriter(System.out); static long t ; static long millis(){ return System.currentTimeMillis();} }
0	public class composite{ public static void main( String[] args){ int b ;  Scanner s3 = new Scanner(System.in); b = s3.nextInt(); if ( ((b % 2) == 0)) {b = (b - 4); System.out.println(((4 + " ") + b)); } else {b = (b - 9); System.out.println(((9 + " ") + b)); }} }
4	public class C{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  InputReader in = new InputReader(inputStream);  PrintWriter out = new PrintWriter(outputStream);  Task solver = new Task(); solver.solve(in,out); out.close(); } static class Task{ int M ; public void solve( InputReader in, PrintWriter out){ int n = in.nextInt(); M = in.nextInt(); if ( (n <= 1)) {out.println(n); return ;} int[][] Ckn = new int[(n + 1)][(n + 1)]; for ( int i = 0;(i <= n);i++) {Ckn[i][i] = 1; Ckn[0][i] = 1; for ( int j = (i - 1);(j >= 1);j--) {Ckn[j][i] = add(Ckn[(j - 1)][(i - 1)],Ckn[j][(i - 1)]); }} int ans = 0;  int[][] dp = new int[(n + 1)][(n + 1)]; dp[1][1] = 1; for ( int i = 2;(i <= n);i++) {dp[i][i] = mul(2,dp[(i - 1)][(i - 1)]); for ( int j = 1;(j <= (i - 1));j++) {for ( int k = 1;(k <= j);k++) {dp[i][j] = add(dp[i][j],mul(mul(dp[k][k],dp[((i - k) - 1)][(j - k)]),Ckn[k][j])); }}}for ( int i = 0;(i <= n);i++) ans = add(ans,dp[n][i]); out.println(ans); } public int add( int a, int b){ a += b; if ( (a >= M)) a -= M; return a;} public int mul( int a, int b){ long res = ((long)a * (long)b); res %= M; return (int)res;} } static class InputReader{ BufferedReader br ; StringTokenizer st ; public InputReader( InputStream stream){ br = new BufferedReader(new InputStreamReader(stream)); } public String nextToken(){ while(((st == null) || !st.hasMoreTokens())){ String line = null; try{line = br.readLine(); }catch (IOException e){ throw (new RuntimeException(e));} if ( (line == null)) {return null;} st = new StringTokenizer(line); }return st.nextToken();} public int nextInt(){ return Integer.parseInt(nextToken());} } }
6	public class Task2{ public static void main( String[] args)throws IOException { new Task2().solve(); } int mod = 1000000007; PrintWriter out ; int n ; int m ; long base = (1L << 63); long P = 31; int[][] a ; void solve()throws IOException { Reader in = new Reader();  PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));  int n = in.nextInt();  double[][] a = new double[n][n]; for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) a[i][j] = in.nextDouble(); double[] dp = new double[(1 << n)]; dp[((1 << n) - 1)] = 1; for ( int mask = ((1 << n) - 1);(mask >= 0);mask--) { int k = Integer.bitCount(mask);  double p = (1.0 / ((k * (k - 1)) / 2.0)); for ( int i = 0;(i < n);i++) for ( int j = 0;(j < n);j++) if ( (((mask & (1 << i)) != 0) && ((mask & (1 << j)) != 0))) dp[(mask & (1 << j))] += ((p * dp[mask]) * a[i][j]); }for ( int i = 0;(i < n);i++) out.print((dp[(1 << i)] + " ")); out.flush(); out.close(); } long gcd( long a, long b){ if ( (b == 0)) return a; return gcd(b,(a % b));} class Reader{ BufferedReader br ; StringTokenizer tok ; Reader( String file)throws IOException{ br = new BufferedReader(new FileReader(file)); } Reader()throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); } String next()throws IOException { while(((tok == null) || !tok.hasMoreElements()))tok = new StringTokenizer(br.readLine()); return tok.nextToken();} int nextInt()throws NumberFormatException,IOException { return Integer.valueOf(next());} double nextDouble()throws NumberFormatException,IOException { return Double.valueOf(next());} } }
5	public class p7{ static class FastReader{ BufferedReader br ; StringTokenizer st ; public FastReader(){ br = new BufferedReader(new InputStreamReader(System.in)); } String next(){ while(((st == null) || !st.hasMoreElements())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ e.printStackTrace(); } }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} long nextLong(){ return Long.parseLong(next());} } public static void main( String[] args){ FastReader sc = new FastReader();  int n = sc.nextInt();  int k = sc.nextInt();  long one = ((long)Math.pow(2,k) - 1);  long[] arr = new long[(n + 1)]; arr[0] = 0; for ( int i = 1;(i <= n);i++) {arr[i] = sc.nextLong(); arr[i] ^= arr[(i - 1)]; } Map<Long,Long> count = new HashMap<>(); for ( int i = 0;(i <= n);i++) { Long key = Math.min(arr[i],(arr[i] ^ one));  Long val = count.get(key); if ( (val == null)) val = 0L; count.put(key,(val + 1)); } long num = n;  long ans = ((num * (num + 1)) / 2); for ( Map.Entry<Long,Long> ent :count.entrySet()) { Long cnt = ent.getValue();  long num1 = (cnt / 2);  long num2 = ((cnt + 1) / 2); ans -= ((num1 * (num1 - 1)) / 2); ans -= ((num2 * (num2 - 1)) / 2); }System.out.println(ans); } }
5	public final class Main implements Runnable{ static private String[] args ; public static void main( String[] args){ Main.args = args; new Thread(null,new Main(),"MyRunThread",(1 << 27)).start(); } } final class Solver{ InputReader in ; OutputWriter out ; DebugWriter dout ; public void solve(){ int n = in.readInt();  int k = in.readInt();  TreeSet<Integer> q = new TreeSet<Integer>();  int[] mas = new int[n]; for ( int i = 0;(i < n);++i) {mas[i] = in.readInt(); if ( ((mas[i] % k) != 0)) q.add(mas[i]); }Arrays.sort(mas); for ( int i = 0;(i < n);++i) if ( (((mas[i] % k) == 0) && !q.contains((mas[i] / k)))) q.add(mas[i]); out.printLine(q.size()); } } final class InputReader{ private boolean finished = false; private InputStream stream ; private byte[] buf = new byte[(1 << 10)]; private int curChar ; private int numChars ; public InputReader( InputStream stream){ this.stream = stream; } private int read(){ if ( (numChars == -1)) throw (new InputMismatchException()); if ( (curChar >= numChars)) {curChar = 0; try{numChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (numChars <= 0)) return -1; } return buf[curChar++];} public int peek(){ if ( (numChars == -1)) return -1; if ( (curChar >= numChars)) {curChar = 0; try{numChars = stream.read(buf); }catch (IOException e){ return -1;} 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 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 static boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} private String readLine0(){ StringBuilder buf = new StringBuilder();  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();} } final class OutputWriter{ private final PrintWriter writer ; public OutputWriter( OutputStream outputStream){ writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream),(1 << 10))); } public OutputWriter( Writer writer){ this.writer = new PrintWriter(writer); } public void print( Object... objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( Object... objects){ print(objects); writer.println(); } public void printFormat( String format, Object... objects){ writer.printf(format,objects); } public void print( char[] objects){ writer.print(objects); } public void printLine( char[] objects){ writer.println(objects); } public void printLine( char[][] objects){ for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); } public void print( int[] objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( int[] objects){ print(objects); writer.println(); } public void printLine( int[][] objects){ for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); } public void print( short[] objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( short[] objects){ print(objects); writer.println(); } public void printLine( short[][] objects){ for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); } public void print( long[] objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( long[] objects){ print(objects); writer.println(); } public void printLine( long[][] objects){ for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); } public void print( double[] objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( double[] objects){ print(objects); writer.println(); } public void printLine( double[][] objects){ for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); } public void print( byte[] objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( byte[] objects){ print(objects); writer.println(); } public void printLine( byte[][] objects){ for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); } public void print( boolean[] objects){ for ( int i = 0;(i < objects.length);i++) {if ( (i != 0)) writer.print(' '); writer.print(objects[i]); }} public void printLine( boolean[] objects){ print(objects); writer.println(); } public void printLine( boolean[][] objects){ for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); } public void close(){ writer.close(); } public void flush(){ writer.flush(); } } final class DebugWriter{ private final OutputWriter writer ; public DebugWriter( OutputWriter writer){ this.writer = writer; } private void printDebugMessage(){ writer.print("DEBUG:\t"); } public void printLine( Object... objects){ flush(); printDebugMessage(); writer.printLine(objects); flush(); } public void printFormat( String format, Object... objects){ flush(); printDebugMessage(); writer.printFormat(format,objects); flush(); } public void printLine( char[] objects){ flush(); printDebugMessage(); writer.printLine(objects); flush(); } public void printLine( char[][] objects){ flush(); for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); flush(); } public void printLine( double[] objects){ flush(); printDebugMessage(); writer.printLine(objects); flush(); } public void printLine( double[][] objects){ flush(); for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); flush(); } public void printLine( int[] objects){ flush(); printDebugMessage(); writer.printLine(objects); flush(); } public void printLine( int[][] objects){ flush(); for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); flush(); } public void printLine( short[] objects){ flush(); printDebugMessage(); writer.printLine(objects); flush(); } public void printLine( short[][] objects){ flush(); for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); flush(); } public void printLine( long[] objects){ flush(); printDebugMessage(); writer.printLine(objects); flush(); } public void printLine( long[][] objects){ flush(); for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); flush(); } public void printLine( byte[] objects){ flush(); printDebugMessage(); writer.printLine(objects); flush(); } public void printLine( byte[][] objects){ flush(); for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); flush(); } public void printLine( boolean[] objects){ flush(); printDebugMessage(); writer.printLine(objects); flush(); } public void printLine( boolean[][] objects){ flush(); for ( int i = 0;(i < objects.length);++i) printLine(objects[i]); flush(); } public void flush(){ writer.flush(); } } interface Graph{ ; ; ; ; ; public int getFirstEdge( int source); public boolean hasNextEdge( int id); public int getNextEdge( int id); public int getVertexCount(); ; ; public int getSource( int id); public int getDestination( int id); public int getColor( int id); ; ; ; public String edgeToString( int id); ; ; ; ; ; ; }
4	public class MainD{ static final StdIn in = new StdIn(); static final PrintWriter out = new PrintWriter(System.out); static final long M = ((long)1e9 + 7); static long[] fac ,faci ; public static void main( String[] args){ int n = in.nextInt(); fac = new long[(n + 1)]; faci = new long[(n + 1)]; fac[0] = faci[0] = 1; for ( int i = 1;(i <= n);++i) faci[i] = modI(fac[i] = ((fac[(i - 1)] * i) % M),M); List<List<Integer>> grps = new ArrayList<List<Integer>>(); for ( int i = 0;(i < n);++i) { int ai = in.nextInt(); for ( int j = 0;;++j) {if ( (j >= grps.size())) grps.add(new ArrayList<Integer>()); if ( ((grps.get(j).size() > 0) && !ps(((long)grps.get(j).get(0) * ai)))) continue; grps.get(j).add(ai); break;}} long[][] dp = new long[grps.size()][((n - grps.size()) + 1)]; dp[0][(grps.get(0).size() - 1)] = fac[grps.get(0).size()]; int ad = grps.get(0).size(); for ( int i = 1;(i < grps.size());++i) {for ( int j = 0;(j < dp[(i - 1)].length);++j) {if ( (dp[(i - 1)][j] == 0)) continue; for ( int k = 0;(k < grps.get(i).size());++k) for ( int l = Math.max(((((grps.get(i).size() + j) - k) - ad) - 1),0);(l <= Math.min((grps.get(i).size() - k),j));++l) dp[i][((j + k) - l)] = (((((((((fac[grps.get(i).size()] * nck(j,l)) % M) * nck(((ad + 1) - j),((grps.get(i).size() - k) - l))) % M) * nck((grps.get(i).size() - 1),k)) % M) * dp[(i - 1)][j]) + dp[i][((j + k) - l)]) % M); }ad += grps.get(i).size(); }out.println(dp[(grps.size() - 1)][0]); out.close(); } static long modI( long a, long m){ return (((a %= m) <= 1)?1:((((1 - (modI((m % a),a) * m)) / a) + m) % m));} static long nck( int n, int k){ return ((((fac[n] * faci[k]) % M) * faci[(n - k)]) % M);} static boolean ps( long x){ long lb = 1,rb = M; while((lb <= rb)){ long mb = ((lb + rb) / 2); if ( ((mb * mb) == x)) return true; if ( ((mb * mb) < x)) lb = (mb + 1); else rb = (mb - 1); }return false;} static class StdIn{ private final int BUFFER_SIZE = (1 << 16); private DataInputStream din ; private byte[] buffer ; private int bufferPointer ,bytesRead ; public StdIn(){ din = new DataInputStream(System.in); buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public StdIn( InputStream in){ try{din = new DataInputStream(in); }catch (Exception e){ throw (new RuntimeException());} buffer = new byte[BUFFER_SIZE]; bufferPointer = bytesRead = 0; } public int nextInt(){ 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(){ 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;} private void fillBuffer()throws IOException { bytesRead = din.read(buffer,bufferPointer = 0,BUFFER_SIZE); if ( (bytesRead == -1)) buffer[0] = -1; } private byte read(){ try{if ( (bufferPointer == bytesRead)) fillBuffer(); return buffer[bufferPointer++]; }catch (IOException e){ throw (new RuntimeException());} } public void close()throws IOException { if ( (din == null)) return ; din.close(); } } }
5	public class _AAAA implements Runnable{ final boolean ONLINE_JUDGE = (System.getProperty("ONLINE_JUDGE") != null); BufferedReader in ; OutputWriter out ; StringTokenizer tok = new StringTokenizer(""); public static void main( String[] args){ new Thread(null,new _AAAA(),"",(128 * (1L << 20))).start(); } void init()throws FileNotFoundException { Locale.setDefault(Locale.US); if ( ONLINE_JUDGE) {in = new BufferedReader(new InputStreamReader(System.in)); out = new OutputWriter(System.out); } else {in = new BufferedReader(new FileReader("input.txt")); out = new OutputWriter("output.txt"); }} long timeBegin ,timeEnd ; void time(){ timeEnd = System.currentTimeMillis(); System.err.println(("Time = " + (timeEnd - timeBegin))); } String delim = " "; String readString()throws IOException { while(!tok.hasMoreTokens()){try{tok = new StringTokenizer(in.readLine()); }catch (Exception e){ return null;} }return tok.nextToken(delim);} String readLine()throws IOException { return in.readLine();} final char NOT_A_SYMBOL = '\0'; int readInt()throws IOException { return Integer.parseInt(readString());} long readLong()throws IOException { return Long.parseLong(readString());} double readDouble()throws IOException { return Double.parseDouble(readString());} Point readPoint()throws IOException { return new Point(readInt(),readInt());} class OutputWriter extends PrintWriter{ final int DEFAULT_PRECISION = 12; int precision ; String format ,formatWithSpace ; {precision = DEFAULT_PRECISION; format = createFormat(precision); formatWithSpace = (format + " "); }public OutputWriter( OutputStream out){ super(out); } public OutputWriter( String fileName)throws FileNotFoundException{ super(fileName); } private String createFormat( int precision){ return (("%." + precision) + "f");} @Override public void print( double d){ printf(format,d); } public void printWithSpace( double d){ printf(formatWithSpace,d); } public void printAll( double... d){ for ( int i = 0;(i < (d.length - 1));++i) {printWithSpace(d[i]); }print(d[(d.length - 1)]); } @Override public void println( double d){ printlnAll(d); } public void printlnAll( double... d){ printAll(d); println(); } } int[][] steps = {{-1,0},{1,0},{0,-1},{0,1}}; void solve()throws IOException { int n = readInt();  int k = readInt();  Map<Long,Integer> map = new TreeMap<Long,Integer>(); for ( int i = 0;(i < n);++i) {map.put(readLong(),i); } int ans = 0;  boolean[] used = new boolean[n]; for ( Map.Entry<Long,Integer> e :map.entrySet()) {if ( used[e.getValue()]) continue; long value = (e.getKey() * k);  Integer index = map.get(value); if ( (index != null)) {used[index] = true; } ++ans; }out.println(ans); } }
4	public class Main{ public static void main( String[] args)throws Exception { Thread thread = new Thread(null,new TaskAdapter(),"",(1 << 27)); thread.start(); thread.join(); } static class TaskAdapter implements Runnable{ } static class G2PlaylistForPolycarpHardVersion{ Modular mod = new Modular((1e9 + 7)); public void solve( int testNumber, FastInput in, FastOutput out){ int n = in.readInt();  int m = in.readInt();  int[][] musics = new int[n][2];  int[] cnts = new int[4]; for ( int i = 0;(i < n);i++) {musics[i][0] = in.readInt(); musics[i][1] = in.readInt(); cnts[musics[i][1]]++; } int c1 = cnts[1];  int c2 = cnts[2];  int c3 = cnts[3];  int[][][][] comp = new int[(c1 + 1)][(c2 + 1)][(c3 + 1)][4]; for ( int i = 0;(i <= c1);i++) {for ( int j = 0;(j <= c2);j++) {for ( int k = 0;(k <= c3);k++) {for ( int t = 0;(t < 4);t++) {if ( (((i == 0) && (j == 0)) && (k == 0))) {comp[i][j][k][t] = 1; continue;} if ( ((i > 0) && (t != 1))) {comp[i][j][k][t] = mod.plus(comp[i][j][k][t],mod.mul(comp[(i - 1)][j][k][1],i)); } if ( ((j > 0) && (t != 2))) {comp[i][j][k][t] = mod.plus(comp[i][j][k][t],mod.mul(comp[i][(j - 1)][k][2],j)); } if ( ((k > 0) && (t != 3))) {comp[i][j][k][t] = mod.plus(comp[i][j][k][t],mod.mul(comp[i][j][(k - 1)][3],k)); } }}}} int[][][][] last = new int[(c1 + 1)][(c2 + 1)][(c3 + 1)][(m + 1)];  int[][][][] next = new int[(c1 + 1)][(c2 + 1)][(c3 + 1)][(m + 1)]; last[0][0][0][0] = 1; int t1 = 0;  int t2 = 0;  int t3 = 0; for ( int[] music :musics) { int m1 = music[1];  int m0 = music[0]; if ( (m1 == 1)) {t1++; } else if ( (m1 == 2)) {t2++; } else {t3++; }for ( int i = 0;(i <= t1);i++) {for ( int j = 0;(j <= t2);j++) {for ( int k = 0;(k <= t3);k++) {for ( int t = 0;(t <= m);t++) {next[i][j][k][t] = last[i][j][k][t]; if ( (t < m0)) {continue;} if ( ((m1 == 1) && (i > 0))) {next[i][j][k][t] = mod.plus(next[i][j][k][t],last[(i - 1)][j][k][(t - m0)]); } else if ( ((m1 == 2) && (j > 0))) {next[i][j][k][t] = mod.plus(next[i][j][k][t],last[i][(j - 1)][k][(t - m0)]); } else if ( ((m1 == 3) && (k > 0))) {next[i][j][k][t] = mod.plus(next[i][j][k][t],last[i][j][(k - 1)][(t - m0)]); } }}}} int[][][][] tmp = last; last = next; next = tmp; } int ans = 0; for ( int i = 0;(i <= c1);i++) {for ( int j = 0;(j <= c2);j++) {for ( int k = 0;(k <= c3);k++) {ans = mod.plus(ans,mod.mul(last[i][j][k][m],comp[i][j][k][0])); }}}out.println(ans); } } static class Modular{ int m ; public Modular( int m){ this.m = m; } public Modular( long m){ this.m = (int)m; if ( (this.m != m)) {throw (new IllegalArgumentException());} } public Modular( double m){ this.m = (int)m; if ( (this.m != m)) {throw (new IllegalArgumentException());} } public int valueOf( int x){ x %= m; if ( (x < 0)) {x += m; } return x;} public int valueOf( long x){ x %= m; if ( (x < 0)) {x += m; } return (int)x;} public int mul( int x, int y){ return valueOf(((long)x * y));} public int plus( int x, int y){ return valueOf((x + y));} public String toString(){ return ("mod " + m);} } static class FastOutput implements AutoCloseable,Closeable{ private StringBuilder cache = new StringBuilder((10 << 20)); private final Writer os ; public FastOutput( Writer os){ this.os = os; } public FastOutput( OutputStream os){ this(new OutputStreamWriter(os)); } public FastOutput println( int c){ cache.append(c).append('\n'); return this;} public FastOutput flush(){ try{os.append(cache); os.flush(); cache.setLength(0); }catch (IOException e){ throw (new UncheckedIOException(e));} return this;} public void close(){ flush(); try{os.close(); }catch (IOException e){ throw (new UncheckedIOException(e));} } public String toString(){ return cache.toString();} } static class FastInput{ private final InputStream is ; private byte[] buf = new byte[(1 << 13)]; private int bufLen ; private int bufOffset ; private int next ; public FastInput( InputStream is){ this.is = is; } private int read(){ while((bufLen == bufOffset)){bufOffset = 0; try{bufLen = is.read(buf); }catch (IOException e){ bufLen = -1; } if ( (bufLen == -1)) {return -1;} }return buf[bufOffset++];} public void skipBlank(){ while(((next >= 0) && (next <= 32))){next = read(); }} public int readInt(){ int sign = 1; skipBlank(); if ( ((next == '+') || (next == '-'))) {sign = ((next == '+')?1:-1); next = read(); } int val = 0; if ( (sign == 1)) {while(((next >= '0') && (next <= '9'))){val = (((val * 10) + next) - '0'); next = read(); }} else {while(((next >= '0') && (next <= '9'))){val = (((val * 10) - next) + '0'); next = read(); }}return val;} } }
4	public class OnTheBench{ public static void main( String[] args){ setupCombo(301); FastScanner sc = new FastScanner();  PrintWriter out = new PrintWriter(System.out);  int N = sc.nextInt();  long[] a = sc.nextLongs(N);  boolean[] vis = new boolean[N];  int[] groups = new int[(N + 1)];  int G = 0; for ( int i = 0;(i < N);i++) {if ( !vis[i]) {vis[i] = true; int elems = 1; for ( int j = (i + 1);(j < N);j++) { long prod = (a[i] * a[j]);  long root = (long)Math.sqrt(prod); if ( (!vis[j] && (prod == (root * root)))) {vis[j] = true; elems++; } }groups[++G] = elems; } } long[][] dp = new long[(G + 1)][(N + 1)]; dp[0][0] = 1; int total = 0; for ( int prefix = 1;(prefix <= G);prefix++) { int amt = groups[prefix]; for ( int prevBad = 0;(prevBad <= max(0,(total - 1)));prevBad++) {for ( int fixed = 0;(fixed <= min(prevBad,amt));fixed++) {for ( int slots = max(1,fixed);(slots <= min(amt,(total + 1)));slots++) { int introduced = (amt - slots);  long ways = mult(choose[prevBad][fixed],choose[((total + 1) - prevBad)][(slots - fixed)],choose[(amt - 1)][(slots - 1)],fact[amt],dp[(prefix - 1)][prevBad]);  int currBad = ((prevBad + introduced) - fixed); dp[prefix][currBad] = ((dp[prefix][currBad] + ways) % mod); }}}total += amt; }out.println(dp[G][0]); out.close(); } static long mod = ((long)1e9 + 7); static long[][] choose ; static long[] fact ; static long mult( long... multiplicands){ long ans = 1; for ( long v :multiplicands) {ans = ((ans * v) % mod); }return ans;} static void setupCombo( int MAX){ choose = new long[(MAX + 1)][(MAX + 1)]; fact = new long[(MAX + 1)]; choose[0][0] = 1; fact[0] = 1; for ( int i = 1;(i <= MAX);i++) {fact[i] = (((long)i * fact[(i - 1)]) % mod); choose[i][0] = 1; for ( int j = 1;(j < i);j++) {choose[i][j] = ((choose[(i - 1)][(j - 1)] + choose[(i - 1)][j]) % mod); }choose[i][i] = 1; }} static class FastScanner{ private int BS = (1 << 16); private char NC = (char)0; private byte[] buf = new byte[BS]; private int bId = 0,size = 0; private char c = NC; private double cnt = 1; private BufferedInputStream in ; public FastScanner(){ in = new BufferedInputStream(System.in,BS); } public FastScanner( String s){ try{in = new BufferedInputStream(new FileInputStream(new File(s)),BS); }catch (Exception e){ in = new BufferedInputStream(System.in,BS); } } private char getChar(){ while((bId == size)){try{size = in.read(buf); }catch (Exception e){ return NC;} if ( (size == -1)) return NC; bId = 0; }return (char)buf[bId++];} public int nextInt(){ return (int)nextLong();} public long[] nextLongs( int N){ long[] res = new long[N]; for ( int i = 0;(i < N);i++) {res[i] = nextLong(); }return res;} public long nextLong(){ cnt = 1; boolean neg = false; if ( (c == NC)) c = getChar(); for ( ;((c < '0') || (c > '9'));c = getChar()) {if ( (c == '-')) neg = true; } long res = 0; for ( ;((c >= '0') && (c <= '9'));c = getChar()) {res = ((((res << 3) + (res << 1)) + c) - '0'); cnt *= 10; }return (neg?-res:res);} public double nextDouble(){ double cur = nextLong(); return ((c != '.')?cur:(cur + (nextLong() / cnt)));} } }
0	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);  TaskA solver = new TaskA(); solver.solve(1,in,out); out.close(); } } class TaskA{ public void solve( int testNumber, InputReader in, PrintWriter out){ int n = in.nextInt(); if ( ((n % 2) == 0)) {out.println(("4 " + (n - 4))); } else {out.println(("9 " + (n - 9))); }} } class InputReader{ public BufferedReader reader ; private int tokenCount ,nextTokenIndex ; private String[] tokens ; public InputReader( InputStream stream){ reader = new BufferedReader(new InputStreamReader(stream)); tokenCount = nextTokenIndex = 0; } public String next(){ String nextLine ; if ( (nextTokenIndex == tokenCount)) {try{nextLine = reader.readLine(); nextTokenIndex = 0; tokens = nextLine.split("\\s"); tokenCount = tokens.length; }catch (IOException e){ throw (new RuntimeException(e));} } return tokens[nextTokenIndex++];} public int nextInt(){ return Integer.parseInt(next());} }
6	public class Main{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int m = Integer.parseInt(st.nextToken());  char[] arr = br.readLine().toCharArray();  int[][] count = new int[m][m]; for ( int i = 0;(i < (n - 1));i++) {count[(arr[i] - 'a')][(arr[(i + 1)] - 'a')]++; count[(arr[(i + 1)] - 'a')][(arr[i] - 'a')]++; } int[] memo = new int[(1 << m)]; Arrays.fill(memo,(int)1e9); memo[0] = 0; for ( int msk = 0;(msk < (1 << m));msk++) {for ( int c = 0;(c < m);c++) {if ( ((msk & (1 << c)) != 0)) continue; int temp = 0; for ( int i = 0;(i < m);i++) {if ( (i == c)) continue; if ( ((msk & (1 << i)) != 0)) {temp += count[c][i]; } else temp -= count[c][i]; }memo[(msk | (1 << c))] = Math.min(memo[(msk | (1 << c))],((temp * Integer.bitCount(msk)) + memo[msk])); }}System.out.println(memo[((1 << m) - 1)]); } }
2	public class Main implements Runnable{ public void _main()throws IOException { long n = nextLong();  long m = nextLong();  long k = nextLong();  long numBlocks = Math.min(Math.min((n / k),(n - m)),(m / (k - 1))); n -= (numBlocks * k); m -= (numBlocks * (k - 1)); long numFullBlocks = (m / k);  long rem = (m % k);  long res = 0; res = ((res + ((((p2((numFullBlocks + 1)) + MOD) - 2) % MOD) * k)) % MOD); res = ((res + rem) % MOD); res = ((res + (numBlocks * (k - 1))) % MOD); out.println(res); } final int MOD = 1000000009; private long p2( long s){ long res = 1;  long x = 2; while((s > 0)){if ( ((s % 2) == 1)) {res = ((res * x) % MOD); } x = ((x * x) % MOD); s /= 2; }return res;} private BufferedReader in ; private PrintWriter out ; private StringTokenizer st ; private String next()throws IOException { while(((st == null) || !st.hasMoreTokens())){ String rl = in.readLine(); if ( (rl == null)) return null; st = new StringTokenizer(rl); }return st.nextToken();} private long nextLong()throws IOException { return Long.parseLong(next());} public static void main( String[] args){ Locale.setDefault(Locale.UK); new Thread(new Main()).start(); } }
0	public class LCMChallenge{ public static void main( String[] args){ Scanner in = new Scanner(new BufferedInputStream(System.in));  long N = in.nextLong(); if ( ((N == 1) || (N == 2))) {System.out.printf("%d\n",N); return ;} if ( ((N & 1) == 1)) { long lcm = ((N * (N - 1)) * (N - 2)); System.out.printf("%d\n",lcm); } else { long lcm ; if ( ((N % 3) == 0)) {lcm = (((N - 1) * (N - 2)) * (N - 3)); } else {lcm = ((N * (N - 1)) * (N - 3)); }System.out.printf("%d\n",lcm); }} }
1	public class Main{ static private void solve( InputReader in, OutputWriter out){ int n = in.nextInt();  List<List<Integer>> g = new ArrayList<>((n + 1)); for ( int i = 0;(i < (n + 1));i++) {g.add(new LinkedList<>()); } int degree1 = 0,degree2 = 0,root = 0; for ( int i = 0;(i < (n - 1));i++) { int a = in.nextInt();  int b = in.nextInt(); g.get(a).add(b); g.get(b).add(a); if ( (g.get(a).size() > degree1)) {if ( (a == root)) {degree1 = g.get(a).size(); } else {degree2 = degree1; degree1 = g.get(a).size(); root = a; }} else if ( (g.get(a).size() > degree2)) {degree2 = g.get(a).size(); } if ( (g.get(b).size() > degree1)) {if ( (b == root)) {degree1 = g.get(b).size(); } else {degree2 = degree1; degree1 = g.get(b).size(); root = b; }} else if ( (g.get(b).size() > degree2)) {degree2 = g.get(b).size(); } }if ( (degree2 > 2)) {out.print("No"); } else {out.println("Yes"); List<Integer> leaves = new LinkedList<>(); for ( int i = 1;(i <= n);i++) {if ( (i != root)) {if ( (g.get(i).size() == 1)) {leaves.add(i); } } }out.println(leaves.size()); for ( int i :leaves) {out.println(((root + " ") + i)); }}} public static void main( String[] args){ InputReader in = new InputReader(System.in);  OutputWriter out = new OutputWriter(System.out); solve(in,out); in.close(); out.close(); } static private class InputReader{ private BufferedReader br ; private StringTokenizer st ; InputReader( InputStream is){ br = new BufferedReader(new InputStreamReader(is)); st = null; } String nextLine(){ String line = null; try{line = br.readLine(); }catch (IOException e){ e.printStackTrace(); } return line;} String next(){ while(((st == null) || !st.hasMoreTokens())){ String line = nextLine(); if ( (line == null)) return null; st = new StringTokenizer(line); }return st.nextToken();} int nextInt(){ return Integer.parseInt(next());} void close(){ try{br.close(); }catch (IOException e){ e.printStackTrace(); } } } static private class OutputWriter{ BufferedWriter bw ; OutputWriter( OutputStream os){ bw = new BufferedWriter(new OutputStreamWriter(os)); } void print( int i){ print(Integer.toString(i)); } void println( int i){ println(Integer.toString(i)); } void print( long l){ print(Long.toString(l)); } void println( long l){ println(Long.toString(l)); } void print( double d){ print(Double.toString(d)); } void println( double d){ println(Double.toString(d)); } void print( boolean b){ print(Boolean.toString(b)); } void println( boolean b){ println(Boolean.toString(b)); } void print( char c){ try{bw.write(c); }catch (IOException e){ e.printStackTrace(); } } void println( char c){ println(Character.toString(c)); } void print( String s){ try{bw.write(s); }catch (IOException e){ e.printStackTrace(); } } void println( String s){ print(s); print('\n'); } void close(){ try{bw.close(); }catch (IOException e){ e.printStackTrace(); } } } }
0	public class p84a{ public static void main( String[] args){ Scanner in = new Scanner(System.in);  int n = in.nextInt(); System.out.println(((n / 2) * 3)); } }
2	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);  TaskD solver = new TaskD(); solver.solve(1,in,out); out.close(); } } class TaskD{ public void solve( int testNumber, InputReader in, PrintWriter out){ long l = in.nextLong();  long r = in.nextLong();  boolean[][] answer = new boolean[2][100];  int cur = 0; while((r > 0)){answer[0][cur] = ((r % 2) != 0); ++cur; r >>= 1; }cur = 0; while((l > 0)){answer[1][cur] = ((l % 2) != 0); ++cur; l >>= 1; } int old = -1; for ( int i = 63;(i >= 0);--i) {if ( (answer[0][i] && !answer[1][i])) {old = i; break;} }if ( (old == -1)) {out.println(0); return ;} long a = 1; for ( int i = 0;(i < old);++i) {a <<= 1; a += 1; }out.println(a); } } class InputReader{ static private BufferedReader bufferedReader ; static private StringTokenizer stringTokenizer ; public InputReader( InputStream inputStream){ bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); stringTokenizer = null; } public String next(){ while(((stringTokenizer == null) || !stringTokenizer.hasMoreTokens())){try{stringTokenizer = new StringTokenizer(bufferedReader.readLine()); }catch (IOException e){ e.printStackTrace(); } }return stringTokenizer.nextToken();} public long nextLong(){ return Long.parseLong(next());} }
3	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);  C908 solver = new C908(); solver.solve(1,in,out); out.close(); } static class C908{ int N ; int R ; int[] x ; double[] ans ; public void solve( int testNumber, FastScanner s, PrintWriter out){ N = s.nextInt(); R = s.nextInt(); x = s.nextIntArray(N); ans = new double[N]; Arrays.fill(ans,R); for ( int i = 0;(i < N);i++) {for ( int j = 0;(j < i);j++) {if ( (Math.abs((x[i] - x[j])) <= (2 * R))) { double dy = Math.sqrt((Math.pow((2 * R),2) - Math.pow((x[i] - x[j]),2))); ans[i] = Math.max(ans[i],(ans[j] + dy)); } }}for ( double d :ans) out.print((d + " ")); out.println(); } } static 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));} public int nextInt(){ return Integer.parseInt(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 int[] nextIntArray( int N){ int[] ret = new int[N]; for ( int i = 0;(i < N);i++) ret[i] = this.nextInt(); return ret;} } }
0	public class Main{ public static void main( String[] args){ InputReader in = new InputReader();  PrintWriter out = new PrintWriter(System.out); while(in.hasNext()){ long n = in.nextLong(); out.println("25"); }out.close(); } } class InputReader{ BufferedReader buf ; StringTokenizer tok ; InputReader(){ buf = new BufferedReader(new InputStreamReader(System.in)); } boolean hasNext(){ while(((tok == null) || !tok.hasMoreElements())){try{tok = new StringTokenizer(buf.readLine()); }catch (Exception e){ return false;} }return true;} String next(){ if ( hasNext()) return tok.nextToken(); return null;} long nextLong(){ return Long.parseLong(next());} }
3	public class Main{ public static void main( String[] args){ InputStream inputStream = System.in;  OutputStream outputStream = System.out;  FastReader in = new FastReader(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, FastReader in, PrintWriter out){ Debug debug = new Debug(out);  int n = in.nextInt();  TaskC.Circle[] c = new TaskC.Circle[n];  double rr = in.nextInt(); for ( int i = 0;(i < n);++i) {c[i] = new TaskC.Circle(); c[i].x = in.nextInt(); } ArrayList<TaskC.Circle> done = new ArrayList<>(); for ( int i = 0;(i < n);++i) { TaskC.Circle cur = c[i];  double ans = Double.MIN_VALUE; for ( int j = 0;(j < done.size());++j) { TaskC.Circle dd = done.get(j); if ( (Double.compare((2 * rr),Math.abs((dd.x - cur.x))) < 0)) continue; double temp = (Math.sqrt((((4 * rr) * rr) - ((cur.x - dd.x) * (cur.x - dd.x)))) + dd.y); ans = Math.max(ans,temp); }if ( (ans == Double.MIN_VALUE)) ans = rr; cur.y = ans; done.add(cur); }for ( TaskC.Circle cc :done) {out.printf("%.12f ",cc.y); }} } static class Debug{ PrintWriter out ; boolean oj ; long timeBegin ; Runtime runtime ; public Debug( PrintWriter out){ oj = (System.getProperty("ONLINE_JUDGE") != null); this.out = out; this.timeBegin = System.currentTimeMillis(); this.runtime = Runtime.getRuntime(); } } static class FastReader{ private InputStream stream ; private byte[] buf = new byte[8192]; private int curChar ; private int pnumChars ; public FastReader( InputStream stream){ this.stream = stream; } private int pread(){ if ( (pnumChars == -1)) {throw (new InputMismatchException());} if ( (curChar >= pnumChars)) {curChar = 0; try{pnumChars = stream.read(buf); }catch (IOException e){ throw (new InputMismatchException());} if ( (pnumChars <= 0)) {return -1;} } return buf[curChar++];} public int nextInt(){ int c = pread(); while(isSpaceChar(c))c = pread(); int sgn = 1; if ( (c == '-')) {sgn = -1; c = pread(); } int res = 0; do {if ( (c == ',')) {c = pread(); } if ( ((c < '0') || (c > '9'))) {throw (new InputMismatchException());} res *= 10; res += (c - '0'); c = pread(); }while(!isSpaceChar(c));return (res * sgn);} private boolean isSpaceChar( int c){ return (((((c == ' ') || (c == '\n')) || (c == '\r')) || (c == '\t')) || (c == -1));} } }
0	public class LCM{ public static void main( String[] args){ Scanner sc = new Scanner(System.in);  long n = sc.nextLong(); if ( (n < 3)) {System.out.println(n); } else if ( ((n % 2) != 0)) {System.out.println(((n * (n - 1)) * (n - 2))); } else if ( ((n % 3) == 0)) {System.out.println((((n - 1) * (n - 2)) * (n - 3))); } else {System.out.println(((n * (n - 1)) * (n - 3))); }} }
3	public class G{ static final int P = 1_000_000_007; int[][] ways ; int[][] pow ; void preCalc( int sz){ ways = new int[sz][]; for ( int i = 0;(i < ways.length);i++) {ways[i] = new int[(i + 1)]; ways[i][0] = ways[i][i] = 1; for ( int j = 1;(j < i);j++) {ways[i][j] = ((ways[(i - 1)][j] + ways[(i - 1)][(j - 1)]) % P); }}pow = new int[10][sz]; pow[0] = null; for ( int i = 1;(i <= 9);i++) {pow[i][0] = 1; for ( int j = 1;(j < sz);j++) {pow[i][j] = (int)(((long)pow[i][(j - 1)] * i) % P); }}} int solve( String ss){ int n = ss.length();  int[] s = new int[n]; for ( int i = 0;(i < n);i++) {s[i] = (ss.charAt(i) - '0'); }preCalc((n + 10)); int[] ans = new int[(n + 1)];  int[] cnt = new int[10]; for ( int i = 0;(i < n);i++) { int rest = ((n - i) - 1);  int dig = s[i]; for ( int j = 0;(j <= ((i == (n - 1))?dig:(dig - 1)));j++) {cnt[j]++; for ( int use = 1;(use < 10);use++) {for ( int cntGood = 0;(cntGood <= rest);cntGood++) { int delta = (int)(((((long)ways[rest][cntGood] * pow[use][(rest - cntGood)]) % P) * pow[(10 - use)][cntGood]) % P);  int idx = (cnt[use] + cntGood); ans[idx] += delta; if ( (ans[idx] >= P)) {ans[idx] -= P; } }}}cnt[dig]++; } int ret = 0;  long mult = 0; for ( int i = 1;(i < ans.length);i++) {mult = (((10L * mult) + 1) % P); ret += (int)((mult * ans[i]) % P); if ( (ret >= P)) {ret -= P; } }return ret;} void submit(){ out.println(solve(nextToken())); } G()throws IOException{ br = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); submit(); out.close(); } static final Random rng = new Random(); public static void main( String[] args)throws IOException { new G(); } BufferedReader br ; PrintWriter out ; StringTokenizer st ; String nextToken(){ while(((st == null) || !st.hasMoreTokens())){try{st = new StringTokenizer(br.readLine()); }catch (IOException e){ throw (new RuntimeException(e));} }return st.nextToken();} int nextInt(){ return Integer.parseInt(nextToken());} }
2	public class DD{ public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  long k = Long.parseLong(br.readLine());  long ans = (9 * (int)Math.pow(10,0));  int c = 0;  long start = 0; while((k > ans)){c++; start = ans; ans += ((9 * (long)Math.pow(10,c)) * (c + 1)); } long ms = (((k - start) - 1) % (c + 1));  long a = ((long)Math.pow(10,c) + (((k - start) - 1) / (c + 1))); System.out.println((a + "")); } }
6	public class Main{ public static void main( String[] args)throws java.lang.Exception { BufferedReader kek = new BufferedReader(new InputStreamReader(System.in));  PrintWriter outkek = new PrintWriter(System.out);  int N = Integer.parseInt(kek.readLine());  double[][] lake = new double[N][N]; for ( int i = 0;(i < N);i++) { String[] input = kek.readLine().split(" "); for ( int j = 0;(j < N);j++) {lake[i][j] = Double.parseDouble(input[j]); }} int pow = (int)Math.pow(2,N);  double[] res = new double[pow]; res[(pow - 1)] = 1.0; for ( int i = (pow - 1);(i >= 0);i--) { int ones = Integer.bitCount(i);  int possibleCombos = ((ones * (ones - 1)) / 2); for ( int j = 0;(j < N);j++) {if ( (((i >> j) % 2) == 0)) {continue;} for ( int k = (j + 1);(k < N);k++) {if ( (((i >> k) % 2) == 0)) {continue;} res[(i ^ (1 << k))] += ((res[i] * lake[j][k]) / possibleCombos); res[(i ^ (1 << j))] += ((res[i] * lake[k][j]) / possibleCombos); }}}for ( int i = 0;(i < N);i++) {outkek.print((res[(1 << i)] + " ")); }kek.close(); outkek.close(); } }
0	public class A{ public static void main( String[] ar)throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  String s1[] = br.readLine().split(" ");  int n = Integer.parseInt(s1[0]);  int S = Integer.parseInt(s1[1]); if ( ((S % n) == 0)) System.out.println((S / n)); else System.out.println(((S / n) + 1)); } }
4	public class CF1185G2{ static final int MD = 1000000007; static int[][] solve1( int[] aa, int t, int n){ int[][] da = new int[(t + 1)][(n + 1)]; da[0][0] = 1; for ( int i = 0;(i < n);i++) { int a = aa[i]; for ( int s = (t - 1);(s >= 0);s--) for ( int m = 0;(m < n);m++) { int x = da[s][m]; if ( (x != 0)) { int s_ = (s + a); if ( (s_ <= t)) da[s_][(m + 1)] = ((da[s_][(m + 1)] + x) % MD); } }}return da;} static int[][][] solve2( int[] aa, int[] bb, int t, int na, int nb){ int[][] da = solve1(aa,t,na);  int[][][] dab = new int[(t + 1)][(na + 1)][(nb + 1)]; for ( int s = 0;(s <= t);s++) for ( int ma = 0;(ma <= na);ma++) dab[s][ma][0] = da[s][ma]; for ( int i = 0;(i < nb);i++) { int b = bb[i]; for ( int s = (t - 1);(s >= 0);s--) for ( int ma = 0;(ma <= na);ma++) for ( int mb = 0;(mb < nb);mb++) { int x = dab[s][ma][mb]; if ( (x != 0)) { int s_ = (s + b); if ( (s_ <= t)) dab[s_][ma][(mb + 1)] = ((dab[s_][ma][(mb + 1)] + x) % MD); } }}return dab;} static long power( int a, int k){ if ( (k == 0)) return 1; long p = power(a,(k / 2)); p = ((p * p) % MD); if ( ((k % 2) == 1)) p = ((p * a) % MD); return p;} static int[] ff ,gg ; static int ch( int n, int k){ return (int)(((((long)ff[n] * gg[(n - k)]) % MD) * gg[k]) % MD);} static int[][][] init( int n, int na, int nb, int nc){ ff = new int[(n + 1)]; gg = new int[(n + 1)]; for ( int i = 0,f = 1;(i <= n);i++) {ff[i] = f; gg[i] = (int)power(f,(MD - 2)); f = (int)(((long)f * (i + 1)) % MD); } int[][][] dp = new int[(na + 1)][(nb + 1)][(nc + 1)]; for ( int ma = 0;(ma <= na);ma++) for ( int mb = 0;(mb <= nb);mb++) for ( int mc = 0;(mc <= nc);mc++) { int x = (int)(((((((long)ff[((ma + mb) + mc)] * gg[ma]) % MD) * gg[mb]) % MD) * gg[mc]) % MD); for ( int ma_ = ((ma == 0)?0:1);(ma_ <= ma);ma_++) { int cha = ((ma == 0)?1:ch((ma - 1),(ma_ - 1))); for ( int mb_ = ((mb == 0)?0:1);(mb_ <= mb);mb_++) { int chb = ((mb == 0)?1:ch((mb - 1),(mb_ - 1))); for ( int mc_ = ((mc == 0)?0:1);(mc_ <= mc);mc_++) { int chc = ((mc == 0)?1:ch((mc - 1),(mc_ - 1)));  int y = dp[ma_][mb_][mc_]; if ( (y == 0)) continue; x = (int)((x - ((((((long)y * cha) % MD) * chb) % MD) * chc)) % MD); }}}if ( (x < 0)) x += MD; dp[ma][mb][mc] = x; }for ( int ma = 0;(ma <= na);ma++) for ( int mb = 0;(mb <= nb);mb++) for ( int mc = 0;(mc <= nc);mc++) dp[ma][mb][mc] = (int)(((((((long)dp[ma][mb][mc] * ff[ma]) % MD) * ff[mb]) % MD) * ff[mc]) % MD); return dp;} public static void main( String[] args)throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in));  StringTokenizer st = new StringTokenizer(br.readLine());  int n = Integer.parseInt(st.nextToken());  int t = Integer.parseInt(st.nextToken());  int[] aa = new int[n];  int[] bb = new int[n];  int[] cc = new int[n];  int na = 0,nb = 0,nc = 0; for ( int i = 0;(i < n);i++) {st = new StringTokenizer(br.readLine()); int a = Integer.parseInt(st.nextToken());  int g = Integer.parseInt(st.nextToken()); if ( (g == 1)) aa[na++] = a; else if ( (g == 2)) bb[nb++] = a; else cc[nc++] = a; } int[][][] dp = init(n,na,nb,nc);  int[][][] dab = solve2(aa,bb,t,na,nb);  int[][] dc = solve1(cc,t,nc);  int ans = 0; for ( int tab = 0;(tab <= t);tab++) { int tc = (t - tab); for ( int ma = 0;(ma <= na);ma++) for ( int mb = 0;(mb <= nb);mb++) { int xab = dab[tab][ma][mb]; if ( (xab == 0)) continue; for ( int mc = 0;(mc <= nc);mc++) { int xc = dc[tc][mc]; if ( (xc == 0)) continue; ans = (int)((ans + ((((long)xab * xc) % MD) * dp[ma][mb][mc])) % MD); }}}System.out.println(ans); } }